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

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

Issue 10807047: Create content\public\test\test_utils.h to hold common test classes that are used by unit and brows… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #if defined(OS_MACOSX) 10 #if defined(OS_MACOSX)
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), 335 GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory),
336 FilePath(kBeforeUnloadFile))); 336 FilePath(kBeforeUnloadFile)));
337 ui_test_utils::NavigateToURL(browser(), url); 337 ui_test_utils::NavigateToURL(browser(), url);
338 338
339 // Navigate to a page that triggers a cross-site transition. 339 // Navigate to a page that triggers a cross-site transition.
340 ASSERT_TRUE(test_server()->Start()); 340 ASSERT_TRUE(test_server()->Start());
341 GURL url2(test_server()->GetURL("files/title1.html")); 341 GURL url2(test_server()->GetURL("files/title1.html"));
342 browser()->OpenURL(OpenURLParams( 342 browser()->OpenURL(OpenURLParams(
343 url2, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); 343 url2, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false));
344 344
345 ui_test_utils::WindowedNotificationObserver host_destroyed_observer( 345 content::WindowedNotificationObserver host_destroyed_observer(
346 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 346 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
347 content::NotificationService::AllSources()); 347 content::NotificationService::AllSources());
348 348
349 // Cancel the dialog. 349 // Cancel the dialog.
350 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 350 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
351 alert->CloseModalDialog(); 351 alert->CloseModalDialog();
352 EXPECT_FALSE(chrome::GetActiveWebContents(browser())->IsLoading()); 352 EXPECT_FALSE(chrome::GetActiveWebContents(browser())->IsLoading());
353 353
354 // Verify there are no pending history items after the dialog is cancelled. 354 // Verify there are no pending history items after the dialog is cancelled.
355 // (see crbug.com/93858) 355 // (see crbug.com/93858)
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); 457 content::RenderProcessHost* process = oldtab->GetRenderProcessHost();
458 458
459 // Now open a tab to a blank page, set its opener to null, and redirect it 459 // Now open a tab to a blank page, set its opener to null, and redirect it
460 // cross-site. 460 // cross-site.
461 std::string redirect_popup = "w=window.open();"; 461 std::string redirect_popup = "w=window.open();";
462 redirect_popup += "w.opener=null;"; 462 redirect_popup += "w.opener=null;";
463 redirect_popup += "w.document.location=\""; 463 redirect_popup += "w.document.location=\"";
464 redirect_popup += https_url.spec(); 464 redirect_popup += https_url.spec();
465 redirect_popup += "\";"; 465 redirect_popup += "\";";
466 466
467 ui_test_utils::WindowedNotificationObserver popup_observer( 467 content::WindowedNotificationObserver popup_observer(
468 chrome::NOTIFICATION_TAB_ADDED, 468 chrome::NOTIFICATION_TAB_ADDED,
469 content::NotificationService::AllSources()); 469 content::NotificationService::AllSources());
470 ui_test_utils::WindowedNotificationObserver nav_observer( 470 content::WindowedNotificationObserver nav_observer(
471 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 471 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
472 content::NotificationService::AllSources()); 472 content::NotificationService::AllSources());
473 oldtab->GetRenderViewHost()-> 473 oldtab->GetRenderViewHost()->
474 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(redirect_popup)); 474 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(redirect_popup));
475 475
476 // Wait for popup window to appear and finish navigating. 476 // Wait for popup window to appear and finish navigating.
477 popup_observer.Wait(); 477 popup_observer.Wait();
478 ASSERT_EQ(2, browser()->tab_count()); 478 ASSERT_EQ(2, browser()->tab_count());
479 WebContents* newtab = chrome::GetActiveWebContents(browser()); 479 WebContents* newtab = chrome::GetActiveWebContents(browser());
480 EXPECT_TRUE(newtab); 480 EXPECT_TRUE(newtab);
481 EXPECT_NE(oldtab, newtab); 481 EXPECT_NE(oldtab, newtab);
482 nav_observer.Wait(); 482 nav_observer.Wait();
483 ASSERT_TRUE(newtab->GetController().GetLastCommittedEntry()); 483 ASSERT_TRUE(newtab->GetController().GetLastCommittedEntry());
484 EXPECT_EQ(https_url.spec(), 484 EXPECT_EQ(https_url.spec(),
485 newtab->GetController().GetLastCommittedEntry()->GetURL().spec()); 485 newtab->GetController().GetLastCommittedEntry()->GetURL().spec());
486 486
487 // Popup window should not be in the opener's process. 487 // Popup window should not be in the opener's process.
488 content::RenderProcessHost* popup_process = 488 content::RenderProcessHost* popup_process =
489 newtab->GetRenderProcessHost(); 489 newtab->GetRenderProcessHost();
490 EXPECT_NE(process, popup_process); 490 EXPECT_NE(process, popup_process);
491 491
492 // Now open a tab to a blank page, set its opener to null, and use a 492 // Now open a tab to a blank page, set its opener to null, and use a
493 // meta-refresh to navigate it instead. 493 // meta-refresh to navigate it instead.
494 std::string refresh_popup = "w=window.open();"; 494 std::string refresh_popup = "w=window.open();";
495 refresh_popup += "w.opener=null;"; 495 refresh_popup += "w.opener=null;";
496 refresh_popup += "w.document.write("; 496 refresh_popup += "w.document.write(";
497 refresh_popup += "'<META HTTP-EQUIV=\"refresh\" content=\"0; url="; 497 refresh_popup += "'<META HTTP-EQUIV=\"refresh\" content=\"0; url=";
498 refresh_popup += https_url.spec(); 498 refresh_popup += https_url.spec();
499 refresh_popup += "\">');w.document.close();"; 499 refresh_popup += "\">');w.document.close();";
500 500
501 ui_test_utils::WindowedNotificationObserver popup_observer2( 501 content::WindowedNotificationObserver popup_observer2(
502 chrome::NOTIFICATION_TAB_ADDED, 502 chrome::NOTIFICATION_TAB_ADDED,
503 content::NotificationService::AllSources()); 503 content::NotificationService::AllSources());
504 ui_test_utils::WindowedNotificationObserver nav_observer2( 504 content::WindowedNotificationObserver nav_observer2(
505 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 505 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
506 content::NotificationService::AllSources()); 506 content::NotificationService::AllSources());
507 oldtab->GetRenderViewHost()-> 507 oldtab->GetRenderViewHost()->
508 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(refresh_popup)); 508 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(refresh_popup));
509 509
510 // Wait for popup window to appear and finish navigating. 510 // Wait for popup window to appear and finish navigating.
511 popup_observer2.Wait(); 511 popup_observer2.Wait();
512 ASSERT_EQ(3, browser()->tab_count()); 512 ASSERT_EQ(3, browser()->tab_count());
513 WebContents* newtab2 = chrome::GetActiveWebContents(browser()); 513 WebContents* newtab2 = chrome::GetActiveWebContents(browser());
514 EXPECT_TRUE(newtab2); 514 EXPECT_TRUE(newtab2);
515 EXPECT_NE(oldtab, newtab2); 515 EXPECT_NE(oldtab, newtab2);
516 nav_observer2.Wait(); 516 nav_observer2.Wait();
(...skipping 28 matching lines...) Expand all
545 WebContents* oldtab = chrome::GetActiveWebContents(browser()); 545 WebContents* oldtab = chrome::GetActiveWebContents(browser());
546 content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); 546 content::RenderProcessHost* process = oldtab->GetRenderProcessHost();
547 547
548 // Now open a tab to a blank page, set its opener to null, and redirect it 548 // Now open a tab to a blank page, set its opener to null, and redirect it
549 // cross-site. 549 // cross-site.
550 std::string dont_fork_popup = "w=window.open();"; 550 std::string dont_fork_popup = "w=window.open();";
551 dont_fork_popup += "w.document.location=\""; 551 dont_fork_popup += "w.document.location=\"";
552 dont_fork_popup += https_url.spec(); 552 dont_fork_popup += https_url.spec();
553 dont_fork_popup += "\";"; 553 dont_fork_popup += "\";";
554 554
555 ui_test_utils::WindowedNotificationObserver popup_observer( 555 content::WindowedNotificationObserver popup_observer(
556 chrome::NOTIFICATION_TAB_ADDED, 556 chrome::NOTIFICATION_TAB_ADDED,
557 content::NotificationService::AllSources()); 557 content::NotificationService::AllSources());
558 ui_test_utils::WindowedNotificationObserver nav_observer( 558 content::WindowedNotificationObserver nav_observer(
559 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 559 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
560 content::NotificationService::AllSources()); 560 content::NotificationService::AllSources());
561 oldtab->GetRenderViewHost()-> 561 oldtab->GetRenderViewHost()->
562 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(dont_fork_popup)); 562 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(dont_fork_popup));
563 563
564 // Wait for popup window to appear and finish navigating. 564 // Wait for popup window to appear and finish navigating.
565 popup_observer.Wait(); 565 popup_observer.Wait();
566 ASSERT_EQ(2, browser()->tab_count()); 566 ASSERT_EQ(2, browser()->tab_count());
567 WebContents* newtab = chrome::GetActiveWebContents(browser()); 567 WebContents* newtab = chrome::GetActiveWebContents(browser());
568 EXPECT_TRUE(newtab); 568 EXPECT_TRUE(newtab);
569 EXPECT_NE(oldtab, newtab); 569 EXPECT_NE(oldtab, newtab);
570 nav_observer.Wait(); 570 nav_observer.Wait();
571 ASSERT_TRUE(newtab->GetController().GetLastCommittedEntry()); 571 ASSERT_TRUE(newtab->GetController().GetLastCommittedEntry());
572 EXPECT_EQ(https_url.spec(), 572 EXPECT_EQ(https_url.spec(),
573 newtab->GetController().GetLastCommittedEntry()->GetURL().spec()); 573 newtab->GetController().GetLastCommittedEntry()->GetURL().spec());
574 574
575 // Popup window should still be in the opener's process. 575 // Popup window should still be in the opener's process.
576 content::RenderProcessHost* popup_process = 576 content::RenderProcessHost* popup_process =
577 newtab->GetRenderProcessHost(); 577 newtab->GetRenderProcessHost();
578 EXPECT_EQ(process, popup_process); 578 EXPECT_EQ(process, popup_process);
579 579
580 // Same thing if the current tab tries to navigate itself. 580 // Same thing if the current tab tries to navigate itself.
581 std::string navigate_str = "document.location=\""; 581 std::string navigate_str = "document.location=\"";
582 navigate_str += https_url.spec(); 582 navigate_str += https_url.spec();
583 navigate_str += "\";"; 583 navigate_str += "\";";
584 584
585 ui_test_utils::WindowedNotificationObserver nav_observer2( 585 content::WindowedNotificationObserver nav_observer2(
586 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 586 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
587 content::NotificationService::AllSources()); 587 content::NotificationService::AllSources());
588 oldtab->GetRenderViewHost()-> 588 oldtab->GetRenderViewHost()->
589 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(navigate_str)); 589 ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(navigate_str));
590 nav_observer2.Wait(); 590 nav_observer2.Wait();
591 ASSERT_TRUE(oldtab->GetController().GetLastCommittedEntry()); 591 ASSERT_TRUE(oldtab->GetController().GetLastCommittedEntry());
592 EXPECT_EQ(https_url.spec(), 592 EXPECT_EQ(https_url.spec(),
593 oldtab->GetController().GetLastCommittedEntry()->GetURL().spec()); 593 oldtab->GetController().GetLastCommittedEntry()->GetURL().spec());
594 594
595 // Original window should still be in the original process. 595 // Original window should still be in the original process.
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 // Makes sure the forward button is disabled immediately when navigating 1071 // Makes sure the forward button is disabled immediately when navigating
1072 // forward to a slow-to-commit page. 1072 // forward to a slow-to-commit page.
1073 IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { 1073 IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) {
1074 GURL blank_url(chrome::kAboutBlankURL); 1074 GURL blank_url(chrome::kAboutBlankURL);
1075 ui_test_utils::NavigateToURL(browser(), blank_url); 1075 ui_test_utils::NavigateToURL(browser(), blank_url);
1076 1076
1077 ui_test_utils::NavigateToURL(browser(), 1077 ui_test_utils::NavigateToURL(browser(),
1078 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), 1078 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory),
1079 FilePath(kTitle1File))); 1079 FilePath(kTitle1File)));
1080 1080
1081 ui_test_utils::WindowedNotificationObserver back_nav_load_observer( 1081 content::WindowedNotificationObserver back_nav_load_observer(
1082 content::NOTIFICATION_LOAD_STOP, 1082 content::NOTIFICATION_LOAD_STOP,
1083 content::Source<NavigationController>( 1083 content::Source<NavigationController>(
1084 &chrome::GetActiveWebContents(browser())->GetController())); 1084 &chrome::GetActiveWebContents(browser())->GetController()));
1085 chrome::GoBack(browser(), CURRENT_TAB); 1085 chrome::GoBack(browser(), CURRENT_TAB);
1086 back_nav_load_observer.Wait(); 1086 back_nav_load_observer.Wait();
1087 CommandUpdater* command_updater = 1087 CommandUpdater* command_updater =
1088 browser()->command_controller()->command_updater(); 1088 browser()->command_controller()->command_updater();
1089 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_FORWARD)); 1089 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_FORWARD));
1090 1090
1091 ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( 1091 content::WindowedNotificationObserver forward_nav_load_observer(
1092 content::NOTIFICATION_LOAD_STOP, 1092 content::NOTIFICATION_LOAD_STOP,
1093 content::Source<NavigationController>( 1093 content::Source<NavigationController>(
1094 &chrome::GetActiveWebContents(browser())->GetController())); 1094 &chrome::GetActiveWebContents(browser())->GetController()));
1095 chrome::GoForward(browser(), CURRENT_TAB); 1095 chrome::GoForward(browser(), CURRENT_TAB);
1096 // This check will happen before the navigation completes, since the browser 1096 // This check will happen before the navigation completes, since the browser
1097 // won't process the renderer's response until the Wait() call below. 1097 // won't process the renderer's response until the Wait() call below.
1098 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_FORWARD)); 1098 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_FORWARD));
1099 forward_nav_load_observer.Wait(); 1099 forward_nav_load_observer.Wait();
1100 } 1100 }
1101 1101
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 IncognitoModePrefs::ENABLED); 1222 IncognitoModePrefs::ENABLED);
1223 // OPTIONS and IMPORT_SETTINGS are still disabled since it is a non-normal UI. 1223 // OPTIONS and IMPORT_SETTINGS are still disabled since it is a non-normal UI.
1224 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_OPTIONS)); 1224 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_OPTIONS));
1225 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); 1225 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS));
1226 } 1226 }
1227 1227
1228 IN_PROC_BROWSER_TEST_F(BrowserTest, PageZoom) { 1228 IN_PROC_BROWSER_TEST_F(BrowserTest, PageZoom) {
1229 WebContents* contents = chrome::GetActiveWebContents(browser()); 1229 WebContents* contents = chrome::GetActiveWebContents(browser());
1230 bool enable_plus, enable_minus; 1230 bool enable_plus, enable_minus;
1231 1231
1232 ui_test_utils::WindowedNotificationObserver zoom_in_observer( 1232 content::WindowedNotificationObserver zoom_in_observer(
1233 content::NOTIFICATION_ZOOM_LEVEL_CHANGED, 1233 content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
1234 content::NotificationService::AllSources()); 1234 content::NotificationService::AllSources());
1235 chrome::Zoom(browser(), content::PAGE_ZOOM_IN); 1235 chrome::Zoom(browser(), content::PAGE_ZOOM_IN);
1236 zoom_in_observer.Wait(); 1236 zoom_in_observer.Wait();
1237 EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 110); 1237 EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 110);
1238 EXPECT_TRUE(enable_plus); 1238 EXPECT_TRUE(enable_plus);
1239 EXPECT_TRUE(enable_minus); 1239 EXPECT_TRUE(enable_minus);
1240 1240
1241 ui_test_utils::WindowedNotificationObserver zoom_reset_observer( 1241 content::WindowedNotificationObserver zoom_reset_observer(
1242 content::NOTIFICATION_ZOOM_LEVEL_CHANGED, 1242 content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
1243 content::NotificationService::AllSources()); 1243 content::NotificationService::AllSources());
1244 chrome::Zoom(browser(), content::PAGE_ZOOM_RESET); 1244 chrome::Zoom(browser(), content::PAGE_ZOOM_RESET);
1245 zoom_reset_observer.Wait(); 1245 zoom_reset_observer.Wait();
1246 EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 100); 1246 EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 100);
1247 EXPECT_TRUE(enable_plus); 1247 EXPECT_TRUE(enable_plus);
1248 EXPECT_TRUE(enable_minus); 1248 EXPECT_TRUE(enable_minus);
1249 1249
1250 ui_test_utils::WindowedNotificationObserver zoom_out_observer( 1250 content::WindowedNotificationObserver zoom_out_observer(
1251 content::NOTIFICATION_ZOOM_LEVEL_CHANGED, 1251 content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
1252 content::NotificationService::AllSources()); 1252 content::NotificationService::AllSources());
1253 chrome::Zoom(browser(), content::PAGE_ZOOM_OUT); 1253 chrome::Zoom(browser(), content::PAGE_ZOOM_OUT);
1254 zoom_out_observer.Wait(); 1254 zoom_out_observer.Wait();
1255 EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 90); 1255 EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 90);
1256 EXPECT_TRUE(enable_plus); 1256 EXPECT_TRUE(enable_plus);
1257 EXPECT_TRUE(enable_minus); 1257 EXPECT_TRUE(enable_minus);
1258 1258
1259 chrome::Zoom(browser(), content::PAGE_ZOOM_RESET); 1259 chrome::Zoom(browser(), content::PAGE_ZOOM_RESET);
1260 } 1260 }
1261 1261
1262 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) { 1262 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) {
1263 ASSERT_TRUE(test_server()->Start()); 1263 ASSERT_TRUE(test_server()->Start());
1264 host_resolver()->AddRule("www.example.com", "127.0.0.1"); 1264 host_resolver()->AddRule("www.example.com", "127.0.0.1");
1265 GURL url(test_server()->GetURL("empty.html")); 1265 GURL url(test_server()->GetURL("empty.html"));
1266 ui_test_utils::NavigateToURL(browser(), url); 1266 ui_test_utils::NavigateToURL(browser(), url);
1267 1267
1268 CommandUpdater* command_updater = 1268 CommandUpdater* command_updater =
1269 browser()->command_controller()->command_updater(); 1269 browser()->command_controller()->command_updater();
1270 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); 1270 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE));
1271 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_PRINT)); 1271 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_PRINT));
1272 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); 1272 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE));
1273 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU)); 1273 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU));
1274 1274
1275 WebContents* contents = chrome::GetActiveWebContents(browser()); 1275 WebContents* contents = chrome::GetActiveWebContents(browser());
1276 TestInterstitialPage* interstitial = new TestInterstitialPage( 1276 TestInterstitialPage* interstitial = new TestInterstitialPage(
1277 contents, false, GURL()); 1277 contents, false, GURL());
1278 1278
1279 ui_test_utils::WindowedNotificationObserver interstitial_observer( 1279 content::WindowedNotificationObserver interstitial_observer(
1280 content::NOTIFICATION_INTERSTITIAL_ATTACHED, 1280 content::NOTIFICATION_INTERSTITIAL_ATTACHED,
1281 content::Source<WebContents>(contents)); 1281 content::Source<WebContents>(contents));
1282 interstitial_observer.Wait(); 1282 interstitial_observer.Wait();
1283 1283
1284 EXPECT_TRUE(contents->ShowingInterstitialPage()); 1284 EXPECT_TRUE(contents->ShowingInterstitialPage());
1285 1285
1286 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); 1286 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE));
1287 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_PRINT)); 1287 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_PRINT));
1288 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); 1288 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE));
1289 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU)); 1289 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU));
1290 1290
1291 ui_test_utils::WindowedNotificationObserver interstitial_detach_observer( 1291 content::WindowedNotificationObserver interstitial_detach_observer(
1292 content::NOTIFICATION_INTERSTITIAL_DETACHED, 1292 content::NOTIFICATION_INTERSTITIAL_DETACHED,
1293 content::Source<WebContents>(contents)); 1293 content::Source<WebContents>(contents));
1294 interstitial->Proceed(); 1294 interstitial->Proceed();
1295 interstitial_detach_observer.Wait(); 1295 interstitial_detach_observer.Wait();
1296 // interstitial is deleted now. 1296 // interstitial is deleted now.
1297 1297
1298 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); 1298 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE));
1299 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_PRINT)); 1299 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_PRINT));
1300 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); 1300 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE));
1301 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU)); 1301 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU));
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 virtual void SetUpCommandLine(CommandLine* command_line) { 1528 virtual void SetUpCommandLine(CommandLine* command_line) {
1529 command_line->AppendSwitch(switches::kKeepAliveForTest); 1529 command_line->AppendSwitch(switches::kKeepAliveForTest);
1530 } 1530 }
1531 }; 1531 };
1532 1532
1533 IN_PROC_BROWSER_TEST_F(RunInBackgroundTest, RunInBackgroundBasicTest) { 1533 IN_PROC_BROWSER_TEST_F(RunInBackgroundTest, RunInBackgroundBasicTest) {
1534 // Close the browser window, then open a new one - the browser should keep 1534 // Close the browser window, then open a new one - the browser should keep
1535 // running. 1535 // running.
1536 Profile* profile = browser()->profile(); 1536 Profile* profile = browser()->profile();
1537 EXPECT_EQ(1u, BrowserList::size()); 1537 EXPECT_EQ(1u, BrowserList::size());
1538 ui_test_utils::WindowedNotificationObserver observer( 1538 content::WindowedNotificationObserver observer(
1539 chrome::NOTIFICATION_BROWSER_CLOSED, 1539 chrome::NOTIFICATION_BROWSER_CLOSED,
1540 content::Source<Browser>(browser())); 1540 content::Source<Browser>(browser()));
1541 chrome::CloseWindow(browser()); 1541 chrome::CloseWindow(browser());
1542 observer.Wait(); 1542 observer.Wait();
1543 EXPECT_EQ(0u, BrowserList::size()); 1543 EXPECT_EQ(0u, BrowserList::size());
1544 1544
1545 ui_test_utils::BrowserAddedObserver browser_added_observer; 1545 ui_test_utils::BrowserAddedObserver browser_added_observer;
1546 chrome::NewEmptyWindow(profile); 1546 chrome::NewEmptyWindow(profile);
1547 browser_added_observer.WaitForSingleNewBrowser(); 1547 browser_added_observer.WaitForSingleNewBrowser();
1548 1548
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 command_line->AppendSwitchASCII(switches::kApp, url.spec()); 1585 command_line->AppendSwitchASCII(switches::kApp, url.spec());
1586 } 1586 }
1587 }; 1587 };
1588 1588
1589 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { 1589 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) {
1590 // Test that an application browser window loads correctly. 1590 // Test that an application browser window loads correctly.
1591 1591
1592 // Verify the browser is in application mode. 1592 // Verify the browser is in application mode.
1593 EXPECT_TRUE(browser()->IsApplication()); 1593 EXPECT_TRUE(browser()->IsApplication());
1594 } 1594 }
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager_browsertest_util.cc ('k') | chrome/browser/ui/browser_navigator_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698