| 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/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 10 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 10 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 browser::NavigateParams BrowserNavigatorTest::MakeNavigateParams( | 56 browser::NavigateParams BrowserNavigatorTest::MakeNavigateParams( |
| 57 Browser* browser) const { | 57 Browser* browser) const { |
| 58 browser::NavigateParams params(browser, GetGoogleURL(), | 58 browser::NavigateParams params(browser, GetGoogleURL(), |
| 59 content::PAGE_TRANSITION_LINK); | 59 content::PAGE_TRANSITION_LINK); |
| 60 params.window_action = browser::NavigateParams::SHOW_WINDOW; | 60 params.window_action = browser::NavigateParams::SHOW_WINDOW; |
| 61 return params; | 61 return params; |
| 62 } | 62 } |
| 63 | 63 |
| 64 Browser* BrowserNavigatorTest::CreateEmptyBrowserForType(Browser::Type type, | 64 Browser* BrowserNavigatorTest::CreateEmptyBrowserForType(Browser::Type type, |
| 65 Profile* profile) { | 65 Profile* profile) { |
| 66 Browser* browser = Browser::CreateForType(type, profile); | 66 Browser* browser = Browser::CreateWithParams( |
| 67 Browser::CreateParams(type, profile)); |
| 67 browser->AddBlankTab(true); | 68 browser->AddBlankTab(true); |
| 68 return browser; | 69 return browser; |
| 69 } | 70 } |
| 70 | 71 |
| 71 Browser* BrowserNavigatorTest::CreateEmptyBrowserForApp(Browser::Type type, | 72 Browser* BrowserNavigatorTest::CreateEmptyBrowserForApp(Browser::Type type, |
| 72 Profile* profile) { | 73 Profile* profile) { |
| 73 Browser* browser = Browser::CreateForApp(Browser::TYPE_POPUP, "Test", | 74 Browser* browser = Browser::CreateWithParams( |
| 74 gfx::Rect(), profile); | 75 Browser::CreateParams::CreateForApp( |
| 76 Browser::TYPE_POPUP, "Test", gfx::Rect(), profile)); |
| 75 browser->AddBlankTab(true); | 77 browser->AddBlankTab(true); |
| 76 return browser; | 78 return browser; |
| 77 } | 79 } |
| 78 | 80 |
| 79 TabContentsWrapper* BrowserNavigatorTest::CreateTabContents() { | 81 TabContentsWrapper* BrowserNavigatorTest::CreateTabContents() { |
| 80 return Browser::TabContentsFactory( | 82 return Browser::TabContentsFactory( |
| 81 browser()->profile(), | 83 browser()->profile(), |
| 82 NULL, | 84 NULL, |
| 83 MSG_ROUTING_NONE, | 85 MSG_ROUTING_NONE, |
| 84 browser()->GetSelectedWebContents(), | 86 browser()->GetSelectedWebContents(), |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 1280 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 1279 command_line->AppendSwitch(switches::kEnablePanels); | 1281 command_line->AppendSwitch(switches::kEnablePanels); |
| 1280 } | 1282 } |
| 1281 }; | 1283 }; |
| 1282 | 1284 |
| 1283 IN_PROC_BROWSER_TEST_F(PanelBrowserNavigatorTest, NavigateFromCrashedPanel) { | 1285 IN_PROC_BROWSER_TEST_F(PanelBrowserNavigatorTest, NavigateFromCrashedPanel) { |
| 1284 GURL url("http://maps.google.com/#a"); | 1286 GURL url("http://maps.google.com/#a"); |
| 1285 GURL url2("http://maps.google.com/#b"); | 1287 GURL url2("http://maps.google.com/#b"); |
| 1286 | 1288 |
| 1287 // Create a panel. | 1289 // Create a panel. |
| 1288 Browser* panel_browser = Browser::CreateForApp(Browser::TYPE_PANEL, | 1290 Browser* panel_browser = Browser::CreateWithParams( |
| 1289 "Test", gfx::Rect(100, 100), browser()->profile()); | 1291 Browser::CreateParams::CreateForApp( |
| 1292 Browser::TYPE_PANEL, "Test", gfx::Rect(100, 100), |
| 1293 browser()->profile())); |
| 1290 | 1294 |
| 1291 // Navigate to the page. | 1295 // Navigate to the page. |
| 1292 browser::NavigateParams p(MakeNavigateParams(panel_browser)); | 1296 browser::NavigateParams p(MakeNavigateParams(panel_browser)); |
| 1293 p.url = url; | 1297 p.url = url; |
| 1294 p.disposition = CURRENT_TAB; | 1298 p.disposition = CURRENT_TAB; |
| 1295 browser::Navigate(&p); | 1299 browser::Navigate(&p); |
| 1296 | 1300 |
| 1297 // Navigate() should have navigated in the existing panel window. | 1301 // Navigate() should have navigated in the existing panel window. |
| 1298 EXPECT_EQ(panel_browser, p.browser); | 1302 EXPECT_EQ(panel_browser, p.browser); |
| 1299 | 1303 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1319 EXPECT_EQ(browser(), p2.browser); | 1323 EXPECT_EQ(browser(), p2.browser); |
| 1320 | 1324 |
| 1321 // We should now have two windows, the browser() provided by the framework and | 1325 // We should now have two windows, the browser() provided by the framework and |
| 1322 // the panel window we opened earlier. The tabbed browser window has 2 tabs. | 1326 // the panel window we opened earlier. The tabbed browser window has 2 tabs. |
| 1323 EXPECT_EQ(2u, BrowserList::size()); | 1327 EXPECT_EQ(2u, BrowserList::size()); |
| 1324 EXPECT_EQ(2, browser()->tab_count()); | 1328 EXPECT_EQ(2, browser()->tab_count()); |
| 1325 EXPECT_EQ(1, panel_browser->tab_count()); | 1329 EXPECT_EQ(1, panel_browser->tab_count()); |
| 1326 } | 1330 } |
| 1327 | 1331 |
| 1328 } // namespace | 1332 } // namespace |
| OLD | NEW |