OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/test/histogram_tester.h" | 8 #include "base/test/histogram_tester.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" | 10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "content/public/test/mock_render_process_host.h" | 38 #include "content/public/test/mock_render_process_host.h" |
39 #include "content/public/test/test_notification_tracker.h" | 39 #include "content/public/test/test_notification_tracker.h" |
40 #include "content/public/test/test_utils.h" | 40 #include "content/public/test/test_utils.h" |
41 #include "content/test/test_content_browser_client.h" | 41 #include "content/test/test_content_browser_client.h" |
42 #include "content/test/test_content_client.h" | 42 #include "content/test/test_content_client.h" |
43 #include "content/test/test_render_frame_host.h" | 43 #include "content/test/test_render_frame_host.h" |
44 #include "content/test/test_render_view_host.h" | 44 #include "content/test/test_render_view_host.h" |
45 #include "content/test/test_web_contents.h" | 45 #include "content/test/test_web_contents.h" |
46 #include "net/base/load_flags.h" | 46 #include "net/base/load_flags.h" |
47 #include "testing/gtest/include/gtest/gtest.h" | 47 #include "testing/gtest/include/gtest/gtest.h" |
| 48 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" |
48 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 49 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
49 #include "ui/base/page_transition_types.h" | 50 #include "ui/base/page_transition_types.h" |
50 | 51 |
51 namespace content { | 52 namespace content { |
52 namespace { | 53 namespace { |
53 | 54 |
54 // Helper to check that the provided RenderProcessHost received exactly one | 55 // Helper to check that the provided RenderProcessHost received exactly one |
55 // page focus message with the provided focus and routing ID values. | 56 // page focus message with the provided focus and routing ID values. |
56 void VerifyPageFocusMessage(MockRenderProcessHost* rph, | 57 void VerifyPageFocusMessage(MockRenderProcessHost* rph, |
57 bool expected_focus, | 58 bool expected_focus, |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 } | 692 } |
692 | 693 |
693 // Navigate to the first site. | 694 // Navigate to the first site. |
694 NavigateActiveAndCommit(kUrl1); | 695 NavigateActiveAndCommit(kUrl1); |
695 TestRenderFrameHost* initial_rfh = contents()->GetMainFrame(); | 696 TestRenderFrameHost* initial_rfh = contents()->GetMainFrame(); |
696 { | 697 { |
697 RenderFrameHostCreatedObserver observer(contents()); | 698 RenderFrameHostCreatedObserver observer(contents()); |
698 initial_rfh->OnCreateChildFrame( | 699 initial_rfh->OnCreateChildFrame( |
699 initial_rfh->GetProcess()->GetNextRoutingID(), | 700 initial_rfh->GetProcess()->GetNextRoutingID(), |
700 blink::WebTreeScopeType::Document, std::string(), | 701 blink::WebTreeScopeType::Document, std::string(), |
701 blink::WebSandboxFlags::None); | 702 blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); |
702 EXPECT_TRUE(observer.created()); | 703 EXPECT_TRUE(observer.created()); |
703 } | 704 } |
704 | 705 |
705 // Create one more frame in the same SiteInstance where initial_rfh | 706 // Create one more frame in the same SiteInstance where initial_rfh |
706 // exists so that initial_rfh doesn't get deleted on navigation to another | 707 // exists so that initial_rfh doesn't get deleted on navigation to another |
707 // site. | 708 // site. |
708 initial_rfh->GetSiteInstance()->increment_active_frame_count(); | 709 initial_rfh->GetSiteInstance()->increment_active_frame_count(); |
709 | 710 |
710 // Navigate to a cross-site URL. | 711 // Navigate to a cross-site URL. |
711 NavigateActiveAndCommit(kUrl2); | 712 NavigateActiveAndCommit(kUrl2); |
712 EXPECT_TRUE(initial_rfh->is_swapped_out()); | 713 EXPECT_TRUE(initial_rfh->is_swapped_out()); |
713 | 714 |
714 TestRenderFrameHost* dest_rfh = contents()->GetMainFrame(); | 715 TestRenderFrameHost* dest_rfh = contents()->GetMainFrame(); |
715 ASSERT_TRUE(dest_rfh); | 716 ASSERT_TRUE(dest_rfh); |
716 EXPECT_NE(initial_rfh, dest_rfh); | 717 EXPECT_NE(initial_rfh, dest_rfh); |
717 | 718 |
718 { | 719 { |
719 // Since the old RFH is now swapped out, it shouldn't process any messages | 720 // Since the old RFH is now swapped out, it shouldn't process any messages |
720 // to create child frames. | 721 // to create child frames. |
721 RenderFrameHostCreatedObserver observer(contents()); | 722 RenderFrameHostCreatedObserver observer(contents()); |
722 initial_rfh->OnCreateChildFrame( | 723 initial_rfh->OnCreateChildFrame( |
723 initial_rfh->GetProcess()->GetNextRoutingID(), | 724 initial_rfh->GetProcess()->GetNextRoutingID(), |
724 blink::WebTreeScopeType::Document, std::string(), | 725 blink::WebTreeScopeType::Document, std::string(), |
725 blink::WebSandboxFlags::None); | 726 blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); |
726 EXPECT_FALSE(observer.created()); | 727 EXPECT_FALSE(observer.created()); |
727 } | 728 } |
728 } | 729 } |
729 | 730 |
730 TEST_F(RenderFrameHostManagerTest, WhiteListSwapCompositorFrame) { | 731 TEST_F(RenderFrameHostManagerTest, WhiteListSwapCompositorFrame) { |
731 // TODO(nasko): Check with kenrb whether this test can be rewritten and | 732 // TODO(nasko): Check with kenrb whether this test can be rewritten and |
732 // whether it makes sense when swapped out is replaced with proxies. | 733 // whether it makes sense when swapped out is replaced with proxies. |
733 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { | 734 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { |
734 return; | 735 return; |
735 } | 736 } |
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 // http://crbug.com/444955. | 2090 // http://crbug.com/444955. |
2090 TEST_F(RenderFrameHostManagerTestWithSiteIsolation, DetachPendingChild) { | 2091 TEST_F(RenderFrameHostManagerTestWithSiteIsolation, DetachPendingChild) { |
2091 const GURL kUrlA("http://www.google.com/"); | 2092 const GURL kUrlA("http://www.google.com/"); |
2092 const GURL kUrlB("http://webkit.org/"); | 2093 const GURL kUrlB("http://webkit.org/"); |
2093 | 2094 |
2094 // Create a page with two child frames. | 2095 // Create a page with two child frames. |
2095 contents()->NavigateAndCommit(kUrlA); | 2096 contents()->NavigateAndCommit(kUrlA); |
2096 contents()->GetMainFrame()->OnCreateChildFrame( | 2097 contents()->GetMainFrame()->OnCreateChildFrame( |
2097 contents()->GetMainFrame()->GetProcess()->GetNextRoutingID(), | 2098 contents()->GetMainFrame()->GetProcess()->GetNextRoutingID(), |
2098 blink::WebTreeScopeType::Document, "frame_name", | 2099 blink::WebTreeScopeType::Document, "frame_name", |
2099 blink::WebSandboxFlags::None); | 2100 blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); |
2100 contents()->GetMainFrame()->OnCreateChildFrame( | 2101 contents()->GetMainFrame()->OnCreateChildFrame( |
2101 contents()->GetMainFrame()->GetProcess()->GetNextRoutingID(), | 2102 contents()->GetMainFrame()->GetProcess()->GetNextRoutingID(), |
2102 blink::WebTreeScopeType::Document, "frame_name", | 2103 blink::WebTreeScopeType::Document, "frame_name", |
2103 blink::WebSandboxFlags::None); | 2104 blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); |
2104 RenderFrameHostManager* root_manager = | 2105 RenderFrameHostManager* root_manager = |
2105 contents()->GetFrameTree()->root()->render_manager(); | 2106 contents()->GetFrameTree()->root()->render_manager(); |
2106 RenderFrameHostManager* iframe1 = | 2107 RenderFrameHostManager* iframe1 = |
2107 contents()->GetFrameTree()->root()->child_at(0)->render_manager(); | 2108 contents()->GetFrameTree()->root()->child_at(0)->render_manager(); |
2108 RenderFrameHostManager* iframe2 = | 2109 RenderFrameHostManager* iframe2 = |
2109 contents()->GetFrameTree()->root()->child_at(1)->render_manager(); | 2110 contents()->GetFrameTree()->root()->child_at(1)->render_manager(); |
2110 | 2111 |
2111 // 1) The first navigation. | 2112 // 1) The first navigation. |
2112 NavigationEntryImpl entryA(NULL /* instance */, -1 /* page_id */, kUrlA, | 2113 NavigationEntryImpl entryA(NULL /* instance */, -1 /* page_id */, kUrlA, |
2113 Referrer(), base::string16() /* title */, | 2114 Referrer(), base::string16() /* title */, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 // Reload |contents1|. | 2231 // Reload |contents1|. |
2231 contents1->NavigateAndCommit(kUrl1); | 2232 contents1->NavigateAndCommit(kUrl1); |
2232 EXPECT_TRUE(contents1->GetMainFrame()->IsRenderFrameLive()); | 2233 EXPECT_TRUE(contents1->GetMainFrame()->IsRenderFrameLive()); |
2233 EXPECT_FALSE(contents2->GetMainFrame()->IsRenderFrameLive()); | 2234 EXPECT_FALSE(contents2->GetMainFrame()->IsRenderFrameLive()); |
2234 EXPECT_EQ(contents1->GetSiteInstance(), contents2->GetSiteInstance()); | 2235 EXPECT_EQ(contents1->GetSiteInstance(), contents2->GetSiteInstance()); |
2235 | 2236 |
2236 // |contents1| creates an out of process iframe. | 2237 // |contents1| creates an out of process iframe. |
2237 contents1->GetMainFrame()->OnCreateChildFrame( | 2238 contents1->GetMainFrame()->OnCreateChildFrame( |
2238 contents1->GetMainFrame()->GetProcess()->GetNextRoutingID(), | 2239 contents1->GetMainFrame()->GetProcess()->GetNextRoutingID(), |
2239 blink::WebTreeScopeType::Document, "frame_name", | 2240 blink::WebTreeScopeType::Document, "frame_name", |
2240 blink::WebSandboxFlags::None); | 2241 blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); |
2241 RenderFrameHostManager* iframe = | 2242 RenderFrameHostManager* iframe = |
2242 contents()->GetFrameTree()->root()->child_at(0)->render_manager(); | 2243 contents()->GetFrameTree()->root()->child_at(0)->render_manager(); |
2243 NavigationEntryImpl entry(NULL /* instance */, -1 /* page_id */, kUrl2, | 2244 NavigationEntryImpl entry(NULL /* instance */, -1 /* page_id */, kUrl2, |
2244 Referrer(kUrl1, blink::WebReferrerPolicyDefault), | 2245 Referrer(kUrl1, blink::WebReferrerPolicyDefault), |
2245 base::string16() /* title */, | 2246 base::string16() /* title */, |
2246 ui::PAGE_TRANSITION_LINK, | 2247 ui::PAGE_TRANSITION_LINK, |
2247 false /* is_renderer_init */); | 2248 false /* is_renderer_init */); |
2248 RenderFrameHostImpl* cross_site = NavigateToEntry(iframe, entry); | 2249 RenderFrameHostImpl* cross_site = NavigateToEntry(iframe, entry); |
2249 iframe->DidNavigateFrame(cross_site, true); | 2250 iframe->DidNavigateFrame(cross_site, true); |
2250 | 2251 |
(...skipping 27 matching lines...) Expand all Loading... |
2278 | 2279 |
2279 // Make sure the initial process is live so that the pending WebUI navigation | 2280 // Make sure the initial process is live so that the pending WebUI navigation |
2280 // does not commit immediately. Give the page a subframe as well. | 2281 // does not commit immediately. Give the page a subframe as well. |
2281 const GURL kUrl1("http://foo.com"); | 2282 const GURL kUrl1("http://foo.com"); |
2282 RenderFrameHostImpl* main_rfh = contents()->GetMainFrame(); | 2283 RenderFrameHostImpl* main_rfh = contents()->GetMainFrame(); |
2283 NavigateAndCommit(kUrl1); | 2284 NavigateAndCommit(kUrl1); |
2284 EXPECT_TRUE(main_rfh->render_view_host()->IsRenderViewLive()); | 2285 EXPECT_TRUE(main_rfh->render_view_host()->IsRenderViewLive()); |
2285 EXPECT_TRUE(main_rfh->IsRenderFrameLive()); | 2286 EXPECT_TRUE(main_rfh->IsRenderFrameLive()); |
2286 main_rfh->OnCreateChildFrame(main_rfh->GetProcess()->GetNextRoutingID(), | 2287 main_rfh->OnCreateChildFrame(main_rfh->GetProcess()->GetNextRoutingID(), |
2287 blink::WebTreeScopeType::Document, std::string(), | 2288 blink::WebTreeScopeType::Document, std::string(), |
2288 blink::WebSandboxFlags::None); | 2289 blink::WebSandboxFlags::None, |
| 2290 blink::WebFrameOwnerProperties()); |
2289 RenderFrameHostManager* subframe_rfhm = | 2291 RenderFrameHostManager* subframe_rfhm = |
2290 contents()->GetFrameTree()->root()->child_at(0)->render_manager(); | 2292 contents()->GetFrameTree()->root()->child_at(0)->render_manager(); |
2291 | 2293 |
2292 // Start a pending WebUI navigation in the main frame and verify that the | 2294 // Start a pending WebUI navigation in the main frame and verify that the |
2293 // pending RVH has bindings. | 2295 // pending RVH has bindings. |
2294 const GURL kWebUIUrl("chrome://foo"); | 2296 const GURL kWebUIUrl("chrome://foo"); |
2295 NavigationEntryImpl webui_entry( | 2297 NavigationEntryImpl webui_entry( |
2296 nullptr /* instance */, -1 /* page_id */, kWebUIUrl, Referrer(), | 2298 nullptr /* instance */, -1 /* page_id */, kWebUIUrl, Referrer(), |
2297 base::string16() /* title */, ui::PAGE_TRANSITION_TYPED, | 2299 base::string16() /* title */, ui::PAGE_TRANSITION_TYPED, |
2298 false /* is_renderer_init */); | 2300 false /* is_renderer_init */); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2436 // The test starts traversing openers from root1 and expects to discover all | 2438 // The test starts traversing openers from root1 and expects to discover all |
2437 // four FrameTrees. Nodes 13 (with cycle to itself) and 42 (with back link to | 2439 // four FrameTrees. Nodes 13 (with cycle to itself) and 42 (with back link to |
2438 // root3) should be put on the list of nodes that will need their frame openers | 2440 // root3) should be put on the list of nodes that will need their frame openers |
2439 // set separately in a second pass, since their opener routing IDs won't be | 2441 // set separately in a second pass, since their opener routing IDs won't be |
2440 // available during the first pass of CreateOpenerProxies. | 2442 // available during the first pass of CreateOpenerProxies. |
2441 TEST_F(RenderFrameHostManagerTest, TraverseComplexOpenerChain) { | 2443 TEST_F(RenderFrameHostManagerTest, TraverseComplexOpenerChain) { |
2442 FrameTree* tree1 = contents()->GetFrameTree(); | 2444 FrameTree* tree1 = contents()->GetFrameTree(); |
2443 FrameTreeNode* root1 = tree1->root(); | 2445 FrameTreeNode* root1 = tree1->root(); |
2444 int process_id = root1->current_frame_host()->GetProcess()->GetID(); | 2446 int process_id = root1->current_frame_host()->GetProcess()->GetID(); |
2445 tree1->AddFrame(root1, process_id, 12, blink::WebTreeScopeType::Document, | 2447 tree1->AddFrame(root1, process_id, 12, blink::WebTreeScopeType::Document, |
2446 std::string(), blink::WebSandboxFlags::None); | 2448 std::string(), blink::WebSandboxFlags::None, |
| 2449 blink::WebFrameOwnerProperties()); |
2447 tree1->AddFrame(root1, process_id, 13, blink::WebTreeScopeType::Document, | 2450 tree1->AddFrame(root1, process_id, 13, blink::WebTreeScopeType::Document, |
2448 std::string(), blink::WebSandboxFlags::None); | 2451 std::string(), blink::WebSandboxFlags::None, |
| 2452 blink::WebFrameOwnerProperties()); |
2449 | 2453 |
2450 scoped_ptr<TestWebContents> tab2( | 2454 scoped_ptr<TestWebContents> tab2( |
2451 TestWebContents::Create(browser_context(), nullptr)); | 2455 TestWebContents::Create(browser_context(), nullptr)); |
2452 FrameTree* tree2 = tab2->GetFrameTree(); | 2456 FrameTree* tree2 = tab2->GetFrameTree(); |
2453 FrameTreeNode* root2 = tree2->root(); | 2457 FrameTreeNode* root2 = tree2->root(); |
2454 process_id = root2->current_frame_host()->GetProcess()->GetID(); | 2458 process_id = root2->current_frame_host()->GetProcess()->GetID(); |
2455 tree2->AddFrame(root2, process_id, 22, blink::WebTreeScopeType::Document, | 2459 tree2->AddFrame(root2, process_id, 22, blink::WebTreeScopeType::Document, |
2456 std::string(), blink::WebSandboxFlags::None); | 2460 std::string(), blink::WebSandboxFlags::None, |
| 2461 blink::WebFrameOwnerProperties()); |
2457 tree2->AddFrame(root2, process_id, 23, blink::WebTreeScopeType::Document, | 2462 tree2->AddFrame(root2, process_id, 23, blink::WebTreeScopeType::Document, |
2458 std::string(), blink::WebSandboxFlags::None); | 2463 std::string(), blink::WebSandboxFlags::None, |
| 2464 blink::WebFrameOwnerProperties()); |
2459 | 2465 |
2460 scoped_ptr<TestWebContents> tab3( | 2466 scoped_ptr<TestWebContents> tab3( |
2461 TestWebContents::Create(browser_context(), nullptr)); | 2467 TestWebContents::Create(browser_context(), nullptr)); |
2462 FrameTree* tree3 = tab3->GetFrameTree(); | 2468 FrameTree* tree3 = tab3->GetFrameTree(); |
2463 FrameTreeNode* root3 = tree3->root(); | 2469 FrameTreeNode* root3 = tree3->root(); |
2464 | 2470 |
2465 scoped_ptr<TestWebContents> tab4( | 2471 scoped_ptr<TestWebContents> tab4( |
2466 TestWebContents::Create(browser_context(), nullptr)); | 2472 TestWebContents::Create(browser_context(), nullptr)); |
2467 FrameTree* tree4 = tab4->GetFrameTree(); | 2473 FrameTree* tree4 = tab4->GetFrameTree(); |
2468 FrameTreeNode* root4 = tree4->root(); | 2474 FrameTreeNode* root4 = tree4->root(); |
2469 process_id = root4->current_frame_host()->GetProcess()->GetID(); | 2475 process_id = root4->current_frame_host()->GetProcess()->GetID(); |
2470 tree4->AddFrame(root4, process_id, 42, blink::WebTreeScopeType::Document, | 2476 tree4->AddFrame(root4, process_id, 42, blink::WebTreeScopeType::Document, |
2471 std::string(), blink::WebSandboxFlags::None); | 2477 std::string(), blink::WebSandboxFlags::None, |
| 2478 blink::WebFrameOwnerProperties()); |
2472 | 2479 |
2473 root1->child_at(1)->SetOpener(root1->child_at(1)); | 2480 root1->child_at(1)->SetOpener(root1->child_at(1)); |
2474 root1->SetOpener(root2->child_at(1)); | 2481 root1->SetOpener(root2->child_at(1)); |
2475 root2->SetOpener(root3); | 2482 root2->SetOpener(root3); |
2476 root2->child_at(0)->SetOpener(root4); | 2483 root2->child_at(0)->SetOpener(root4); |
2477 root2->child_at(1)->SetOpener(root4); | 2484 root2->child_at(1)->SetOpener(root4); |
2478 root4->child_at(0)->SetOpener(root3); | 2485 root4->child_at(0)->SetOpener(root3); |
2479 | 2486 |
2480 std::vector<FrameTree*> opener_frame_trees; | 2487 std::vector<FrameTree*> opener_frame_trees; |
2481 base::hash_set<FrameTreeNode*> nodes_with_back_links; | 2488 base::hash_set<FrameTreeNode*> nodes_with_back_links; |
(...skipping 28 matching lines...) Expand all Loading... |
2510 const GURL kUrlA("http://a.com/"); | 2517 const GURL kUrlA("http://a.com/"); |
2511 const GURL kUrlB("http://b.com/"); | 2518 const GURL kUrlB("http://b.com/"); |
2512 const GURL kUrlC("http://c.com/"); | 2519 const GURL kUrlC("http://c.com/"); |
2513 | 2520 |
2514 // Set up a page at a.com with three subframes: two for b.com and one for | 2521 // Set up a page at a.com with three subframes: two for b.com and one for |
2515 // c.com. | 2522 // c.com. |
2516 contents()->NavigateAndCommit(kUrlA); | 2523 contents()->NavigateAndCommit(kUrlA); |
2517 main_test_rfh()->OnCreateChildFrame( | 2524 main_test_rfh()->OnCreateChildFrame( |
2518 main_test_rfh()->GetProcess()->GetNextRoutingID(), | 2525 main_test_rfh()->GetProcess()->GetNextRoutingID(), |
2519 blink::WebTreeScopeType::Document, "frame1", | 2526 blink::WebTreeScopeType::Document, "frame1", |
2520 blink::WebSandboxFlags::None); | 2527 blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); |
2521 main_test_rfh()->OnCreateChildFrame( | 2528 main_test_rfh()->OnCreateChildFrame( |
2522 main_test_rfh()->GetProcess()->GetNextRoutingID(), | 2529 main_test_rfh()->GetProcess()->GetNextRoutingID(), |
2523 blink::WebTreeScopeType::Document, "frame2", | 2530 blink::WebTreeScopeType::Document, "frame2", |
2524 blink::WebSandboxFlags::None); | 2531 blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); |
2525 main_test_rfh()->OnCreateChildFrame( | 2532 main_test_rfh()->OnCreateChildFrame( |
2526 main_test_rfh()->GetProcess()->GetNextRoutingID(), | 2533 main_test_rfh()->GetProcess()->GetNextRoutingID(), |
2527 blink::WebTreeScopeType::Document, "frame3", | 2534 blink::WebTreeScopeType::Document, "frame3", |
2528 blink::WebSandboxFlags::None); | 2535 blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); |
2529 | 2536 |
2530 FrameTreeNode* root = contents()->GetFrameTree()->root(); | 2537 FrameTreeNode* root = contents()->GetFrameTree()->root(); |
2531 RenderFrameHostManager* child1 = root->child_at(0)->render_manager(); | 2538 RenderFrameHostManager* child1 = root->child_at(0)->render_manager(); |
2532 RenderFrameHostManager* child2 = root->child_at(1)->render_manager(); | 2539 RenderFrameHostManager* child2 = root->child_at(1)->render_manager(); |
2533 RenderFrameHostManager* child3 = root->child_at(2)->render_manager(); | 2540 RenderFrameHostManager* child3 = root->child_at(2)->render_manager(); |
2534 | 2541 |
2535 // Navigate first two subframes to B. | 2542 // Navigate first two subframes to B. |
2536 NavigationEntryImpl entryB(nullptr /* instance */, -1 /* page_id */, kUrlB, | 2543 NavigationEntryImpl entryB(nullptr /* instance */, -1 /* page_id */, kUrlB, |
2537 Referrer(kUrlA, blink::WebReferrerPolicyDefault), | 2544 Referrer(kUrlA, blink::WebReferrerPolicyDefault), |
2538 base::string16() /* title */, | 2545 base::string16() /* title */, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2608 | 2615 |
2609 const GURL kUrlA("http://a.com/"); | 2616 const GURL kUrlA("http://a.com/"); |
2610 const GURL kUrlB("http://b.com/"); | 2617 const GURL kUrlB("http://b.com/"); |
2611 const GURL kUrlC("http://c.com/"); | 2618 const GURL kUrlC("http://c.com/"); |
2612 | 2619 |
2613 // Set up a page at a.com with a b.com subframe. | 2620 // Set up a page at a.com with a b.com subframe. |
2614 contents()->NavigateAndCommit(kUrlA); | 2621 contents()->NavigateAndCommit(kUrlA); |
2615 main_test_rfh()->OnCreateChildFrame( | 2622 main_test_rfh()->OnCreateChildFrame( |
2616 main_test_rfh()->GetProcess()->GetNextRoutingID(), | 2623 main_test_rfh()->GetProcess()->GetNextRoutingID(), |
2617 blink::WebTreeScopeType::Document, "frame1", | 2624 blink::WebTreeScopeType::Document, "frame1", |
2618 blink::WebSandboxFlags::None); | 2625 blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties()); |
2619 | 2626 |
2620 FrameTreeNode* root = contents()->GetFrameTree()->root(); | 2627 FrameTreeNode* root = contents()->GetFrameTree()->root(); |
2621 RenderFrameHostManager* child = root->child_at(0)->render_manager(); | 2628 RenderFrameHostManager* child = root->child_at(0)->render_manager(); |
2622 | 2629 |
2623 // Navigate subframe to B. | 2630 // Navigate subframe to B. |
2624 NavigationEntryImpl entryB(nullptr /* instance */, -1 /* page_id */, kUrlB, | 2631 NavigationEntryImpl entryB(nullptr /* instance */, -1 /* page_id */, kUrlB, |
2625 Referrer(kUrlA, blink::WebReferrerPolicyDefault), | 2632 Referrer(kUrlA, blink::WebReferrerPolicyDefault), |
2626 base::string16() /* title */, | 2633 base::string16() /* title */, |
2627 ui::PAGE_TRANSITION_LINK, | 2634 ui::PAGE_TRANSITION_LINK, |
2628 false /* is_renderer_init */); | 2635 false /* is_renderer_init */); |
(...skipping 20 matching lines...) Expand all Loading... |
2649 root->render_manager()->GetRenderFrameProxyHost(hostC->GetSiteInstance()); | 2656 root->render_manager()->GetRenderFrameProxyHost(hostC->GetSiteInstance()); |
2650 EXPECT_TRUE(proxy); | 2657 EXPECT_TRUE(proxy); |
2651 | 2658 |
2652 // Since the B->C navigation happened while the current page was focused, | 2659 // Since the B->C navigation happened while the current page was focused, |
2653 // page focus should propagate to the new subframe process. Check that | 2660 // page focus should propagate to the new subframe process. Check that |
2654 // process C received the proper focus message. | 2661 // process C received the proper focus message. |
2655 VerifyPageFocusMessage(hostC->GetProcess(), true, proxy->GetRoutingID()); | 2662 VerifyPageFocusMessage(hostC->GetProcess(), true, proxy->GetRoutingID()); |
2656 } | 2663 } |
2657 | 2664 |
2658 } // namespace content | 2665 } // namespace content |
OLD | NEW |