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

Unified Diff: chrome/browser/ui/browser_browsertest.cc

Issue 2772983003: Prevent tests using data URLs from being broken by data URL deprecation (Closed)
Patch Set: nasko comments Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser_browsertest.cc
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 58fb6ae4620345108dbf70d0b4f3d437e88b33b3..ae598c91b3b8a0d5022b25ffad707a625fb0ce46 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -623,7 +623,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsDialogs) {
// Start a navigation to trigger the beforeunload dialog.
WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
contents->GetMainFrame()->ExecuteJavaScriptForTests(
- ASCIIToUTF16("window.location.href = 'data:text/html,foo'"));
+ ASCIIToUTF16("window.location.href = 'about:blank'"));
AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
EXPECT_TRUE(alert->IsValid());
AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance();
@@ -646,11 +646,15 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsDialogs) {
// Make sure that dialogs opened by subframes are closed when the process dies.
// See http://crbug.com/366510.
IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsSubframeDialogs) {
- // Navigate to an iframe that opens an alert dialog.
WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
+ ui_test_utils::NavigateToURL(
+ browser(), GURL("data:text/html, <html><body></body></html>"));
+
+ // Create an iframe that opens an alert dialog.
contents->GetMainFrame()->ExecuteJavaScriptForTests(
- ASCIIToUTF16("window.location.href = 'data:text/html,"
- "<iframe srcdoc=\"<script>alert(1)</script>\">'"));
+ ASCIIToUTF16("f = document.createElement('iframe');"
+ "f.srcdoc = '<script>alert(1)</script>';"
+ "document.body.appendChild(f);"));
AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
EXPECT_TRUE(alert->IsValid());
AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance();
« no previous file with comments | « chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc ('k') | chrome/test/data/click_modifier/href.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698