Skip to content

Commit 1dce7cf

Browse files
authored
Merge pull request #1745 from brave/cleanup_url_handler_registration
Remove redundant UrlHandler pair
2 parents 680cb0f + 700ed71 commit 1dce7cf

File tree

2 files changed

+33
-11
lines changed

2 files changed

+33
-11
lines changed

browser/brave_content_browser_client.cc

-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ bool HandleURLOverrideRewrite(GURL* url,
8989
return false;
9090
}
9191

92-
9392
bool HandleURLReverseOverrideRewrite(GURL* url,
9493
content::BrowserContext* browser_context) {
9594
if (url->host() == chrome::kChromeUIWelcomeHost ||
@@ -142,8 +141,6 @@ void BraveContentBrowserClient::BrowserURLHandlerCreated(
142141
handler->AddHandlerPair(&HandleURLRewrite,
143142
&HandleURLReverseOverrideRewrite);
144143
ChromeContentBrowserClient::BrowserURLHandlerCreated(handler);
145-
handler->AddHandlerPair(&HandleURLOverrideRewrite,
146-
&HandleURLReverseOverrideRewrite);
147144
}
148145

149146
bool BraveContentBrowserClient::AllowAccessCookie(

browser/brave_content_browser_client_browsertest.cc

+33-8
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,40 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest,
205205
for (const std::string& scheme : schemes) {
206206
content::WebContents* contents =
207207
browser()->tab_strip_model()->GetActiveWebContents();
208-
ui_test_utils::NavigateToURL(browser(), GURL(scheme + "sync-internals/"));
209-
ASSERT_TRUE(WaitForLoadStop(contents));
208+
ui_test_utils::NavigateToURL(
209+
browser(), GURL(scheme + chrome::kChromeUISyncInternalsHost));
210+
ASSERT_TRUE(WaitForLoadStop(contents));
210211

211-
EXPECT_STREQ(contents->GetController().GetLastCommittedEntry()
212-
->GetVirtualURL().spec().c_str(),
213-
"brave://sync/");
214-
EXPECT_STREQ(contents->GetController().GetLastCommittedEntry()
215-
->GetURL().spec().c_str(),
216-
"chrome://sync/");
212+
EXPECT_STREQ(contents->GetController().GetLastCommittedEntry()
213+
->GetVirtualURL().spec().c_str(),
214+
"brave://sync/");
215+
EXPECT_STREQ(contents->GetController().GetLastCommittedEntry()
216+
->GetURL().spec().c_str(),
217+
"chrome://sync/");
218+
}
219+
}
220+
221+
IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest,
222+
RewriteWelcomeWin10Host) {
223+
std::vector<std::string> schemes {
224+
"brave://",
225+
"chrome://",
226+
};
227+
228+
for (const std::string& scheme : schemes) {
229+
content::WebContents* contents =
230+
browser()->tab_strip_model()->GetActiveWebContents();
231+
ui_test_utils::NavigateToURL(
232+
browser(),
233+
GURL(scheme + chrome::kChromeUIWelcomeWin10Host));
234+
ASSERT_TRUE(WaitForLoadStop(contents));
235+
236+
EXPECT_STREQ(contents->GetController().GetLastCommittedEntry()
237+
->GetVirtualURL().spec().c_str(),
238+
"brave://welcome/");
239+
EXPECT_STREQ(contents->GetController().GetLastCommittedEntry()
240+
->GetURL().spec().c_str(),
241+
"chrome://welcome/");
217242
}
218243
}
219244

0 commit comments

Comments
 (0)