| Index: chrome/browser/ui/browser_navigator_browsertest.cc
|
| ===================================================================
|
| --- chrome/browser/ui/browser_navigator_browsertest.cc (revision 157079)
|
| +++ chrome/browser/ui/browser_navigator_browsertest.cc (working copy)
|
| @@ -40,8 +40,7 @@
|
| }
|
|
|
| GURL GetSettingsURL() {
|
| - return GURL(chrome::kChromeUIUberURL).Resolve(
|
| - chrome::kChromeUISettingsHost + std::string("/"));
|
| + return GURL(chrome::kChromeUISettingsURL);
|
| }
|
|
|
| GURL GetContentSettingsURL() {
|
| @@ -52,6 +51,20 @@
|
| return GetSettingsURL().Resolve(chrome::kClearBrowserDataSubPage);
|
| }
|
|
|
| +// Converts long uber URLs ("chrome://chrome/foo/") to short (virtual) URLs
|
| +// ("chrome://foo/"). This should be used to convert the return value of
|
| +// WebContentsImpl::GetURL before comparison because it can return either the
|
| +// real URL or the virtual URL.
|
| +GURL ShortenUberURL(const GURL& url) {
|
| + std::string url_string = url.spec();
|
| + const std::string long_prefix = "chrome://chrome/";
|
| + const std::string short_prefix = "chrome://";
|
| + if (url_string.find(long_prefix) != 0)
|
| + return url;
|
| + url_string.replace(0, long_prefix.length(), short_prefix);
|
| + return GURL(url_string);
|
| +}
|
| +
|
| } // namespace
|
|
|
| chrome::NavigateParams BrowserNavigatorTest::MakeNavigateParams() const {
|
| @@ -722,7 +735,7 @@
|
| EXPECT_EQ(3, browser()->tab_count());
|
| EXPECT_EQ(2, browser()->active_index());
|
| EXPECT_EQ(GetContentSettingsURL(),
|
| - chrome::GetActiveWebContents(browser())->GetURL());
|
| + ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
|
| }
|
|
|
| // This test verifies that constructing params with disposition = SINGLETON_TAB
|
| @@ -755,7 +768,7 @@
|
| EXPECT_EQ(3, browser()->tab_count());
|
| EXPECT_EQ(1, browser()->active_index());
|
| EXPECT_EQ(GetContentSettingsURL(),
|
| - chrome::GetActiveWebContents(browser())->GetURL());
|
| + ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
|
| }
|
|
|
| // This test verifies that constructing params with disposition = SINGLETON_TAB
|
| @@ -788,7 +801,7 @@
|
| EXPECT_EQ(3, browser()->tab_count());
|
| EXPECT_EQ(1, browser()->active_index());
|
| EXPECT_EQ(GetClearBrowsingDataURL(),
|
| - chrome::GetActiveWebContents(browser())->GetURL());
|
| + ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
|
| }
|
|
|
| // This test verifies that constructing params with disposition = SINGLETON_TAB
|
| @@ -820,7 +833,7 @@
|
| EXPECT_EQ(3, browser()->tab_count());
|
| EXPECT_EQ(1, browser()->active_index());
|
| EXPECT_EQ(singleton_url1,
|
| - chrome::GetActiveWebContents(browser())->GetURL());
|
| + ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
|
| }
|
|
|
| // This test verifies that constructing params with disposition = SINGLETON_TAB
|
| @@ -851,7 +864,7 @@
|
| EXPECT_EQ(2, browser()->tab_count());
|
| EXPECT_EQ(1, browser()->active_index());
|
| EXPECT_EQ(singleton_url_target,
|
| - chrome::GetActiveWebContents(browser())->GetURL());
|
| + ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
|
| }
|
|
|
| // This test verifies that constructing params with disposition = SINGLETON_TAB
|
| @@ -910,7 +923,7 @@
|
|
|
| EXPECT_EQ(1u, BrowserList::size());
|
| EXPECT_EQ(GetSettingsURL(),
|
| - chrome::GetActiveWebContents(browser())->GetURL());
|
| + ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
|
| }
|
|
|
| // Settings page is expected to always open in normal mode regardless
|
| @@ -994,7 +1007,7 @@
|
| }
|
| EXPECT_EQ(1, browser()->tab_count());
|
| EXPECT_EQ(GetSettingsURL(),
|
| - chrome::GetActiveWebContents(browser())->GetURL());
|
| + ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
|
| @@ -1012,7 +1025,7 @@
|
| }
|
| EXPECT_EQ(1, browser()->tab_count());
|
| EXPECT_EQ(GetSettingsURL(),
|
| - chrome::GetActiveWebContents(browser())->GetURL());
|
| + ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
|
| @@ -1033,7 +1046,7 @@
|
| }
|
| EXPECT_EQ(1, browser()->tab_count());
|
| EXPECT_EQ(GetSettingsURL(),
|
| - chrome::GetActiveWebContents(browser())->GetURL());
|
| + ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
|
| @@ -1053,7 +1066,7 @@
|
| }
|
| EXPECT_EQ(2, browser()->tab_count());
|
| EXPECT_EQ(GetSettingsURL(),
|
| - chrome::GetActiveWebContents(browser())->GetURL());
|
| + ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
|
| @@ -1079,7 +1092,7 @@
|
| }
|
| EXPECT_EQ(2, browser()->tab_count());
|
| EXPECT_EQ(GetSettingsURL(),
|
| - chrome::GetActiveWebContents(browser())->GetURL());
|
| + ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
|
| @@ -1144,7 +1157,7 @@
|
| }
|
| EXPECT_EQ(2, browser()->tab_count());
|
| EXPECT_EQ(GetSettingsURL(),
|
| - chrome::GetActiveWebContents(browser())->GetURL());
|
| + ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
|
| }
|
|
|
| // Tests that when a new tab is opened from the omnibox, the focus is moved from
|
|
|