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/prefs/incognito_mode_prefs.h" | 9 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 content::NOTIFICATION_LOAD_STOP, | 1220 content::NOTIFICATION_LOAD_STOP, |
1221 content::NotificationService::AllSources()); | 1221 content::NotificationService::AllSources()); |
1222 chrome::ShowDownloads(browser()); | 1222 chrome::ShowDownloads(browser()); |
1223 observer.Wait(); | 1223 observer.Wait(); |
1224 } | 1224 } |
1225 EXPECT_EQ(1, browser()->tab_count()); | 1225 EXPECT_EQ(1, browser()->tab_count()); |
1226 EXPECT_EQ(GURL(chrome::kChromeUIDownloadsURL), | 1226 EXPECT_EQ(GURL(chrome::kChromeUIDownloadsURL), |
1227 chrome::GetActiveWebContents(browser())->GetURL()); | 1227 chrome::GetActiveWebContents(browser())->GetURL()); |
1228 } | 1228 } |
1229 | 1229 |
| 1230 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, |
| 1231 NavigateWithoutBrowser) { |
| 1232 // First navigate using the profile of the existing browser window, and |
| 1233 // check that the window is reused. |
| 1234 chrome::NavigateParams params(browser()->profile(), GetGoogleURL(), |
| 1235 content::PAGE_TRANSITION_LINK); |
| 1236 ui_test_utils::NavigateToURL(¶ms); |
| 1237 EXPECT_EQ(1u, BrowserList::size()); |
| 1238 |
| 1239 // Now navigate using the incognito profile and check that a new window |
| 1240 // is created. |
| 1241 chrome::NavigateParams params_incognito( |
| 1242 browser()->profile()->GetOffTheRecordProfile(), |
| 1243 GetGoogleURL(), content::PAGE_TRANSITION_LINK); |
| 1244 ui_test_utils::NavigateToURL(¶ms_incognito); |
| 1245 EXPECT_EQ(2u, BrowserList::size()); |
| 1246 } |
| 1247 |
1230 // This test makes sure any link in a crashed panel page navigates to a tabbed | 1248 // This test makes sure any link in a crashed panel page navigates to a tabbed |
1231 // window. | 1249 // window. |
1232 class PanelBrowserNavigatorTest : public BrowserNavigatorTest { | 1250 class PanelBrowserNavigatorTest : public BrowserNavigatorTest { |
1233 protected: | 1251 protected: |
1234 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 1252 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
1235 command_line->AppendSwitch(switches::kEnablePanels); | 1253 command_line->AppendSwitch(switches::kEnablePanels); |
1236 } | 1254 } |
1237 }; | 1255 }; |
1238 | 1256 |
1239 IN_PROC_BROWSER_TEST_F(PanelBrowserNavigatorTest, NavigateFromCrashedPanel) { | 1257 IN_PROC_BROWSER_TEST_F(PanelBrowserNavigatorTest, NavigateFromCrashedPanel) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 EXPECT_EQ(browser(), p2.browser); | 1295 EXPECT_EQ(browser(), p2.browser); |
1278 | 1296 |
1279 // We should now have two windows, the browser() provided by the framework and | 1297 // We should now have two windows, the browser() provided by the framework and |
1280 // the panel window we opened earlier. The tabbed browser window has 2 tabs. | 1298 // the panel window we opened earlier. The tabbed browser window has 2 tabs. |
1281 EXPECT_EQ(2u, BrowserList::size()); | 1299 EXPECT_EQ(2u, BrowserList::size()); |
1282 EXPECT_EQ(2, browser()->tab_count()); | 1300 EXPECT_EQ(2, browser()->tab_count()); |
1283 EXPECT_EQ(1, panel_browser->tab_count()); | 1301 EXPECT_EQ(1, panel_browser->tab_count()); |
1284 } | 1302 } |
1285 | 1303 |
1286 } // namespace | 1304 } // namespace |
OLD | NEW |