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

Side by Side Diff: chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc

Issue 1257603003: Revert of Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, ClosableAfterNavigation) { 484 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, ClosableAfterNavigation) {
485 // Open a popup. 485 // Open a popup.
486 WebContents* popup = 486 WebContents* popup =
487 RunCheckTest(browser(), 487 RunCheckTest(browser(),
488 "/popup_blocker/popup-opener.html", 488 "/popup_blocker/popup-opener.html",
489 ExpectTab, 489 ExpectTab,
490 CheckTitle); 490 CheckTitle);
491 491
492 // Navigate it elsewhere. 492 // Navigate it elsewhere.
493 content::TestNavigationObserver nav_observer(popup); 493 content::TestNavigationObserver nav_observer(popup);
494 popup->GetMainFrame()->ExecuteJavaScriptForTests( 494 popup->GetMainFrame()->ExecuteJavaScript(
495 base::UTF8ToUTF16("location.href = '/empty.html'")); 495 base::UTF8ToUTF16("location.href = '/empty.html'"));
496 nav_observer.Wait(); 496 nav_observer.Wait();
497 497
498 // Have it close itself. 498 // Have it close itself.
499 CloseObserver close_observer(popup); 499 CloseObserver close_observer(popup);
500 popup->GetMainFrame()->ExecuteJavaScriptForTests( 500 popup->GetMainFrame()->ExecuteJavaScript(
501 base::UTF8ToUTF16("window.close()")); 501 base::UTF8ToUTF16("window.close()"));
502 close_observer.Wait(); 502 close_observer.Wait();
503 } 503 }
504 504
505 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, OpenerSuppressed) { 505 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, OpenerSuppressed) {
506 RunCheckTest(browser(), 506 RunCheckTest(browser(),
507 "/popup_blocker/popup-openersuppressed.html", 507 "/popup_blocker/popup-openersuppressed.html",
508 ExpectTab, 508 ExpectTab,
509 CheckTitle); 509 CheckTitle);
510 } 510 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 ContentSettingsPattern::FromURL(url), ContentSettingsPattern::Wildcard(), 567 ContentSettingsPattern::FromURL(url), ContentSettingsPattern::Wildcard(),
568 CONTENT_SETTINGS_TYPE_POPUPS, std::string(), CONTENT_SETTING_ALLOW); 568 CONTENT_SETTINGS_TYPE_POPUPS, std::string(), CONTENT_SETTING_ALLOW);
569 569
570 NavigateAndCheckPopupShown(url, ExpectPopup); 570 NavigateAndCheckPopupShown(url, ExpectPopup);
571 571
572 Browser* popup_browser = 572 Browser* popup_browser =
573 chrome::FindLastActiveWithHostDesktopType(browser()->host_desktop_type()); 573 chrome::FindLastActiveWithHostDesktopType(browser()->host_desktop_type());
574 ASSERT_NE(popup_browser, browser()); 574 ASSERT_NE(popup_browser, browser());
575 575
576 // Showing an alert will raise the tab over the popup. 576 // Showing an alert will raise the tab over the popup.
577 tab->GetMainFrame()->ExecuteJavaScriptForTests(base::UTF8ToUTF16("alert()")); 577 tab->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16("alert()"));
578 app_modal::AppModalDialog* dialog = ui_test_utils::WaitForAppModalDialog(); 578 app_modal::AppModalDialog* dialog = ui_test_utils::WaitForAppModalDialog();
579 579
580 // Verify that after the dialog was closed, the popup is in front again. 580 // Verify that after the dialog was closed, the popup is in front again.
581 ASSERT_TRUE(dialog->IsJavaScriptModalDialog()); 581 ASSERT_TRUE(dialog->IsJavaScriptModalDialog());
582 app_modal::JavaScriptAppModalDialog* js_dialog = 582 app_modal::JavaScriptAppModalDialog* js_dialog =
583 static_cast<app_modal::JavaScriptAppModalDialog*>(dialog); 583 static_cast<app_modal::JavaScriptAppModalDialog*>(dialog);
584 584
585 BrowserActivationObserver activation_observer(browser()->host_desktop_type()); 585 BrowserActivationObserver activation_observer(browser()->host_desktop_type());
586 js_dialog->native_dialog()->AcceptAppModalDialog(); 586 js_dialog->native_dialog()->AcceptAppModalDialog();
587 587
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 wait_for_new_tab.Wait(); 702 wait_for_new_tab.Wait();
703 703
704 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), 704 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(),
705 browser()->host_desktop_type())); 705 browser()->host_desktop_type()));
706 ASSERT_EQ(2, browser()->tab_strip_model()->count()); 706 ASSERT_EQ(2, browser()->tab_strip_model()->count());
707 // Check that we create the background tab. 707 // Check that we create the background tab.
708 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); 708 ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
709 } 709 }
710 710
711 } // namespace 711 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager_browsertest.cc ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698