| Index: content/browser/frame_host/frame_tree_unittest.cc
|
| diff --git a/content/browser/frame_host/frame_tree_unittest.cc b/content/browser/frame_host/frame_tree_unittest.cc
|
| index 2fe94345bfa91169ad805eda86856177bff054a0..9d1695cf0bd2031611d9a14f9ed00fe968442683 100644
|
| --- a/content/browser/frame_host/frame_tree_unittest.cc
|
| +++ b/content/browser/frame_host/frame_tree_unittest.cc
|
| @@ -15,6 +15,7 @@
|
| #include "content/browser/renderer_host/render_view_host_impl.h"
|
| #include "content/browser/web_contents/web_contents_impl.h"
|
| #include "content/common/frame_messages.h"
|
| +#include "content/common/frame_owner_properties.h"
|
| #include "content/public/browser/web_contents_observer.h"
|
| #include "content/public/test/mock_render_process_host.h"
|
| #include "content/public/test/test_browser_context.h"
|
| @@ -157,29 +158,26 @@ TEST_F(FrameTreeTest, Shape) {
|
| // Simulate attaching a series of frames to build the frame tree.
|
| frame_tree->AddFrame(root, process_id, 14, blink::WebTreeScopeType::Document,
|
| std::string(), "uniqueName0",
|
| - blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| frame_tree->AddFrame(root, process_id, 15, blink::WebTreeScopeType::Document,
|
| std::string(), "uniqueName1",
|
| - blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| frame_tree->AddFrame(root, process_id, 16, blink::WebTreeScopeType::Document,
|
| std::string(), "uniqueName2",
|
| - blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
|
|
| frame_tree->AddFrame(root->child_at(0), process_id, 244,
|
| blink::WebTreeScopeType::Document, std::string(),
|
| "uniqueName3", blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + FrameOwnerProperties());
|
| frame_tree->AddFrame(root->child_at(1), process_id, 255,
|
| blink::WebTreeScopeType::Document, no_children_node,
|
| "uniqueName4", blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + FrameOwnerProperties());
|
| frame_tree->AddFrame(root->child_at(0), process_id, 245,
|
| blink::WebTreeScopeType::Document, std::string(),
|
| "uniqueName5", blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + FrameOwnerProperties());
|
|
|
| EXPECT_EQ(
|
| "2: [14: [244: [], 245: []], "
|
| @@ -191,41 +189,41 @@ TEST_F(FrameTreeTest, Shape) {
|
| frame_tree->AddFrame(child_16, process_id, 264,
|
| blink::WebTreeScopeType::Document, std::string(),
|
| "uniqueName6", blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + FrameOwnerProperties());
|
| frame_tree->AddFrame(child_16, process_id, 265,
|
| blink::WebTreeScopeType::Document, std::string(),
|
| "uniqueName7", blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + FrameOwnerProperties());
|
| frame_tree->AddFrame(child_16, process_id, 266,
|
| blink::WebTreeScopeType::Document, std::string(),
|
| "uniqueName8", blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + FrameOwnerProperties());
|
| frame_tree->AddFrame(child_16, process_id, 267,
|
| blink::WebTreeScopeType::Document, deep_subtree,
|
| "uniqueName9", blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + FrameOwnerProperties());
|
| frame_tree->AddFrame(child_16, process_id, 268,
|
| blink::WebTreeScopeType::Document, std::string(),
|
| "uniqueName10", blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + FrameOwnerProperties());
|
|
|
| FrameTreeNode* child_267 = child_16->child_at(3);
|
| frame_tree->AddFrame(child_267, process_id, 365,
|
| blink::WebTreeScopeType::Document, std::string(),
|
| "uniqueName11", blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + FrameOwnerProperties());
|
| frame_tree->AddFrame(child_267->child_at(0), process_id, 455,
|
| blink::WebTreeScopeType::Document, std::string(),
|
| "uniqueName12", blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| + FrameOwnerProperties());
|
| frame_tree->AddFrame(child_267->child_at(0)->child_at(0), process_id, 555,
|
| blink::WebTreeScopeType::Document, std::string(),
|
| "uniqueName13", blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties());
|
| - frame_tree->AddFrame(
|
| - child_267->child_at(0)->child_at(0)->child_at(0), process_id, 655,
|
| - blink::WebTreeScopeType::Document, std::string(), "uniqueName14",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + FrameOwnerProperties());
|
| + frame_tree->AddFrame(child_267->child_at(0)->child_at(0)->child_at(0),
|
| + process_id, 655, blink::WebTreeScopeType::Document,
|
| + std::string(), "uniqueName14",
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
|
|
| // Now that's it's fully built, verify the tree structure is as expected.
|
| EXPECT_EQ(
|
| @@ -298,13 +296,13 @@ TEST_F(FrameTreeTest, FindFrames) {
|
|
|
| main_test_rfh()->OnCreateChildFrame(
|
| 22, blink::WebTreeScopeType::Document, "child0", "uniqueName0",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| main_test_rfh()->OnCreateChildFrame(
|
| 23, blink::WebTreeScopeType::Document, "child1", "uniqueName1",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| main_test_rfh()->OnCreateChildFrame(
|
| 24, blink::WebTreeScopeType::Document, std::string(), "uniqueName2",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| FrameTreeNode* child0 = root->child_at(0);
|
| FrameTreeNode* child1 = root->child_at(1);
|
|
|
| @@ -313,7 +311,7 @@ TEST_F(FrameTreeTest, FindFrames) {
|
| // Add one grandchild frame.
|
| child1->current_frame_host()->OnCreateChildFrame(
|
| 33, blink::WebTreeScopeType::Document, "grandchild", "uniqueName3",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| FrameTreeNode* grandchild = child1->child_at(0);
|
|
|
| // Ensure they can be found by FTN id.
|
| @@ -351,13 +349,13 @@ TEST_F(FrameTreeTest, GetSibling) {
|
| FrameTreeNode* root = frame_tree->root();
|
| main_test_rfh()->OnCreateChildFrame(
|
| 22, blink::WebTreeScopeType::Document, "child0", "uniqueName0",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| main_test_rfh()->OnCreateChildFrame(
|
| 23, blink::WebTreeScopeType::Document, "child1", "uniqueName1",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| main_test_rfh()->OnCreateChildFrame(
|
| 24, blink::WebTreeScopeType::Document, "child2", "uniqueName2",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| FrameTreeNode* child0 = root->child_at(0);
|
| FrameTreeNode* child1 = root->child_at(1);
|
| FrameTreeNode* child2 = root->child_at(2);
|
| @@ -365,7 +363,7 @@ TEST_F(FrameTreeTest, GetSibling) {
|
| // Add one grandchild frame.
|
| child1->current_frame_host()->OnCreateChildFrame(
|
| 33, blink::WebTreeScopeType::Document, "grandchild", "uniqueName3",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| FrameTreeNode* grandchild = child1->child_at(0);
|
|
|
| // Test PreviousSibling().
|
| @@ -396,14 +394,14 @@ TEST_F(FrameTreeTest, ObserverWalksTreeDuringFrameCreation) {
|
| // Simulate attaching a series of frames to build the frame tree.
|
| main_test_rfh()->OnCreateChildFrame(
|
| 14, blink::WebTreeScopeType::Document, std::string(), "uniqueName0",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| EXPECT_EQ(
|
| "RenderFrameHostChanged(new)(14) -> 2: []\n"
|
| "RenderFrameCreated(14) -> 2: [14: []]",
|
| activity.GetLog());
|
| main_test_rfh()->OnCreateChildFrame(
|
| 18, blink::WebTreeScopeType::Document, std::string(), "uniqueName1",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| EXPECT_EQ(
|
| "RenderFrameHostChanged(new)(18) -> 2: [14: []]\n"
|
| "RenderFrameCreated(18) -> 2: [14: [], 18: []]",
|
| @@ -423,14 +421,14 @@ TEST_F(FrameTreeTest, ObserverWalksTreeAfterCrash) {
|
|
|
| main_test_rfh()->OnCreateChildFrame(
|
| 22, blink::WebTreeScopeType::Document, std::string(), "uniqueName0",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| EXPECT_EQ(
|
| "RenderFrameHostChanged(new)(22) -> 2: []\n"
|
| "RenderFrameCreated(22) -> 2: [22: []]",
|
| activity.GetLog());
|
| main_test_rfh()->OnCreateChildFrame(
|
| 23, blink::WebTreeScopeType::Document, std::string(), "uniqueName1",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| EXPECT_EQ(
|
| "RenderFrameHostChanged(new)(23) -> 2: [22: []]\n"
|
| "RenderFrameCreated(23) -> 2: [22: [], 23: []]",
|
| @@ -459,8 +457,7 @@ TEST_F(FrameTreeTest, FailAddFrameWithWrongProcessId) {
|
| // Simulate attaching a frame from mismatched process id.
|
| ASSERT_FALSE(frame_tree->AddFrame(
|
| root, process_id + 1, 1, blink::WebTreeScopeType::Document, std::string(),
|
| - "uniqueName0", blink::WebSandboxFlags::None,
|
| - blink::WebFrameOwnerProperties()));
|
| + "uniqueName0", blink::WebSandboxFlags::None, FrameOwnerProperties()));
|
| ASSERT_EQ("2: []", GetTreeState(frame_tree));
|
| }
|
|
|
| @@ -474,16 +471,16 @@ TEST_F(FrameTreeTest, ProcessCrashClearsGlobalMap) {
|
|
|
| main_test_rfh()->OnCreateChildFrame(
|
| 22, blink::WebTreeScopeType::Document, std::string(), "uniqueName0",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
| main_test_rfh()->OnCreateChildFrame(
|
| 23, blink::WebTreeScopeType::Document, std::string(), "uniqueName1",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
|
|
| // Add one grandchild frame.
|
| RenderFrameHostImpl* child1_rfh = root->child_at(0)->current_frame_host();
|
| child1_rfh->OnCreateChildFrame(
|
| 33, blink::WebTreeScopeType::Document, std::string(), "uniqueName2",
|
| - blink::WebSandboxFlags::None, blink::WebFrameOwnerProperties());
|
| + blink::WebSandboxFlags::None, FrameOwnerProperties());
|
|
|
| // Ensure they can be found by id.
|
| int id1 = root->child_at(0)->frame_tree_node_id();
|
|
|