Chromium Code Reviews| 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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1335 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteAfterError) { | 1335 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteAfterError) { |
| 1336 GURL main_url(embedded_test_server()->GetURL( | 1336 GURL main_url(embedded_test_server()->GetURL( |
| 1337 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 1337 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 1338 NavigateToURL(shell(), main_url); | 1338 NavigateToURL(shell(), main_url); |
| 1339 | 1339 |
| 1340 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1340 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1341 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1341 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) |
| 1342 ->GetFrameTree() | 1342 ->GetFrameTree() |
| 1343 ->root(); | 1343 ->root(); |
| 1344 | 1344 |
| 1345 TestNavigationObserver observer(shell()->web_contents()); | |
| 1346 | 1345 |
|
nasko
2016/02/25 19:58:40
nit: No need for two empty lines. Remove one of th
clamy
2016/02/26 11:04:16
Done.
| |
| 1347 // Load same-site page into iframe. | 1346 // Load same-site page into iframe. |
| 1348 FrameTreeNode* child = root->child_at(0); | 1347 { |
| 1349 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 1348 TestNavigationObserver observer(shell()->web_contents()); |
| 1350 NavigateFrameToURL(child, http_url); | 1349 FrameTreeNode* child = root->child_at(0); |
| 1351 EXPECT_EQ(http_url, observer.last_navigation_url()); | 1350 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 1352 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1351 NavigateFrameToURL(child, http_url); |
| 1352 EXPECT_EQ(http_url, observer.last_navigation_url()); | |
| 1353 EXPECT_TRUE(observer.last_navigation_succeeded()); | |
| 1354 observer.Wait(); | |
| 1355 } | |
| 1353 | 1356 |
| 1354 // Load cross-site page into iframe. | 1357 // Load cross-site page into iframe. |
| 1355 GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html"); | 1358 { |
| 1356 NavigateFrameToURL(root->child_at(0), url); | 1359 TestNavigationObserver observer(shell()->web_contents()); |
| 1357 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1360 FrameTreeNode* child = root->child_at(0); |
| 1358 EXPECT_EQ(url, observer.last_navigation_url()); | 1361 GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html"); |
| 1362 NavigateFrameToURL(root->child_at(0), url); | |
| 1363 EXPECT_TRUE(observer.last_navigation_succeeded()); | |
| 1364 EXPECT_EQ(url, observer.last_navigation_url()); | |
| 1365 observer.Wait(); | |
| 1359 | 1366 |
| 1360 // Ensure that we have created a new process for the subframe. | 1367 // Ensure that we have created a new process for the subframe. |
| 1361 EXPECT_EQ( | 1368 EXPECT_EQ( |
| 1362 " Site A ------------ proxies for B\n" | 1369 " Site A ------------ proxies for B\n" |
| 1363 " +--Site B ------- proxies for A\n" | 1370 " +--Site B ------- proxies for A\n" |
| 1364 "Where A = http://a.com/\n" | 1371 "Where A = http://a.com/\n" |
| 1365 " B = http://foo.com/", | 1372 " B = http://foo.com/", |
| 1366 DepictFrameTree(root)); | 1373 DepictFrameTree(root)); |
| 1367 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); | 1374 SiteInstance* site_instance = |
| 1368 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); | 1375 child->current_frame_host()->GetSiteInstance(); |
| 1376 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); | |
| 1377 } | |
| 1369 | 1378 |
| 1370 // Stop the test server and try to navigate the remote frame. | 1379 // Stop the test server and try to navigate the remote frame. |
| 1371 url = embedded_test_server()->GetURL("bar.com", "/title3.html"); | 1380 GURL url = embedded_test_server()->GetURL("bar.com", "/title3.html"); |
|
nasko
2016/02/25 19:58:41
nit: Since all navigations are done now in local s
clamy
2016/02/26 11:04:16
Done.
| |
| 1372 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); | 1381 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); |
| 1373 NavigateIframeToURL(shell()->web_contents(), "child-0", url); | 1382 NavigateIframeToURL(shell()->web_contents(), "child-0", url); |
| 1374 } | 1383 } |
| 1375 | 1384 |
| 1376 // Verify that killing a cross-site frame's process B and then navigating a | 1385 // Verify that killing a cross-site frame's process B and then navigating a |
| 1377 // frame to B correctly recreates all proxies in B. | 1386 // frame to B correctly recreates all proxies in B. |
| 1378 // | 1387 // |
| 1379 // 1 A A A | 1388 // 1 A A A |
| 1380 // / | \ / | \ / | \ / | \ . | 1389 // / | \ / | \ / | \ / | \ . |
| 1381 // 2 3 4 -> B A A -> Kill B -> B* A A -> B* B A | 1390 // 2 3 4 -> B A A -> Kill B -> B* A A -> B* B A |
| (...skipping 3913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5295 | 5304 |
| 5296 // Force the renderer to generate a new frame. | 5305 // Force the renderer to generate a new frame. |
| 5297 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), | 5306 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), |
| 5298 "document.body.style.background = 'black'")); | 5307 "document.body.style.background = 'black'")); |
| 5299 | 5308 |
| 5300 // Waits for the next frame. | 5309 // Waits for the next frame. |
| 5301 observer->Wait(); | 5310 observer->Wait(); |
| 5302 } | 5311 } |
| 5303 | 5312 |
| 5304 } // namespace content | 5313 } // namespace content |
| OLD | NEW |