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

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 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
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 f55de8a78af2994d787cf9bdd17f2890ffb6b544..d6d1e04d34d113b0c490a088bbd8b5c20e3a3976 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());
}

Powered by Google App Engine
This is Rietveld 408576698