Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: chrome/browser/ui/browser_navigator_browsertest.cc

Issue 10908153: [Panel refactor] Deprecate old panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux_chromeos test failure Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 1238
1239 // Now navigate using the incognito profile and check that a new window 1239 // Now navigate using the incognito profile and check that a new window
1240 // is created. 1240 // is created.
1241 chrome::NavigateParams params_incognito( 1241 chrome::NavigateParams params_incognito(
1242 browser()->profile()->GetOffTheRecordProfile(), 1242 browser()->profile()->GetOffTheRecordProfile(),
1243 GetGoogleURL(), content::PAGE_TRANSITION_LINK); 1243 GetGoogleURL(), content::PAGE_TRANSITION_LINK);
1244 ui_test_utils::NavigateToURL(&params_incognito); 1244 ui_test_utils::NavigateToURL(&params_incognito);
1245 EXPECT_EQ(2u, BrowserList::size()); 1245 EXPECT_EQ(2u, BrowserList::size());
1246 } 1246 }
1247 1247
1248 // This test makes sure any link in a crashed panel page navigates to a tabbed
1249 // window.
1250 class PanelBrowserNavigatorTest : public BrowserNavigatorTest {
1251 protected:
1252 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
1253 command_line->AppendSwitch(switches::kEnablePanels);
1254 }
1255 };
1256
1257 IN_PROC_BROWSER_TEST_F(PanelBrowserNavigatorTest, NavigateFromCrashedPanel) {
1258 GURL url("http://maps.google.com/#a");
1259 GURL url2("http://maps.google.com/#b");
1260
1261 // Create a panel.
1262 Browser* panel_browser = new Browser(
1263 Browser::CreateParams::CreateForApp(
1264 Browser::TYPE_PANEL, "Test", gfx::Rect(100, 100),
1265 browser()->profile()));
1266
1267 // Navigate to the page.
1268 chrome::NavigateParams p(MakeNavigateParams(panel_browser));
1269 p.url = url;
1270 p.disposition = CURRENT_TAB;
1271 chrome::Navigate(&p);
1272
1273 // Navigate() should have navigated in the existing panel window.
1274 EXPECT_EQ(panel_browser, p.browser);
1275
1276 // We should now have two windows, the browser() provided by the framework and
1277 // the panel window we opened earlier. The tabbed browser window has 1 tab.
1278 EXPECT_EQ(2u, BrowserList::size());
1279 EXPECT_EQ(1, browser()->tab_count());
1280 EXPECT_EQ(1, panel_browser->tab_count());
1281
1282 // Kill the panel page.
1283 WebContents* web_contents = chrome::GetActiveWebContents(panel_browser);
1284 web_contents->SetIsCrashed(base::TERMINATION_STATUS_PROCESS_CRASHED, -1);
1285 EXPECT_TRUE(web_contents->IsCrashed());
1286
1287 // Navigate to the page.
1288 chrome::NavigateParams p2(MakeNavigateParams(panel_browser));
1289 p2.source_contents = chrome::GetActiveTabContents(panel_browser);
1290 p2.url = url2;
1291 p2.disposition = CURRENT_TAB;
1292 chrome::Navigate(&p2);
1293
1294 // Navigate() should have opened a new tab in the existing tabbed window.
1295 EXPECT_EQ(browser(), p2.browser);
1296
1297 // We should now have two windows, the browser() provided by the framework and
1298 // the panel window we opened earlier. The tabbed browser window has 2 tabs.
1299 EXPECT_EQ(2u, BrowserList::size());
1300 EXPECT_EQ(2, browser()->tab_count());
1301 EXPECT_EQ(1, panel_browser->tab_count());
1302 }
1303
1304 } // namespace 1248 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_navigator.cc ('k') | chrome/browser/ui/panels/base_panel_browser_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698