| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/browser_navigator_browsertest.h" | 5 #include "chrome/browser/ui/browser_navigator_browsertest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/chromeos/login/chrome_restart_request.h" | 8 #include "chrome/browser/chromeos/login/chrome_restart_request.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
| 11 #include "chrome/browser/ui/browser_navigator.h" | 11 #include "chrome/browser/ui/browser_navigator.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
| 15 #include "chromeos/chromeos_switches.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 GURL GetGoogleURL() { | 20 GURL GetGoogleURL() { |
| 20 return GURL("http://www.google.com/"); | 21 return GURL("http://www.google.com/"); |
| 21 } | 22 } |
| 22 | 23 |
| 23 // Subclass that tests navigation while in the Guest session. | 24 // Subclass that tests navigation while in the Guest session. |
| 24 class BrowserGuestSessionNavigatorTest: public BrowserNavigatorTest { | 25 class BrowserGuestSessionNavigatorTest: public BrowserNavigatorTest { |
| 25 protected: | 26 protected: |
| 26 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 27 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 27 CommandLine command_line_copy = *command_line; | 28 CommandLine command_line_copy = *command_line; |
| 28 command_line_copy.AppendSwitchASCII(switches::kLoginProfile, "user"); | 29 command_line_copy.AppendSwitchASCII( |
| 30 chromeos::switches::kLoginProfile, "user"); |
| 29 chromeos::GetOffTheRecordCommandLine(GetGoogleURL(), | 31 chromeos::GetOffTheRecordCommandLine(GetGoogleURL(), |
| 30 command_line_copy, | 32 command_line_copy, |
| 31 command_line); | 33 command_line); |
| 32 } | 34 } |
| 33 }; | 35 }; |
| 34 | 36 |
| 35 // This test verifies that the settings page is opened in the incognito window | 37 // This test verifies that the settings page is opened in the incognito window |
| 36 // in Guest Session (as well as all other windows in Guest session). | 38 // in Guest Session (as well as all other windows in Guest session). |
| 37 IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest, | 39 IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest, |
| 38 Disposition_Settings_UseIncognitoWindow) { | 40 Disposition_Settings_UseIncognitoWindow) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 53 // Settings page should be opened in incognito window. | 55 // Settings page should be opened in incognito window. |
| 54 EXPECT_NE(browser(), p.browser); | 56 EXPECT_NE(browser(), p.browser); |
| 55 EXPECT_EQ(incognito_browser, p.browser); | 57 EXPECT_EQ(incognito_browser, p.browser); |
| 56 EXPECT_EQ(2, incognito_browser->tab_strip_model()->count()); | 58 EXPECT_EQ(2, incognito_browser->tab_strip_model()->count()); |
| 57 EXPECT_EQ(GURL("chrome://chrome/settings"), | 59 EXPECT_EQ(GURL("chrome://chrome/settings"), |
| 58 incognito_browser->tab_strip_model()->GetActiveWebContents()-> | 60 incognito_browser->tab_strip_model()->GetActiveWebContents()-> |
| 59 GetURL()); | 61 GetURL()); |
| 60 } | 62 } |
| 61 | 63 |
| 62 } // namespace | 64 } // namespace |
| OLD | NEW |