Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2332)

Unified Diff: chrome/browser/ui/browser_navigator_browsertest.cc

Issue 10780013: Add reverse URL handler for shortening uber URLs (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: short uber Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser_navigator_browsertest.cc
===================================================================
--- chrome/browser/ui/browser_navigator_browsertest.cc (revision 156197)
+++ 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,16 @@
return GetSettingsURL().Resolve(chrome::kClearBrowserDataSubPage);
}
+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 +731,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 +764,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 +797,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 +829,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 +860,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 +919,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 +1003,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 +1021,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 +1042,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 +1062,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 +1088,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 +1153,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

Powered by Google App Engine
This is Rietveld 408576698