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

Unified Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 1202593002: Move browser-to-renderer opener plumbing to frame routing IDs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@opener-create-opener-render-views
Patch Set: Remove suppress_opener Created 5 years, 5 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl_unittest.cc
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc
index d056e6ddfd6902bfd982d40b288436386f038e91..ff1ca46f87f303f34e214d8f79b57f812faa43e2 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -912,16 +912,27 @@ TEST_F(WebContentsImplTest, FindOpenerRVHWhenPending) {
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
orig_rfh->PrepareForCommit();
TestRenderFrameHost* pending_rfh = contents()->GetPendingMainFrame();
+ SiteInstance* instance = pending_rfh->GetSiteInstance();
// While it is still pending, simulate opening a new tab with the first tab
// as its opener. This will call CreateOpenerProxies on the opener to ensure
// that an RVH exists.
- int opener_routing_id = contents()->GetRenderManager()->CreateOpenerProxies(
- pending_rfh->GetSiteInstance());
-
- // We should find the pending RVH and not create a new one.
- EXPECT_EQ(pending_rfh->GetRenderViewHost()->GetRoutingID(),
- opener_routing_id);
+ scoped_ptr<TestWebContents> popup(
+ TestWebContents::Create(browser_context(), instance));
+ popup->SetOpener(contents());
+ contents()->GetRenderManager()->CreateOpenerProxies(instance);
+
+ // If swapped out is allowed, we should find the pending RFH and not create a
+ // new one. Otherwise, a new proxy should be created for the opener in
+ // |instance|, and we should ensure that its routing ID is returned here.
+ //
+ // TODO(alexmos): Add the latter check once CreateOpenerProxies is fixed to
+ // create a proxy in this case.
+ if (!RenderFrameHostManager::IsSwappedOutStateForbidden()) {
+ int opener_frame_routing_id =
+ popup->GetRenderManager()->GetOpenerRoutingID(instance);
+ EXPECT_EQ(pending_rfh->GetRoutingID(), opener_frame_routing_id);
+ }
}
// Tests that WebContentsImpl uses the current URL, not the SiteInstance's site,
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698