| 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 8287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8298 EXPECT_EQ( | 8298 EXPECT_EQ( |
| 8299 " Site A ------------ proxies for B C\n" | 8299 " Site A ------------ proxies for B C\n" |
| 8300 " +--Site B ------- proxies for A C\n" | 8300 " +--Site B ------- proxies for A C\n" |
| 8301 " +--Site C -- proxies for A B\n" | 8301 " +--Site C -- proxies for A B\n" |
| 8302 "Where A = http://a.com/\n" | 8302 "Where A = http://a.com/\n" |
| 8303 " B = http://b.com/\n" | 8303 " B = http://b.com/\n" |
| 8304 " C = http://c.com/", | 8304 " C = http://c.com/", |
| 8305 DepictFrameTree(root)); | 8305 DepictFrameTree(root)); |
| 8306 } | 8306 } |
| 8307 | 8307 |
| 8308 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 8309 RFHTransfersWhilePendingDeletion) { |
| 8310 GURL main_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 8311 NavigateToURL(shell(), main_url); |
| 8312 |
| 8313 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) |
| 8314 ->GetFrameTree() |
| 8315 ->root(); |
| 8316 |
| 8317 // Start a cross-process navigation and wait until the response is received. |
| 8318 GURL cross_site_url_1 = |
| 8319 embedded_test_server()->GetURL("b.com", "/title1.html"); |
| 8320 TestNavigationManager cross_site_manager(shell()->web_contents(), |
| 8321 cross_site_url_1); |
| 8322 shell()->web_contents()->GetController().LoadURL( |
| 8323 cross_site_url_1, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 8324 EXPECT_TRUE(cross_site_manager.WaitForWillProcessResponse()); |
| 8325 |
| 8326 // Start a renderer-initiated navigation to a cross-process url and make sure |
| 8327 // the navigation will be blocked before being transferred. |
| 8328 GURL cross_site_url_2 = |
| 8329 embedded_test_server()->GetURL("c.com", "/title1.html"); |
| 8330 TestNavigationManager transfer_manager(shell()->web_contents(), |
| 8331 cross_site_url_2); |
| 8332 EXPECT_TRUE(ExecuteScript( |
| 8333 root, "location.href = '" + cross_site_url_2.spec() + "';")); |
| 8334 EXPECT_TRUE(transfer_manager.WaitForWillProcessResponse()); |
| 8335 |
| 8336 // Now have the cross-process navigation commit and mark the current RFH as |
| 8337 // pending deletion. |
| 8338 cross_site_manager.WaitForNavigationFinished(); |
| 8339 |
| 8340 // Resume the navigation in the previous RFH that has just been marked as |
| 8341 // pending deletion. We should not crash. |
| 8342 transfer_manager.WaitForNavigationFinished(); |
| 8343 } |
| 8344 |
| 8308 } // namespace content | 8345 } // namespace content |
| OLD | NEW |