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