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

Unified Diff: content/browser/frame_host/render_frame_host_manager_browsertest.cc

Issue 1159143008: Fix wrong initialization of renderer_initiated_creation parameter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adding check Created 5 years, 6 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: content/browser/frame_host/render_frame_host_manager_browsertest.cc
diff --git a/content/browser/frame_host/render_frame_host_manager_browsertest.cc b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
index aec9dac07487b881587c7c7623cf0a40b5503dfd..571bae37271970b2f11e20093d2270e91300ae47 100644
--- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc
+++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
@@ -1806,4 +1806,70 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
EXPECT_FALSE(RenderViewHost::FromID(initial_process_id, initial_rvh_id));
}
+// This class ensures that all RenderFrameCreated callbacks have processes with
+// IPC channels.
+class RenderFrameCreatedHasConnectionObserver : public WebContentsObserver {
+ public:
+ explicit RenderFrameCreatedHasConnectionObserver(WebContents* web_contents)
+ : WebContentsObserver(web_contents) {}
+ ~RenderFrameCreatedHasConnectionObserver() override {}
+
+ private:
+ // WebContentsObserver implementation:
+ void RenderFrameCreated(RenderFrameHost* render_frame_host) override {
+ EXPECT_TRUE(render_frame_host->GetProcess()->HasConnection());
+ EXPECT_TRUE(static_cast<RenderFrameHostImpl*>(render_frame_host)
+ ->IsRenderFrameLive());
ncarter (slow) 2015/06/04 18:20:46 Rather than opening up WebContentsObserver so that
+ }
+};
+
+// This class installs the RenderFrameCreatedHasConnectionObserver when the
+// new WebContents is created.
+class InstallRFCObserver : public WebContentsAddedObserver {
+ public:
+ InstallRFCObserver() : rfco_(nullptr) {}
+ ~InstallRFCObserver() override { delete rfco_; }
+
+ private:
+ void WebContentsCreated(WebContents* web_contents) override {
+ rfco_ = new RenderFrameCreatedHasConnectionObserver(web_contents);
+
+ WebContentsAddedObserver::WebContentsCreated(web_contents);
+ }
+
+ RenderFrameCreatedHasConnectionObserver* rfco_;
+};
+
+// Following a cross-site link with rel=noreferrer and target=_blank should
+// fire RenderFrameCreated only after the process is created.
+IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
+ RenderFrameCreatedWithRelNoreferrerAndTargetBlank) {
+ StartServer();
+
+ // Load a page with links that open in a new window.
+ std::string replacement_path;
+ ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
+ "files/click-noreferrer-links.html",
+ foo_host_port_,
+ &replacement_path));
+ NavigateToURL(shell(), test_server()->GetURL(replacement_path));
+
+ // Test clicking a rel=noreferrer + target=blank link.
+ InstallRFCObserver web_contents_observer;
+ bool success = false;
+ EXPECT_TRUE(ExecuteScriptAndExtractBool(
+ shell()->web_contents(),
+ "window.domAutomationController.send(clickNoRefTargetBlankLink());",
+ &success));
+ EXPECT_TRUE(success);
+
+ // Wait for the WebContents to be created.
+ WebContentsImpl* new_web_contents =
+ static_cast<WebContentsImpl*>(web_contents_observer.GetWebContents());
+
+ // Wait for the cross-site transition in the new tab to finish.
+ WaitForLoadStop(new_web_contents);
+ EXPECT_EQ("/files/title2.html", new_web_contents->GetVisibleURL().path());
+}
+
} // namespace content
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698