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

Unified Diff: chrome/browser/chrome_site_per_process_browsertest.cc

Issue 2553783003: Don't consume user gesture in RenderFrameProxy::navigate. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | content/renderer/render_frame_proxy.cc » ('j') | content/renderer/render_frame_proxy.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_site_per_process_browsertest.cc
diff --git a/chrome/browser/chrome_site_per_process_browsertest.cc b/chrome/browser/chrome_site_per_process_browsertest.cc
index ccadca9650b8c4e0fd1fd595be0ee43ca0cffeee..06f6a174654f8c00b8b54592882af6167541d615 100644
--- a/chrome/browser/chrome_site_per_process_browsertest.cc
+++ b/chrome/browser/chrome_site_per_process_browsertest.cc
@@ -343,3 +343,39 @@ IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessPDFTest,
// Wait until the guest for PDF is created.
test_guest_view_manager()->WaitForSingleGuestCreated();
}
+
+// Verify that a popup can be opened after navigating a remote frame. This has
+// to be a chrome/ test to ensure that the popup blocker doesn't block the
+// popup. See https://crbug.com/670770.
+IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
+ NavigateRemoteFrameAndOpenPopup) {
+ // Start on a page with an <iframe>.
+ GURL main_url(embedded_test_server()->GetURL("a.com", "/iframe.html"));
+ ui_test_utils::NavigateToURL(browser(), main_url);
+
+ // Navigate the iframe cross-site.
+ content::WebContents* active_web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html"));
+ EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", frame_url));
+
+ // Run a script in the parent frame to (1) navigate iframe to another URL,
+ // and (2) open a popup. Note that ExecuteScript will run this with a user
+ // gesture, so both steps should succeed.
+ frame_url = embedded_test_server()->GetURL("c.com", "/title1.html");
+ content::WindowedNotificationObserver popup_observer(
+ chrome::NOTIFICATION_TAB_ADDED,
+ content::NotificationService::AllSources());
+ bool popup_handle_is_valid = false;
+ EXPECT_TRUE(ExecuteScriptAndExtractBool(
+ active_web_contents,
+ "document.querySelector('iframe').src = '" + frame_url.spec() + "';\n"
+ "var w = window.open('about:blank');\n"
+ "window.domAutomationController.send(!!w);\n",
+ &popup_handle_is_valid));
+ popup_observer.Wait();
+
+ // The popup shouldn't be blocked.
+ EXPECT_TRUE(popup_handle_is_valid);
+ ASSERT_EQ(2, browser()->tab_strip_model()->count());
+}
« no previous file with comments | « no previous file | content/renderer/render_frame_proxy.cc » ('j') | content/renderer/render_frame_proxy.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698