| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/browser_navigator_browsertest.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/chromeos/login/login_utils.h" |
| 9 #include "chrome/browser/tab_contents/tab_contents.h" |
| 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_list.h" |
| 12 #include "chrome/browser/ui/browser_navigator.h" |
| 13 |
| 14 namespace { |
| 15 |
| 16 // Subclass that tests navigation while in the Guest session. |
| 17 class BrowserGuestSessionNavigatorTest: public BrowserNavigatorTest { |
| 18 protected: |
| 19 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 20 CommandLine command_line_copy = *command_line; |
| 21 chromeos::LoginUtils::Get()->GetOffTheRecordCommandLine(GetGoogleURL(), |
| 22 command_line_copy, |
| 23 command_line); |
| 24 } |
| 25 }; |
| 26 |
| 27 // This test verifies that the settings page is opened in the incognito window |
| 28 // in Guest Session (as well as all other windows in Guest session). |
| 29 IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest, |
| 30 Disposition_Settings_UseIncognitoWindow) { |
| 31 Browser* incognito_browser = CreateIncognitoBrowser(); |
| 32 |
| 33 EXPECT_EQ(2u, BrowserList::size()); |
| 34 EXPECT_EQ(1, browser()->tab_count()); |
| 35 EXPECT_EQ(1, incognito_browser->tab_count()); |
| 36 |
| 37 // Navigate to the settings page. |
| 38 browser::NavigateParams p(MakeNavigateParams(incognito_browser)); |
| 39 p.disposition = SINGLETON_TAB; |
| 40 p.url = GURL("chrome://settings"); |
| 41 p.show_window = true; |
| 42 p.ignore_path = true; |
| 43 browser::Navigate(&p); |
| 44 |
| 45 // Settings page should be opened in incognito window. |
| 46 EXPECT_NE(browser(), p.browser); |
| 47 EXPECT_EQ(incognito_browser, p.browser); |
| 48 EXPECT_EQ(2, incognito_browser->tab_count()); |
| 49 EXPECT_EQ(GURL("chrome://settings"), |
| 50 incognito_browser->GetSelectedTabContents()->GetURL()); |
| 51 } |
| 52 |
| 53 } // namespace |
| OLD | NEW |