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

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

Issue 57433010: Prevent creating a swapped out RVH in the same SiteInstance as the current one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again Created 7 years, 1 month 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 | « content/browser/frame_host/render_view_host_manager.cc ('k') | content/browser/site_instance_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_view_host_manager_unittest.cc
diff --git a/content/browser/frame_host/render_view_host_manager_unittest.cc b/content/browser/frame_host/render_view_host_manager_unittest.cc
index 1027a5277756c582d1ac23898fc251346387aa68..6e7d7cef3463f80a5d6f0307d9416eb8f34ad310 100644
--- a/content/browser/frame_host/render_view_host_manager_unittest.cc
+++ b/content/browser/frame_host/render_view_host_manager_unittest.cc
@@ -1092,6 +1092,7 @@ TEST_F(RenderViewHostManagerTest, CreateSwappedOutOpenerRVHs) {
// those associated RenderViews crashes. http://crbug.com/258993
TEST_F(RenderViewHostManagerTest, CleanUpSwappedOutRVHOnProcessCrash) {
const GURL kUrl1("http://www.google.com/");
+ const GURL kUrl2("http://www.chromium.org/");
// Navigate to an initial URL.
contents()->NavigateAndCommit(kUrl1);
@@ -1104,9 +1105,13 @@ TEST_F(RenderViewHostManagerTest, CleanUpSwappedOutRVHOnProcessCrash) {
opener1->GetRenderManagerForTesting();
contents()->SetOpener(opener1.get());
+ // Make sure the new opener RVH is considered live.
+ opener1_manager->current_host()->CreateRenderView(string16(), -1, -1);
+
+ // Use a cross-process navigation in the opener to swap out the old RVH.
EXPECT_FALSE(opener1_manager->GetSwappedOutRenderViewHost(
rvh1->GetSiteInstance()));
- opener1->CreateSwappedOutRenderView(rvh1->GetSiteInstance());
+ opener1->NavigateAndCommit(kUrl2);
EXPECT_TRUE(opener1_manager->GetSwappedOutRenderViewHost(
rvh1->GetSiteInstance()));
@@ -1125,10 +1130,11 @@ TEST_F(RenderViewHostManagerTest, CleanUpSwappedOutRVHOnProcessCrash) {
EXPECT_FALSE(opener1_manager->GetSwappedOutRenderViewHost(
rvh1->GetSiteInstance()));
- // Reload the initial tab. This should recreate the opener.
+ // Reload the initial tab. This should recreate the opener's swapped out RVH
+ // in the original SiteInstance.
contents()->GetController().Reload(true);
-
- EXPECT_EQ(opener1_manager->current_host()->GetRoutingID(),
+ EXPECT_EQ(opener1_manager->GetSwappedOutRenderViewHost(
+ rvh1->GetSiteInstance())->GetRoutingID(),
test_rvh()->opener_route_id());
}
« no previous file with comments | « content/browser/frame_host/render_view_host_manager.cc ('k') | content/browser/site_instance_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698