Chromium Code Reviews| Index: content/browser/site_per_process_browsertest.cc |
| diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc |
| index 575628c31a19583c561195f21c2ce711eab0c1a2..a3b687d94c0755aa1b52ae2959ce6bbeea51af75 100644 |
| --- a/content/browser/site_per_process_browsertest.cc |
| +++ b/content/browser/site_per_process_browsertest.cc |
| @@ -6280,4 +6280,52 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| EXPECT_TRUE(observer.WasUserInteractionReceived()); |
| } |
| +// Ensures that navigating to data: URLs present in session history will |
| +// correctly commit the navigation in the same process as the parent frame. |
| +// See https://crbug.com/606996. |
| +IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| + NavigateSubframeToDataUrlInSessionHistory) { |
| + GURL main_url(embedded_test_server()->GetURL( |
| + "a.com", "/cross_site_iframe_factory.html?a(b,b)")); |
| + EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| + |
| + FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| + EXPECT_EQ(2U, root->child_count()); |
| + EXPECT_EQ( |
| + " Site A ------------ proxies for B\n" |
| + " |--Site B ------- proxies for A\n" |
| + " +--Site B ------- proxies for A\n" |
| + "Where A = http://a.com/\n" |
| + " B = http://b.com/", |
| + DepictFrameTree(root)); |
| + |
| + TestNavigationObserver observer(shell()->web_contents()); |
| + FrameTreeNode* child = root->child_at(0); |
| + |
| + // Navigate iframe to a data URL, which will commit in a new SiteInstance. |
| + GURL data_url("data:text/html,dataurl"); |
| + NavigateFrameToURL(child, data_url); |
| + EXPECT_TRUE(observer.last_navigation_succeeded()); |
| + EXPECT_EQ(data_url, observer.last_navigation_url()); |
| + scoped_refptr<SiteInstanceImpl> orig_site_instance = |
| + child->current_frame_host()->GetSiteInstance(); |
| + EXPECT_NE(orig_site_instance, root->current_frame_host()->GetSiteInstance()); |
| + |
| + // Navigate it to another cross-site url. |
| + GURL cross_site_url(embedded_test_server()->GetURL("c.com", "/title1.html")); |
| + NavigateFrameToURL(child, cross_site_url); |
| + EXPECT_TRUE(observer.last_navigation_succeeded()); |
| + EXPECT_EQ(cross_site_url, observer.last_navigation_url()); |
| + EXPECT_EQ(3, web_contents()->GetController().GetEntryCount()); |
| + EXPECT_NE(child->current_frame_host()->GetSiteInstance(), orig_site_instance); |
|
Charlie Reis
2016/05/09 20:21:52
Oops, this is the wrong one to change. In this ca
|
| + |
| + // Go back and ensure the data: URL committed in the same SiteInstance as the |
| + // original navigation. |
| + EXPECT_TRUE(web_contents()->GetController().CanGoBack()); |
| + TestFrameNavigationObserver frame_observer(child); |
| + web_contents()->GetController().GoBack(); |
| + frame_observer.WaitForCommit(); |
| + EXPECT_EQ(orig_site_instance, child->current_frame_host()->GetSiteInstance()); |
| +} |
| + |
| } // namespace content |