Chromium Code Reviews| 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 3fdf22f023df6185f8741c2659885d45e5763aa0..dedaff26fe61494b7580e1e0a9009e0eacd2599f 100644 |
| --- a/chrome/browser/ui/browser_navigator_browsertest.cc |
| +++ b/chrome/browser/ui/browser_navigator_browsertest.cc |
| @@ -17,6 +17,10 @@ |
| #include "chrome/test/ui_test_utils.h" |
| #include "ipc/ipc_message.h" |
| +#if defined(OS_CHROMEOS) |
| +#include "chrome/browser/chromeos/login/login_utils.h" |
| +#endif |
| + |
| namespace { |
| class BrowserNavigatorTest : public InProcessBrowserTest, |
| @@ -135,7 +139,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| GURL url("http://www.google.com/"); |
| GURL singleton_url1("http://maps.google.com/"); |
| - // We should have one browser with 3 tabs, the 3rd selected. |
| + // We should have one browser with 1 tab. |
| EXPECT_EQ(1u, BrowserList::size()); |
| EXPECT_EQ(0, browser()->selected_index()); |
| @@ -681,4 +685,94 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| browser()->GetSelectedTabContents()->GetURL()); |
| } |
| +// This test verifies that the settings page isn't open in the incognito window. |
| +IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| + Disposition_Settings_UseNonIncognitoWindow) { |
| + Browser* incognito_browser = CreateIncognitoBrowser(); |
| + |
| + EXPECT_EQ(2u, BrowserList::size()); |
| + EXPECT_EQ(1, browser()->tab_count()); |
| + EXPECT_EQ(1, incognito_browser->tab_count()); |
| + |
| + // Navigate to the settings page. |
| + browser::NavigateParams p(MakeNavigateParams(incognito_browser)); |
| + p.disposition = SINGLETON_TAB; |
| + p.url = GURL("chrome://settings"); |
| + p.show_window = true; |
| + p.ignore_path = true; |
| + browser::Navigate(&p); |
| + |
| + // The settings page should be opened in browser() window. |
| + EXPECT_NE(incognito_browser, p.browser); |
| + EXPECT_EQ(browser(), p.browser); |
| + EXPECT_EQ(2, browser()->tab_count()); |
| + EXPECT_EQ(GURL("chrome://settings"), |
| + browser()->GetSelectedTabContents()->GetURL()); |
| +} |
| + |
| +// This test verifies that the bookmarks page isn't open in the incognito |
|
Evan Stade
2011/01/31 21:06:22
s/open/opened (also in the other comments)
altimofeev
2011/02/01 12:42:15
Done.
|
| +// window. |
| +IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| + Disposition_Bookmarks_UseNonIncognitoWindow) { |
| + Browser* incognito_browser = CreateIncognitoBrowser(); |
| + |
| + EXPECT_EQ(2u, BrowserList::size()); |
| + EXPECT_EQ(1, browser()->tab_count()); |
| + EXPECT_EQ(1, incognito_browser->tab_count()); |
| + |
| + // Navigate to the settings page. |
| + browser::NavigateParams p(MakeNavigateParams(incognito_browser)); |
| + p.disposition = SINGLETON_TAB; |
| + p.url = GURL("chrome://bookmarks"); |
| + p.show_window = true; |
| + p.ignore_path = true; |
| + browser::Navigate(&p); |
| + |
| + // The bookmarks page should be opened in browser() window. |
| + EXPECT_NE(incognito_browser, p.browser); |
| + EXPECT_EQ(browser(), p.browser); |
| + EXPECT_EQ(2, browser()->tab_count()); |
| + EXPECT_EQ(GURL("chrome://bookmarks"), |
| + browser()->GetSelectedTabContents()->GetURL()); |
| +} |
| + |
| +#if defined(OS_CHROMEOS) |
| +// Subclass that tests navigation while in the Guest session. |
| +class BrowserGuestSessionNavigatorTest: public BrowserNavigatorTest { |
| + protected: |
| + virtual void SetUpCommandLine(CommandLine* command_line) { |
| + CommandLine command_line_copy = *command_line; |
| + chromeos::LoginUtils::Get()->GetOffTheRecordCommandLine(GetGoogleURL(), |
| + command_line_copy, |
| + command_line); |
| + } |
| +}; |
| + |
| +// This test verifies that the settings page is open in the incognito window in |
| +// Guest Session (as well as all other windows in Guest session). |
| +IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest, |
| + Disposition_Settings_UseIncognitoWindow) { |
| + Browser* incognito_browser = CreateIncognitoBrowser(); |
| + |
| + EXPECT_EQ(2u, BrowserList::size()); |
| + EXPECT_EQ(1, browser()->tab_count()); |
| + EXPECT_EQ(1, incognito_browser->tab_count()); |
| + |
| + // Navigate to the settings page. |
| + browser::NavigateParams p(MakeNavigateParams(incognito_browser)); |
| + p.disposition = SINGLETON_TAB; |
| + p.url = GURL("chrome://settings"); |
| + p.show_window = true; |
| + p.ignore_path = true; |
| + browser::Navigate(&p); |
| + |
| + // Settings page should be opened in incognito window. |
| + EXPECT_NE(browser(), p.browser); |
| + EXPECT_EQ(incognito_browser, p.browser); |
| + EXPECT_EQ(2, incognito_browser->tab_count()); |
| + EXPECT_EQ(GURL("chrome://settings"), |
| + incognito_browser->GetSelectedTabContents()->GetURL()); |
| +} |
| +#endif |
| + |
| } // namespace |