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 <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2305 " Site A\n" | 2305 " Site A\n" |
2306 " |--Site A\n" | 2306 " |--Site A\n" |
2307 " +--Site A\n" | 2307 " +--Site A\n" |
2308 " |--Site A\n" | 2308 " |--Site A\n" |
2309 " +--Site A\n" | 2309 " +--Site A\n" |
2310 " +--Site A\n" | 2310 " +--Site A\n" |
2311 "Where A = http://127.0.0.1/", | 2311 "Where A = http://127.0.0.1/", |
2312 DepictFrameTree(root)); | 2312 DepictFrameTree(root)); |
2313 } | 2313 } |
2314 | 2314 |
| 2315 // Test that opening a cross-site window with child frames doesn't crash either |
| 2316 // renderer in --site-per-process. This was previously broken because frame |
| 2317 // swaps weren't being performed on main frames, so it would crash when trying |
| 2318 // to mirror the child frames. https://crbug.com/475003 |
| 2319 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2320 OpenCrossSiteWindowWithFrames) { |
| 2321 ASSERT_EQ(1u, Shell::windows().size()); |
| 2322 Shell* main_window = Shell::windows()[0]; |
| 2323 |
| 2324 // Navigate the main window. |
| 2325 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
| 2326 NavigateToURL(main_window, main_url); |
| 2327 EXPECT_EQ(main_window->web_contents()->GetLastCommittedURL(), main_url); |
| 2328 |
| 2329 // Load a cross-site page into a new window. |
| 2330 GURL cross_url = |
| 2331 embedded_test_server()->GetURL("foo.com", "/site_per_process_main.html"); |
| 2332 std::string script = "window.open('" + cross_url.spec() + "')"; |
| 2333 EXPECT_TRUE(ExecuteScript(main_window->web_contents(), script)); |
| 2334 ASSERT_EQ(2u, Shell::windows().size()); |
| 2335 Shell* cross_window = Shell::windows()[1]; |
| 2336 WaitForLoadStop(cross_window->web_contents()); |
| 2337 EXPECT_EQ(cross_window->web_contents()->GetLastCommittedURL(), cross_url); |
| 2338 |
| 2339 // Make sure the main window is still live. To create a synchronization point |
| 2340 // and ensure that the renderer has processed all the messages for updating |
| 2341 // the frame tree, execute a simple bit of JS first. |
| 2342 EXPECT_TRUE(ExecuteScript(main_window->web_contents(), "true")); |
| 2343 EXPECT_TRUE(static_cast<WebContentsImpl*>(main_window->web_contents()) |
| 2344 ->GetMainFrame() |
| 2345 ->IsRenderFrameLive()); |
| 2346 // And check the cross-site window too. |
| 2347 EXPECT_TRUE(ExecuteScript(cross_window->web_contents(), "true")); |
| 2348 EXPECT_TRUE(static_cast<WebContentsImpl*>(cross_window->web_contents()) |
| 2349 ->GetMainFrame() |
| 2350 ->IsRenderFrameLive()); |
| 2351 } |
| 2352 |
2315 } // namespace content | 2353 } // namespace content |
OLD | NEW |