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

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

Issue 457003002: [site isolation] cross-site transfers should track the RenderFrameHost, not the View (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self-review fixes Created 6 years, 4 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/renderer_host/render_view_host_impl.cc ('k') | content/public/test/test_renderer_host.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 fdee01a2bd85176d12cb1f7a8af91ee9f0fcb23f..a3e2055b44c22ae2b6799c7fc9c48ddf267bcaaf 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -500,13 +500,12 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) {
static_cast<TestRenderViewHost*>(contents()->GetPendingRenderViewHost());
int pending_rvh_delete_count = 0;
pending_rvh->set_delete_counter(&pending_rvh_delete_count);
- RenderFrameHostImpl* pending_rfh = contents()->GetFrameTree()->root()->
- render_manager()->pending_frame_host();
+ RenderFrameHostImpl* pending_rfh = pending_main_test_rfh();
- // Navigations should be suspended in pending_rvh until BeforeUnloadACK.
- EXPECT_TRUE(pending_rvh->are_navigations_suspended());
+ // Navigations should be suspended in pending_rfh until BeforeUnloadACK.
+ EXPECT_TRUE(pending_rfh->are_navigations_suspended());
orig_rvh->SendBeforeUnloadACK(true);
- EXPECT_FALSE(pending_rvh->are_navigations_suspended());
+ EXPECT_FALSE(pending_rfh->are_navigations_suspended());
// DidNavigate from the pending page
contents()->TestDidNavigate(
@@ -532,23 +531,22 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) {
// Going back should switch SiteInstances again. The first SiteInstance is
// stored in the NavigationEntry, so it should be the same as at the start.
- // We should use the same RVH as before, swapping it back in.
+ // We should use the same RFH as before, swapping it back in.
controller().GoBack();
- TestRenderViewHost* goback_rvh =
- static_cast<TestRenderViewHost*>(contents()->GetPendingRenderViewHost());
- EXPECT_EQ(orig_rvh, goback_rvh);
+ TestRenderFrameHost* goback_rfh = pending_main_test_rfh();
+ EXPECT_EQ(orig_rfh, goback_rfh);
EXPECT_TRUE(contents()->cross_navigation_pending());
- // Navigations should be suspended in goback_rvh until BeforeUnloadACK.
- EXPECT_TRUE(goback_rvh->are_navigations_suspended());
+ // Navigations should be suspended in goback_rfh until BeforeUnloadACK.
+ EXPECT_TRUE(goback_rfh->are_navigations_suspended());
pending_rvh->SendBeforeUnloadACK(true);
- EXPECT_FALSE(goback_rvh->are_navigations_suspended());
+ EXPECT_FALSE(goback_rfh->are_navigations_suspended());
// DidNavigate from the back action
contents()->TestDidNavigate(
- goback_rvh, 1, url2, PAGE_TRANSITION_TYPED);
+ goback_rfh->GetRenderViewHost(), 1, url2, PAGE_TRANSITION_TYPED);
EXPECT_FALSE(contents()->cross_navigation_pending());
- EXPECT_EQ(goback_rvh, contents()->GetRenderViewHost());
+ EXPECT_EQ(goback_rfh->GetRenderViewHost(), contents()->GetRenderViewHost());
EXPECT_EQ(instance1, contents()->GetSiteInstance());
// The pending RFH should now be swapped out, not deleted.
EXPECT_TRUE(contents()->GetRenderManagerForTesting()->
@@ -676,8 +674,7 @@ TEST_F(WebContentsImplTest, NavigateFromSitelessUrl) {
SetBrowserClientForTesting(&browser_client);
TestRenderViewHost* orig_rvh = test_rvh();
- RenderFrameHostImpl* orig_rfh =
- contents()->GetFrameTree()->root()->current_frame_host();
+ RenderFrameHostImpl* orig_rfh = main_test_rfh();
int orig_rvh_delete_count = 0;
orig_rvh->set_delete_counter(&orig_rvh_delete_count);
SiteInstanceImpl* orig_instance =
@@ -727,15 +724,17 @@ TEST_F(WebContentsImplTest, NavigateFromSitelessUrl) {
EXPECT_TRUE(contents()->cross_navigation_pending());
EXPECT_EQ(url, contents()->GetLastCommittedURL());
EXPECT_EQ(url2, contents()->GetVisibleURL());
- TestRenderViewHost* pending_rvh =
- static_cast<TestRenderViewHost*>(contents()->GetPendingRenderViewHost());
+ TestRenderFrameHost* pending_rfh = pending_main_test_rfh();
+ TestRenderViewHost* pending_rvh = pending_test_rvh();
+ EXPECT_EQ(pending_rfh->GetRenderViewHost(), pending_rvh);
int pending_rvh_delete_count = 0;
pending_rvh->set_delete_counter(&pending_rvh_delete_count);
// Navigations should be suspended in pending_rvh until BeforeUnloadACK.
- EXPECT_TRUE(pending_rvh->are_navigations_suspended());
+ EXPECT_TRUE(pending_rfh->are_navigations_suspended());
orig_rvh->SendBeforeUnloadACK(true);
- EXPECT_FALSE(pending_rvh->are_navigations_suspended());
+ EXPECT_FALSE(pending_rfh->are_navigations_suspended());
+ EXPECT_EQ(pending_rfh->GetRenderViewHost(), pending_rvh);
// DidNavigate from the pending page.
contents()->TestDidNavigate(
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/public/test/test_renderer_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698