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

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

Issue 7178002: Open Options page on top of NTP. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Refactor settings API methods together. Switch test order. Created 9 years, 6 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
« no previous file with comments | « chrome/browser/ui/browser_navigator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_navigator_browsertest.cc
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc
index 2ccdbaaadf35801e26b925ae8cae77fb9e1c974e..a6dd316fe7ce13c45cacc72ead7d3c2730835ccd 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -886,4 +886,106 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
EXPECT_FALSE(tab_contents->is_crashed());
}
+IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
+ NavigateFromDefaultToOptionsInSameTab) {
+ browser()->OpenOptionsDialog();
+ ui_test_utils::WaitForNavigationInCurrentTab(browser());
+ EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(GURL("chrome://settings/browser"),
+ browser()->GetSelectedTabContents()->GetURL());
+}
+
+IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
+ NavigateFromBlankToOptionsInSameTab) {
+ browser::NavigateParams p(MakeNavigateParams());
+ p.url = GURL("about:blank");
+ browser::Navigate(&p);
+ ui_test_utils::WaitForNavigationInCurrentTab(browser());
+
+ browser()->OpenOptionsDialog();
+ ui_test_utils::WaitForNavigationInCurrentTab(browser());
+ EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(GURL("chrome://settings/browser"),
+ browser()->GetSelectedTabContents()->GetURL());
+}
+
+IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
+ NavigateFromNTPToOptionsInSameTab) {
+ browser::NavigateParams p(MakeNavigateParams());
+ p.url = GURL("chrome://newtab");
+ browser::Navigate(&p);
+ ui_test_utils::WaitForNavigationInCurrentTab(browser());
+ EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(GURL("chrome://newtab"),
+ browser()->GetSelectedTabContents()->GetURL());
+
+ browser()->OpenOptionsDialog();
+ ui_test_utils::WaitForNavigationInCurrentTab(browser());
+ EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(GURL("chrome://settings/browser"),
+ browser()->GetSelectedTabContents()->GetURL());
+}
+
+IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
+ NavigateFromPageToOptionsInNewTab) {
+ browser::NavigateParams p(MakeNavigateParams());
+ browser::Navigate(&p);
+ ui_test_utils::WaitForNavigationInCurrentTab(browser());
+ EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedTabContents()->GetURL());
+ EXPECT_EQ(1u, BrowserList::size());
+ EXPECT_EQ(1, browser()->tab_count());
+
+ browser()->OpenOptionsDialog();
+ ui_test_utils::WaitForNavigationInCurrentTab(browser());
+ EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(GURL("chrome://settings/browser"),
+ browser()->GetSelectedTabContents()->GetURL());
+}
+
+IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
+ NavigateFromNTPToOptionsSingleton) {
+ browser()->OpenOptionsDialog();
+ ui_test_utils::WaitForNavigationInCurrentTab(browser());
+ EXPECT_EQ(1, browser()->tab_count());
+
+ browser()->NewTab();
+ EXPECT_EQ(2, browser()->tab_count());
+
+ browser()->OpenOptionsDialog();
+ EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(GURL("chrome://settings"),
+ browser()->GetSelectedTabContents()->GetURL());
+}
+
+IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
+ NavigateFromNTPToOptionsPageInSameTab) {
+ browser()->ShowOptionsTab("personal");
+ ui_test_utils::WaitForNavigationInCurrentTab(browser());
+ EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(GURL("chrome://settings/personal"),
+ browser()->GetSelectedTabContents()->GetURL());
+
+ browser()->NewTab();
+ EXPECT_EQ(2, browser()->tab_count());
+
+ browser()->ShowOptionsTab("personal");
+ EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(GURL("chrome://settings/personal"),
+ browser()->GetSelectedTabContents()->GetURL());
+}
+
+IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
+ NavigateFromOtherTabToSingletonOptions) {
+ browser()->OpenOptionsDialog();
+ ui_test_utils::WaitForNavigationInCurrentTab(browser());
+ browser()->AddSelectedTabWithURL(GetGoogleURL(), PageTransition::LINK);
+ ui_test_utils::WaitForNavigationInCurrentTab(browser());
+
+ browser()->OpenOptionsDialog();
+ ui_test_utils::WaitForNavigationInCurrentTab(browser());
+ EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(GURL("chrome://settings/browser"),
+ browser()->GetSelectedTabContents()->GetURL());
+}
+
} // namespace
« no previous file with comments | « chrome/browser/ui/browser_navigator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698