Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 6262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6273 | 6273 |
| 6274 EXPECT_TRUE(observer.WasUserInteractionReceived()); | 6274 EXPECT_TRUE(observer.WasUserInteractionReceived()); |
| 6275 | 6275 |
| 6276 // Target an event to the main frame. | 6276 // Target an event to the main frame. |
| 6277 observer.Reset(); | 6277 observer.Reset(); |
| 6278 SimulateMouseClick(root->current_frame_host()->GetRenderWidgetHost(), 1, 1); | 6278 SimulateMouseClick(root->current_frame_host()->GetRenderWidgetHost(), 1, 1); |
| 6279 | 6279 |
| 6280 EXPECT_TRUE(observer.WasUserInteractionReceived()); | 6280 EXPECT_TRUE(observer.WasUserInteractionReceived()); |
| 6281 } | 6281 } |
| 6282 | 6282 |
| 6283 // Ensures that navigating to data: URLs present in session history will | |
| 6284 // correctly commit the navigation in the same process as the parent frame. | |
| 6285 // See https://crbug.com/606996. | |
| 6286 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | |
| 6287 NavigateSubframeToDataUrlInSessionHistory) { | |
| 6288 GURL main_url(embedded_test_server()->GetURL( | |
| 6289 "a.com", "/cross_site_iframe_factory.html?a(b,b)")); | |
| 6290 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | |
| 6291 | |
| 6292 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); | |
| 6293 EXPECT_EQ(2U, root->child_count()); | |
| 6294 EXPECT_EQ( | |
| 6295 " Site A ------------ proxies for B\n" | |
| 6296 " |--Site B ------- proxies for A\n" | |
| 6297 " +--Site B ------- proxies for A\n" | |
| 6298 "Where A = http://a.com/\n" | |
| 6299 " B = http://b.com/", | |
| 6300 DepictFrameTree(root)); | |
| 6301 | |
| 6302 TestNavigationObserver observer(shell()->web_contents()); | |
| 6303 FrameTreeNode* child = root->child_at(0); | |
| 6304 | |
| 6305 // Navigate iframe to a data URL, which will commit in a new SiteInstance. | |
| 6306 GURL data_url("data:text/html,dataurl"); | |
| 6307 NavigateFrameToURL(child, data_url); | |
| 6308 EXPECT_TRUE(observer.last_navigation_succeeded()); | |
| 6309 EXPECT_EQ(data_url, observer.last_navigation_url()); | |
| 6310 scoped_refptr<SiteInstanceImpl> orig_site_instance = | |
| 6311 child->current_frame_host()->GetSiteInstance(); | |
| 6312 EXPECT_NE(orig_site_instance, root->current_frame_host()->GetSiteInstance()); | |
| 6313 | |
| 6314 // Navigate it to another cross-site url. | |
| 6315 GURL cross_site_url(embedded_test_server()->GetURL("c.com", "/title1.html")); | |
| 6316 NavigateFrameToURL(child, cross_site_url); | |
| 6317 EXPECT_TRUE(observer.last_navigation_succeeded()); | |
| 6318 EXPECT_EQ(cross_site_url, observer.last_navigation_url()); | |
| 6319 EXPECT_EQ(3, web_contents()->GetController().GetEntryCount()); | |
| 6320 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
| |
| 6321 | |
| 6322 // Go back and ensure the data: URL committed in the same SiteInstance as the | |
| 6323 // original navigation. | |
| 6324 EXPECT_TRUE(web_contents()->GetController().CanGoBack()); | |
| 6325 TestFrameNavigationObserver frame_observer(child); | |
| 6326 web_contents()->GetController().GoBack(); | |
| 6327 frame_observer.WaitForCommit(); | |
| 6328 EXPECT_EQ(orig_site_instance, child->current_frame_host()->GetSiteInstance()); | |
| 6329 } | |
| 6330 | |
| 6283 } // namespace content | 6331 } // namespace content |
| OLD | NEW |