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

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

Issue 1408743005: Properly recreate swapped out RenderView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clear main RFH on cancelling the pending RFH. Created 5 years, 2 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 103709908d6f9ea610d1d11e9d9a862eb8b8c9c0..73927edf90f3bf096e0426e624ecffc7f8b33210 100644
--- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc
+++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
@@ -2163,4 +2163,47 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
EXPECT_TRUE(watcher.did_exit_normally());
}
+// Tests navigating cross-process and reusing an existing RenderViewHost,
Charlie Reis 2015/10/16 17:02:23 nit: Tests that
nasko 2015/10/16 22:17:38 Done.
+// which process has been killed/crashed, doesn't result in creating
Charlie Reis 2015/10/16 17:02:23 nit: Put the killed/crash phrase in parentheses, n
nasko 2015/10/16 22:17:38 Done.
+// a RenderView with no valid RenderFrame or RenderFrameProxy.
Charlie Reis 2015/10/16 17:02:24 nit: Mention https://crbug.com/543222 here.
nasko 2015/10/16 22:17:38 I ended up filing a master bug (https://crbug.com/
+IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
+ RenderViewInitAfterProcessKill) {
+ StartEmbeddedServer();
+ NavigateToURL(shell(),
+ embedded_test_server()->GetURL("a.com", "/title1.html"));
+
+ // Open a popup to navigate.
+ Shell* new_shell =
+ OpenPopup(shell()->web_contents(), GURL(url::kAboutBlankURL), "foo");
+ EXPECT_EQ(shell()->web_contents()->GetSiteInstance(),
+ new_shell->web_contents()->GetSiteInstance());
+ WebContentsImpl* new_web_contents =
+ static_cast<WebContentsImpl*>(new_shell->web_contents());
+ FrameTreeNode* popup_root = new_web_contents->GetFrameTree()->root();
+ RenderViewHostImpl* rvh = new_web_contents->GetRenderViewHost();
+
+ // Navigate the popup to a different site.
+ NavigateToURL(new_shell,
+ embedded_test_server()->GetURL("b.com", "/title2.html"));
+ EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
+ new_shell->web_contents()->GetSiteInstance());
+ EXPECT_EQ(rvh, popup_root->render_manager()->GetSwappedOutRenderViewHost(
+ shell()->web_contents()->GetSiteInstance()));
Charlie Reis 2015/10/16 17:02:24 I'm not sure I understand the bug, but it seems li
nasko 2015/10/16 22:17:38 Yes, you are correct. This RVH was a copy/paste fr
+
+ // Kill the process for the main tab.
+ RenderProcessHost* process = popup_root->current_frame_host()->GetProcess();
Charlie Reis 2015/10/16 17:02:23 Wait, are the comments wrong? This is killing the
nasko 2015/10/16 22:17:38 Yes, fixed.
+ RenderProcessHostWatcher crash_observer(
+ process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
+ process->Shutdown(0, false);
+ crash_observer.Wait();
+ EXPECT_FALSE(popup_root->current_frame_host()->IsRenderFrameLive());
+ EXPECT_FALSE(
+ popup_root->current_frame_host()->render_view_host()->IsRenderViewLive());
+
+ // Navigate the main tab to the site of the popup. This will cause the
+ // RenderView for b.com in the main tab to be created.
Charlie Reis 2015/10/16 17:02:23 Can you add some explanation of what this is verif
nasko 2015/10/16 22:17:38 The process crashes, so we don't complete the navi
+ NavigateToURL(shell(),
+ embedded_test_server()->GetURL("b.com", "/title3.html"));
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698