| 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" | |
| 16 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 17 | 16 |
| 18 namespace { | 17 namespace { |
| 19 | 18 |
| 20 GURL GetGoogleURL() { | 19 GURL GetGoogleURL() { |
| 21 return GURL("http://www.google.com/"); | 20 return GURL("http://www.google.com/"); |
| 22 } | 21 } |
| 23 | 22 |
| 24 // Subclass that tests navigation while in the Guest session. | 23 // Subclass that tests navigation while in the Guest session. |
| 25 class BrowserGuestSessionNavigatorTest: public BrowserNavigatorTest { | 24 class BrowserGuestSessionNavigatorTest: public BrowserNavigatorTest { |
| 26 protected: | 25 protected: |
| 27 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 26 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 28 CommandLine command_line_copy = *command_line; | 27 CommandLine command_line_copy = *command_line; |
| 29 command_line_copy.AppendSwitchASCII( | 28 command_line_copy.AppendSwitchASCII(switches::kLoginProfile, "user"); |
| 30 chromeos::switches::kLoginProfile, "user"); | |
| 31 chromeos::GetOffTheRecordCommandLine(GetGoogleURL(), | 29 chromeos::GetOffTheRecordCommandLine(GetGoogleURL(), |
| 32 command_line_copy, | 30 command_line_copy, |
| 33 command_line); | 31 command_line); |
| 34 } | 32 } |
| 35 }; | 33 }; |
| 36 | 34 |
| 37 // This test verifies that the settings page is opened in the incognito window | 35 // This test verifies that the settings page is opened in the incognito window |
| 38 // in Guest Session (as well as all other windows in Guest session). | 36 // in Guest Session (as well as all other windows in Guest session). |
| 39 IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest, | 37 IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest, |
| 40 Disposition_Settings_UseIncognitoWindow) { | 38 Disposition_Settings_UseIncognitoWindow) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 55 // Settings page should be opened in incognito window. | 53 // Settings page should be opened in incognito window. |
| 56 EXPECT_NE(browser(), p.browser); | 54 EXPECT_NE(browser(), p.browser); |
| 57 EXPECT_EQ(incognito_browser, p.browser); | 55 EXPECT_EQ(incognito_browser, p.browser); |
| 58 EXPECT_EQ(2, incognito_browser->tab_strip_model()->count()); | 56 EXPECT_EQ(2, incognito_browser->tab_strip_model()->count()); |
| 59 EXPECT_EQ(GURL("chrome://chrome/settings"), | 57 EXPECT_EQ(GURL("chrome://chrome/settings"), |
| 60 incognito_browser->tab_strip_model()->GetActiveWebContents()-> | 58 incognito_browser->tab_strip_model()->GetActiveWebContents()-> |
| 61 GetURL()); | 59 GetURL()); |
| 62 } | 60 } |
| 63 | 61 |
| 64 } // namespace | 62 } // namespace |
| OLD | NEW |