| 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/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/tabs/tab_strip_model.h" | 9 #include "chrome/browser/tabs/tab_strip_model.h" |
| 10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 EXPECT_FALSE(p.browser->is_app()); | 268 EXPECT_FALSE(p.browser->is_app()); |
| 269 | 269 |
| 270 // We should have two windows, the browser() provided by the framework and the | 270 // We should have two windows, the browser() provided by the framework and the |
| 271 // new popup window. | 271 // new popup window. |
| 272 EXPECT_EQ(2u, BrowserList::size()); | 272 EXPECT_EQ(2u, BrowserList::size()); |
| 273 EXPECT_EQ(1, browser()->tab_count()); | 273 EXPECT_EQ(1, browser()->tab_count()); |
| 274 EXPECT_EQ(1, p.browser->tab_count()); | 274 EXPECT_EQ(1, p.browser->tab_count()); |
| 275 } | 275 } |
| 276 | 276 |
| 277 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP | 277 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP |
| 278 // from a normal Browser results in a new Browser with is_app() true. |
| 279 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup_ExtensionId) { |
| 280 browser::NavigateParams p(MakeNavigateParams()); |
| 281 p.disposition = NEW_POPUP; |
| 282 p.extension_app_id = "extensionappid"; |
| 283 p.window_bounds = gfx::Rect(0, 0, 200, 200); |
| 284 browser::Navigate(&p); |
| 285 // Wait for new popup to to load and gain focus. |
| 286 ui_test_utils::WaitForNavigationInCurrentTab(p.browser); |
| 287 |
| 288 // Navigate() should have opened a new, focused popup window. |
| 289 EXPECT_NE(browser(), p.browser); |
| 290 EXPECT_TRUE(p.browser->is_type_popup()); |
| 291 EXPECT_TRUE(p.browser->is_app()); |
| 292 |
| 293 // We should have two windows, the browser() provided by the framework and the |
| 294 // new popup window. |
| 295 EXPECT_EQ(2u, BrowserList::size()); |
| 296 EXPECT_EQ(1, browser()->tab_count()); |
| 297 EXPECT_EQ(1, p.browser->tab_count()); |
| 298 } |
| 299 |
| 300 // This test verifies that navigating with WindowOpenDisposition = NEW_POPUP |
| 278 // from a normal popup results in a new Browser with TYPE_POPUP. | 301 // from a normal popup results in a new Browser with TYPE_POPUP. |
| 279 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupFromPopup) { | 302 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupFromPopup) { |
| 280 // Open a popup. | 303 // Open a popup. |
| 281 browser::NavigateParams p1(MakeNavigateParams()); | 304 browser::NavigateParams p1(MakeNavigateParams()); |
| 282 p1.disposition = NEW_POPUP; | 305 p1.disposition = NEW_POPUP; |
| 283 p1.window_bounds = gfx::Rect(0, 0, 200, 200); | 306 p1.window_bounds = gfx::Rect(0, 0, 200, 200); |
| 284 browser::Navigate(&p1); | 307 browser::Navigate(&p1); |
| 285 // Open another popup. | 308 // Open another popup. |
| 286 browser::NavigateParams p2(MakeNavigateParams(p1.browser)); | 309 browser::NavigateParams p2(MakeNavigateParams(p1.browser)); |
| 287 p2.disposition = NEW_POPUP; | 310 p2.disposition = NEW_POPUP; |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 p.window_action = browser::NavigateParams::SHOW_WINDOW; | 880 p.window_action = browser::NavigateParams::SHOW_WINDOW; |
| 858 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; | 881 p.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; |
| 859 browser::Navigate(&p); | 882 browser::Navigate(&p); |
| 860 ui_test_utils::WaitForNavigationInCurrentTab(browser()); | 883 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
| 861 | 884 |
| 862 // The tab should not be sad anymore. | 885 // The tab should not be sad anymore. |
| 863 EXPECT_FALSE(tab_contents->is_crashed()); | 886 EXPECT_FALSE(tab_contents->is_crashed()); |
| 864 } | 887 } |
| 865 | 888 |
| 866 } // namespace | 889 } // namespace |
| OLD | NEW |