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

Unified Diff: chrome/browser/chrome_site_per_process_browsertest.cc

Issue 2553783003: Don't consume user gesture in RenderFrameProxy::navigate. (Closed)
Patch Set: Rebase 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') | no next file with comments »
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 e385c9ef3c642142343c7b2e1b041f800d99cfc4..753d37c667b33274644b2a08ebb39d90d459cff1 100644
--- a/chrome/browser/chrome_site_per_process_browsertest.cc
+++ b/chrome/browser/chrome_site_per_process_browsertest.cc
@@ -362,3 +362,39 @@ IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessPDFTest,
observer.Wait();
EXPECT_EQ(0U, test_guest_view_manager()->GetNumGuestsActive());
}
+
+// 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698