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/login_utils.h" | 8 #include "chrome/browser/chromeos/login/login_utils.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_list.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 "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 GURL GetGoogleURL() { | 19 GURL GetGoogleURL() { |
20 return GURL("http://www.google.com/"); | 20 return GURL("http://www.google.com/"); |
(...skipping 10 matching lines...) Expand all Loading... |
31 command_line); | 31 command_line); |
32 } | 32 } |
33 }; | 33 }; |
34 | 34 |
35 // 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 |
36 // 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). |
37 IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest, | 37 IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest, |
38 Disposition_Settings_UseIncognitoWindow) { | 38 Disposition_Settings_UseIncognitoWindow) { |
39 Browser* incognito_browser = CreateIncognitoBrowser(); | 39 Browser* incognito_browser = CreateIncognitoBrowser(); |
40 | 40 |
41 EXPECT_EQ(2u, BrowserList::size()); | 41 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
42 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 42 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
43 EXPECT_EQ(1, incognito_browser->tab_strip_model()->count()); | 43 EXPECT_EQ(1, incognito_browser->tab_strip_model()->count()); |
44 | 44 |
45 // Navigate to the settings page. | 45 // Navigate to the settings page. |
46 chrome::NavigateParams p(MakeNavigateParams(incognito_browser)); | 46 chrome::NavigateParams p(MakeNavigateParams(incognito_browser)); |
47 p.disposition = SINGLETON_TAB; | 47 p.disposition = SINGLETON_TAB; |
48 p.url = GURL("chrome://chrome/settings"); | 48 p.url = GURL("chrome://chrome/settings"); |
49 p.window_action = chrome::NavigateParams::SHOW_WINDOW; | 49 p.window_action = chrome::NavigateParams::SHOW_WINDOW; |
50 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 50 p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
51 chrome::Navigate(&p); | 51 chrome::Navigate(&p); |
52 | 52 |
53 // Settings page should be opened in incognito window. | 53 // Settings page should be opened in incognito window. |
54 EXPECT_NE(browser(), p.browser); | 54 EXPECT_NE(browser(), p.browser); |
55 EXPECT_EQ(incognito_browser, p.browser); | 55 EXPECT_EQ(incognito_browser, p.browser); |
56 EXPECT_EQ(2, incognito_browser->tab_strip_model()->count()); | 56 EXPECT_EQ(2, incognito_browser->tab_strip_model()->count()); |
57 EXPECT_EQ(GURL("chrome://chrome/settings"), | 57 EXPECT_EQ(GURL("chrome://chrome/settings"), |
58 incognito_browser->tab_strip_model()->GetActiveWebContents()-> | 58 incognito_browser->tab_strip_model()->GetActiveWebContents()-> |
59 GetURL()); | 59 GetURL()); |
60 } | 60 } |
61 | 61 |
62 } // namespace | 62 } // namespace |
OLD | NEW |