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 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | |
nasko
2015/05/06 22:57:44
nit: It will be useful to add a description of wha
dcheng
2015/05/07 22:30:13
Done.
| |
2316 OpenCrossSiteWindowWithFrames) { | |
2317 ASSERT_EQ(1u, Shell::windows().size()); | |
2318 Shell* main_window = Shell::windows()[0]; | |
2319 | |
2320 // Navigate the main window. | |
2321 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | |
2322 NavigateToURL(main_window, main_url); | |
2323 EXPECT_EQ(main_window->web_contents()->GetLastCommittedURL(), main_url); | |
2324 | |
2325 // Load a cross-site page into a new window. | |
2326 GURL cross_url = | |
2327 embedded_test_server()->GetURL("foo.com", "/site_per_process_main.html"); | |
2328 std::string script = "window.open('" + cross_url.spec() + "')"; | |
2329 EXPECT_TRUE(ExecuteScript(main_window->web_contents(), script)); | |
2330 ASSERT_EQ(2u, Shell::windows().size()); | |
2331 Shell* cross_window = Shell::windows()[1]; | |
2332 WaitForLoadStop(cross_window->web_contents()); | |
2333 EXPECT_EQ(cross_window->web_contents()->GetLastCommittedURL(), cross_url); | |
2334 | |
2335 // Make sure the main window is still live. To create a synchronization point | |
2336 // and ensure that the renderer has processed all the messages for updating | |
2337 // the frame tree, execute a simple bit of JS first. | |
2338 EXPECT_TRUE(ExecuteScript(main_window->web_contents(), "true")); | |
2339 EXPECT_TRUE(static_cast<WebContentsImpl*>(main_window->web_contents()) | |
2340 ->GetMainFrame() | |
2341 ->IsRenderFrameLive()); | |
2342 // And check the cross-site window too. | |
2343 EXPECT_TRUE(ExecuteScript(cross_window->web_contents(), "true")); | |
2344 EXPECT_TRUE(static_cast<WebContentsImpl*>(cross_window->web_contents()) | |
2345 ->GetMainFrame() | |
2346 ->IsRenderFrameLive()); | |
2347 } | |
2348 | |
2315 } // namespace content | 2349 } // namespace content |
OLD | NEW |