Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AI Chat]: AiChat ==> AIChat to make running tests easier #27242

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions browser/ai_chat/ai_chat_browsertests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

namespace ai_chat {

class AiChatBrowserTest : public InProcessBrowserTest {
class AIChatBrowserTest : public InProcessBrowserTest {
public:
AiChatBrowserTest() = default;
AIChatBrowserTest() = default;

void SetUpOnMainThread() override {
base::FilePath test_data_dir =
Expand Down Expand Up @@ -81,7 +81,7 @@ class AiChatBrowserTest : public InProcessBrowserTest {
net::EmbeddedTestServer https_server_{net::EmbeddedTestServer::TYPE_HTTPS};
};

IN_PROC_BROWSER_TEST_F(AiChatBrowserTest, YoutubeNavigations) {
IN_PROC_BROWSER_TEST_F(AIChatBrowserTest, YoutubeNavigations) {
const GURL url("https://www.youtube.com/youtube.html");

ui_test_utils::NavigateToURLWithDisposition(
Expand Down
32 changes: 16 additions & 16 deletions browser/ai_chat/ai_chat_throttle_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ constexpr char kTestProfileName[] = "TestProfile";

} // namespace

class AiChatThrottleUnitTest : public testing::Test,
class AIChatThrottleUnitTest : public testing::Test,
public ::testing::WithParamInterface<bool> {
public:
AiChatThrottleUnitTest() = default;
AiChatThrottleUnitTest(const AiChatThrottleUnitTest&) = delete;
AiChatThrottleUnitTest& operator=(const AiChatThrottleUnitTest&) = delete;
~AiChatThrottleUnitTest() override = default;
AIChatThrottleUnitTest() = default;
AIChatThrottleUnitTest(const AIChatThrottleUnitTest&) = delete;
AIChatThrottleUnitTest& operator=(const AIChatThrottleUnitTest&) = delete;
~AIChatThrottleUnitTest() override = default;

void SetUp() override {
TestingBrowserProcess* browser_process = TestingBrowserProcess::GetGlobal();
Expand Down Expand Up @@ -68,13 +68,13 @@ class AiChatThrottleUnitTest : public testing::Test,

INSTANTIATE_TEST_SUITE_P(
,
AiChatThrottleUnitTest,
AIChatThrottleUnitTest,
::testing::Bool(),
[](const testing::TestParamInfo<AiChatThrottleUnitTest::ParamType>& info) {
[](const testing::TestParamInfo<AIChatThrottleUnitTest::ParamType>& info) {
return base::StrCat({"History", info.param ? "Enabled" : "Disabled"});
});

TEST_P(AiChatThrottleUnitTest, CancelNavigationFromTab) {
TEST_P(AIChatThrottleUnitTest, CancelNavigationFromTab) {
content::MockNavigationHandle test_handle(web_contents());

test_handle.set_url(GURL(kAIChatUIURL));
Expand All @@ -85,8 +85,8 @@ TEST_P(AiChatThrottleUnitTest, CancelNavigationFromTab) {

test_handle.set_page_transition(transition);

std::unique_ptr<AiChatThrottle> throttle =
AiChatThrottle::MaybeCreateThrottleFor(&test_handle);
std::unique_ptr<AIChatThrottle> throttle =
AIChatThrottle::MaybeCreateThrottleFor(&test_handle);

#if !BUILDFLAG(IS_ANDROID)
if (IsAIChatHistoryEnabled()) {
Expand All @@ -101,7 +101,7 @@ TEST_P(AiChatThrottleUnitTest, CancelNavigationFromTab) {
#endif
}

TEST_P(AiChatThrottleUnitTest, CancelNavigationToFrame) {
TEST_P(AIChatThrottleUnitTest, CancelNavigationToFrame) {
content::MockNavigationHandle test_handle(web_contents());

test_handle.set_url(GURL(kAIChatUntrustedConversationUIURL));
Expand All @@ -112,8 +112,8 @@ TEST_P(AiChatThrottleUnitTest, CancelNavigationToFrame) {

test_handle.set_page_transition(transition);

std::unique_ptr<AiChatThrottle> throttle =
AiChatThrottle::MaybeCreateThrottleFor(&test_handle);
std::unique_ptr<AIChatThrottle> throttle =
AIChatThrottle::MaybeCreateThrottleFor(&test_handle);
#if !BUILDFLAG(IS_ANDROID)
EXPECT_EQ(content::NavigationThrottle::CANCEL_AND_IGNORE,
throttle->WillStartRequest().action());
Expand All @@ -122,7 +122,7 @@ TEST_P(AiChatThrottleUnitTest, CancelNavigationToFrame) {
#endif
}

TEST_P(AiChatThrottleUnitTest, AllowNavigationFromPanel) {
TEST_P(AIChatThrottleUnitTest, AllowNavigationFromPanel) {
content::MockNavigationHandle test_handle(web_contents());

test_handle.set_url(GURL(kAIChatUIURL));
Expand All @@ -137,8 +137,8 @@ TEST_P(AiChatThrottleUnitTest, AllowNavigationFromPanel) {

test_handle.set_page_transition(transition);

std::unique_ptr<AiChatThrottle> throttle =
AiChatThrottle::MaybeCreateThrottleFor(&test_handle);
std::unique_ptr<AIChatThrottle> throttle =
AIChatThrottle::MaybeCreateThrottleFor(&test_handle);
EXPECT_EQ(throttle.get(), nullptr);
}

Expand Down
2 changes: 1 addition & 1 deletion browser/brave_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ BraveContentBrowserClient::CreateThrottlesForNavigation(

if (Profile::FromBrowserContext(context)->IsRegularProfile()) {
if (auto ai_chat_throttle =
ai_chat::AiChatThrottle::MaybeCreateThrottleFor(handle)) {
ai_chat::AIChatThrottle::MaybeCreateThrottleFor(handle)) {
throttles.push_back(std::move(ai_chat_throttle));
}
}
Expand Down
14 changes: 7 additions & 7 deletions components/ai_chat/content/browser/ai_chat_throttle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace ai_chat {

// static
std::unique_ptr<AiChatThrottle> AiChatThrottle::MaybeCreateThrottleFor(
std::unique_ptr<AIChatThrottle> AIChatThrottle::MaybeCreateThrottleFor(
content::NavigationHandle* navigation_handle) {
// The throttle's only purpose is to deny navigation in a Tab.

Expand Down Expand Up @@ -65,21 +65,21 @@ std::unique_ptr<AiChatThrottle> AiChatThrottle::MaybeCreateThrottleFor(
ui::PageTransition::PAGE_TRANSITION_FROM_ADDRESS_BAR)) {
return nullptr;
}
return std::make_unique<AiChatThrottle>(navigation_handle);
return std::make_unique<AIChatThrottle>(navigation_handle);
#endif // BUILDFLAG(IS_ANDROID)
}

AiChatThrottle::AiChatThrottle(content::NavigationHandle* handle)
AIChatThrottle::AIChatThrottle(content::NavigationHandle* handle)
: content::NavigationThrottle(handle) {}

AiChatThrottle::~AiChatThrottle() {}
AIChatThrottle::~AIChatThrottle() {}

AiChatThrottle::ThrottleCheckResult AiChatThrottle::WillStartRequest() {
AIChatThrottle::ThrottleCheckResult AIChatThrottle::WillStartRequest() {
return CANCEL_AND_IGNORE;
}

const char* AiChatThrottle::GetNameForLogging() {
return "AiChatThrottle";
const char* AIChatThrottle::GetNameForLogging() {
return "AIChatThrottle";
}

} // namespace ai_chat
8 changes: 4 additions & 4 deletions components/ai_chat/content/browser/ai_chat_throttle.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ class NavigationHandle;
namespace ai_chat {

// Prevents navigation to certain AI Chat URLs
class AiChatThrottle : public content::NavigationThrottle {
class AIChatThrottle : public content::NavigationThrottle {
public:
explicit AiChatThrottle(content::NavigationHandle* handle);
~AiChatThrottle() override;
explicit AIChatThrottle(content::NavigationHandle* handle);
~AIChatThrottle() override;

static std::unique_ptr<AiChatThrottle> MaybeCreateThrottleFor(
static std::unique_ptr<AIChatThrottle> MaybeCreateThrottleFor(
content::NavigationHandle* navigation_handle);

// content::NavigationThrottle:
Expand Down
2 changes: 1 addition & 1 deletion components/sidebar/browser/sidebar_service_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ TEST_F(SidebarServiceOrderingTest, LoadFromPrefsWalletBuiltInHidden) {
LoadFromPrefsTest(std::move(sidebar), items, expected_count);
}

TEST_F(SidebarServiceOrderingTest, LoadFromPrefsAiChatBuiltInNotListed) {
TEST_F(SidebarServiceOrderingTest, LoadFromPrefsAIChatBuiltInNotListed) {
base::Value::Dict sidebar =
base::test::ParseJsonDict(sidebar_builtin_ai_chat_not_listed_json);

Expand Down
Loading