OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/browser/chromeos/login/login_utils.h" | 9 #include "chrome/browser/chromeos/login/login_utils.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_list.h" | 11 #include "chrome/browser/ui/browser_list.h" |
12 #include "chrome/browser/ui/browser_navigator.h" | 12 #include "chrome/browser/ui/browser_navigator.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 GURL GetGoogleURL() { | 18 GURL GetGoogleURL() { |
19 return GURL("http://www.google.com/"); | 19 return GURL("http://www.google.com/"); |
20 } | 20 } |
21 | 21 |
22 // Subclass that tests navigation while in the Guest session. | 22 // Subclass that tests navigation while in the Guest session. |
23 class BrowserGuestSessionNavigatorTest: public BrowserNavigatorTest { | 23 class BrowserGuestSessionNavigatorTest: public BrowserNavigatorTest { |
24 protected: | 24 protected: |
(...skipping 22 matching lines...) Expand all Loading... |
47 p.url = GURL("chrome://settings"); | 47 p.url = GURL("chrome://settings"); |
48 p.window_action = browser::NavigateParams::SHOW_WINDOW; | 48 p.window_action = browser::NavigateParams::SHOW_WINDOW; |
49 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; | 49 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; |
50 browser::Navigate(&p); | 50 browser::Navigate(&p); |
51 | 51 |
52 // Settings page should be opened in incognito window. | 52 // Settings page should be opened in incognito window. |
53 EXPECT_NE(browser(), p.browser); | 53 EXPECT_NE(browser(), p.browser); |
54 EXPECT_EQ(incognito_browser, p.browser); | 54 EXPECT_EQ(incognito_browser, p.browser); |
55 EXPECT_EQ(2, incognito_browser->tab_count()); | 55 EXPECT_EQ(2, incognito_browser->tab_count()); |
56 EXPECT_EQ(GURL("chrome://settings"), | 56 EXPECT_EQ(GURL("chrome://settings"), |
57 incognito_browser->GetSelectedTabContents()->GetURL()); | 57 incognito_browser->GetSelectedWebContents()->GetURL()); |
58 } | 58 } |
59 | 59 |
60 // This test verifies that navigating to a large window with | 60 // This test verifies that navigating to a large window with |
61 // WindowOpenDisposition = NEW_POPUP from a normal Browser results in a new tab. | 61 // WindowOpenDisposition = NEW_POPUP from a normal Browser results in a new tab. |
62 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_LargePopup) { | 62 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_LargePopup) { |
63 browser::NavigateParams p(MakeNavigateParams()); | 63 browser::NavigateParams p(MakeNavigateParams()); |
64 p.disposition = NEW_POPUP; | 64 p.disposition = NEW_POPUP; |
65 p.window_bounds = gfx::Rect(0, 0, 10000, 10000); | 65 p.window_bounds = gfx::Rect(0, 0, 10000, 10000); |
66 ui_test_utils::NavigateToURL(&p); | 66 ui_test_utils::NavigateToURL(&p); |
67 | 67 |
(...skipping 23 matching lines...) Expand all Loading... |
91 | 91 |
92 // NavigateToURL() should have opened a new tab in the primary browser. | 92 // NavigateToURL() should have opened a new tab in the primary browser. |
93 EXPECT_EQ(browser(), p2.browser); | 93 EXPECT_EQ(browser(), p2.browser); |
94 | 94 |
95 // We should have two windows. browser() should have two tabs. | 95 // We should have two windows. browser() should have two tabs. |
96 EXPECT_EQ(2u, BrowserList::size()); | 96 EXPECT_EQ(2u, BrowserList::size()); |
97 EXPECT_EQ(2, browser()->tab_count()); | 97 EXPECT_EQ(2, browser()->tab_count()); |
98 } | 98 } |
99 | 99 |
100 } // namespace | 100 } // namespace |
OLD | NEW |