Chromium Code Reviews| Index: content/browser/web_contents/render_view_host_manager_unittest.cc |
| diff --git a/content/browser/web_contents/render_view_host_manager_unittest.cc b/content/browser/web_contents/render_view_host_manager_unittest.cc |
| index ea35e6ba05f5e0931f45df0b4b2e530563d2a2c3..2f8c4679a0176dc93db8f55b58a4c62a1410a290 100644 |
| --- a/content/browser/web_contents/render_view_host_manager_unittest.cc |
| +++ b/content/browser/web_contents/render_view_host_manager_unittest.cc |
| @@ -1211,4 +1211,30 @@ TEST_F(RenderViewHostManagerTest, NoSwapOnGuestNavigations) { |
| instance); |
| } |
| +// Tests that when specified, a navigation is done in the site instance of the |
|
Charlie Reis
2013/07/31 17:16:16
I do not think we should have this behavior.
jochen (gone - plz use gerrit)
2013/07/31 18:30:52
Removed.
|
| +// owning WebContents. |
| +TEST_F(RenderViewHostManagerTest, StayWithinSiteInstance) { |
| + const GURL kUrl1("http://www.google.com/"); |
| + const GURL kUrl2("http://www.chromium.org/"); |
| + |
| + // Create a WebContents with a SiteInstance corresponding to kUrl1. |
| + scoped_refptr<SiteInstance> site_instance( |
| + SiteInstance::CreateForURL(browser_context(), kUrl1)); |
| + scoped_ptr<TestWebContents> contents2( |
| + TestWebContents::Create(browser_context(), site_instance.get())); |
| + |
| + // Navigate to kUrl2, but specify that we want to use the existing |
| + // SiteInstance. |
| + NavigationController::LoadURLParams params(kUrl2); |
| + params.transition_type = PAGE_TRANSITION_LINK; |
| + params.should_stay_in_site_instance = true; |
| + contents2->GetController().LoadURLWithParams(params); |
| + |
| + // Check that the RVH was created with the desired SiteInstance. |
| + TestRenderViewHost* dest_rvh = |
| + static_cast<TestRenderViewHost*>(contents2->GetRenderViewHost()); |
| + ASSERT_TRUE(dest_rvh); |
| + EXPECT_EQ(site_instance.get(), dest_rvh->GetSiteInstance()); |
| +} |
| + |
| } // namespace content |