| 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 8217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8228 EXPECT_EQ( | 8228 EXPECT_EQ( |
| 8229 " Site A ------------ proxies for B C\n" | 8229 " Site A ------------ proxies for B C\n" |
| 8230 " +--Site B ------- proxies for A C\n" | 8230 " +--Site B ------- proxies for A C\n" |
| 8231 " +--Site C -- proxies for A B\n" | 8231 " +--Site C -- proxies for A B\n" |
| 8232 "Where A = http://a.com/\n" | 8232 "Where A = http://a.com/\n" |
| 8233 " B = http://b.com/\n" | 8233 " B = http://b.com/\n" |
| 8234 " C = http://c.com/", | 8234 " C = http://c.com/", |
| 8235 DepictFrameTree(root)); | 8235 DepictFrameTree(root)); |
| 8236 } | 8236 } |
| 8237 | 8237 |
| 8238 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | |
| 8239 RFHTransfersWhilePendingDeletion) { | |
| 8240 GURL main_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | |
| 8241 NavigateToURL(shell(), main_url); | |
| 8242 | |
| 8243 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | |
| 8244 ->GetFrameTree() | |
| 8245 ->root(); | |
| 8246 | |
| 8247 // Start a cross-process navigation and wait until the response is received. | |
| 8248 GURL cross_site_url_1 = | |
| 8249 embedded_test_server()->GetURL("b.com", "/title1.html"); | |
| 8250 TestNavigationManager cross_site_manager(shell()->web_contents(), | |
| 8251 cross_site_url_1); | |
| 8252 shell()->web_contents()->GetController().LoadURL( | |
| 8253 cross_site_url_1, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | |
| 8254 EXPECT_TRUE(cross_site_manager.WaitForWillProcessResponse()); | |
| 8255 | |
| 8256 // Start a renderer-initiated navigation to a cross-process url and make sure | |
| 8257 // the navigation will be blocked before being transferred. | |
| 8258 GURL cross_site_url_2 = | |
| 8259 embedded_test_server()->GetURL("c.com", "/title1.html"); | |
| 8260 TestNavigationManager transfer_manager(shell()->web_contents(), | |
| 8261 cross_site_url_2); | |
| 8262 EXPECT_TRUE(ExecuteScript( | |
| 8263 root, "location.href = '" + cross_site_url_2.spec() + "';")); | |
| 8264 EXPECT_TRUE(transfer_manager.WaitForWillProcessResponse()); | |
| 8265 | |
| 8266 // Now have the cross-process navigation commit and mark the current RFH as | |
| 8267 // pending deletion. | |
| 8268 cross_site_manager.WaitForNavigationFinished(); | |
| 8269 | |
| 8270 // Resume the navigation in the previous RFH that has just been marked as | |
| 8271 // pending deletion. We should not crash. | |
| 8272 transfer_manager.WaitForNavigationFinished(); | |
| 8273 } | |
| 8274 | |
| 8275 } // namespace content | 8238 } // namespace content |
| OLD | NEW |