Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Unified Diff: content/browser/frame_host/frame_tree_unittest.cc

Issue 2797813002: Replicate feature policy container policies. (Closed)
Patch Set: Addressing review comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 1b6005e8b1d91123881415ad5ae438a6c7024910..23f7da9a749ee8f98210eb76d517efa0bfdb57ad 100644
--- a/content/browser/frame_host/frame_tree_unittest.cc
+++ b/content/browser/frame_host/frame_tree_unittest.cc
@@ -158,26 +158,28 @@ TEST_F(FrameTreeTest, Shape) {
// Simulate attaching a series of frames to build the frame tree.
frame_tree->AddFrame(root, process_id, 14, blink::WebTreeScopeType::kDocument,
std::string(), "uniqueName0",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone,
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
frame_tree->AddFrame(root, process_id, 15, blink::WebTreeScopeType::kDocument,
std::string(), "uniqueName1",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone,
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
frame_tree->AddFrame(root, process_id, 16, blink::WebTreeScopeType::kDocument,
std::string(), "uniqueName2",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
-
+ blink::WebSandboxFlags::kNone,
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
frame_tree->AddFrame(root->child_at(0), process_id, 244,
blink::WebTreeScopeType::kDocument, std::string(),
"uniqueName3", blink::WebSandboxFlags::kNone,
- FrameOwnerProperties());
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
frame_tree->AddFrame(root->child_at(1), process_id, 255,
blink::WebTreeScopeType::kDocument, no_children_node,
"uniqueName4", blink::WebSandboxFlags::kNone,
- FrameOwnerProperties());
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
frame_tree->AddFrame(root->child_at(0), process_id, 245,
blink::WebTreeScopeType::kDocument, std::string(),
"uniqueName5", blink::WebSandboxFlags::kNone,
- FrameOwnerProperties());
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
EXPECT_EQ(
"2: [14: [244: [], 245: []], "
@@ -189,41 +191,42 @@ TEST_F(FrameTreeTest, Shape) {
frame_tree->AddFrame(child_16, process_id, 264,
blink::WebTreeScopeType::kDocument, std::string(),
"uniqueName6", blink::WebSandboxFlags::kNone,
- FrameOwnerProperties());
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
frame_tree->AddFrame(child_16, process_id, 265,
blink::WebTreeScopeType::kDocument, std::string(),
"uniqueName7", blink::WebSandboxFlags::kNone,
- FrameOwnerProperties());
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
frame_tree->AddFrame(child_16, process_id, 266,
blink::WebTreeScopeType::kDocument, std::string(),
"uniqueName8", blink::WebSandboxFlags::kNone,
- FrameOwnerProperties());
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
frame_tree->AddFrame(child_16, process_id, 267,
blink::WebTreeScopeType::kDocument, deep_subtree,
"uniqueName9", blink::WebSandboxFlags::kNone,
- FrameOwnerProperties());
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
frame_tree->AddFrame(child_16, process_id, 268,
blink::WebTreeScopeType::kDocument, std::string(),
"uniqueName10", blink::WebSandboxFlags::kNone,
- FrameOwnerProperties());
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
FrameTreeNode* child_267 = child_16->child_at(3);
frame_tree->AddFrame(child_267, process_id, 365,
blink::WebTreeScopeType::kDocument, std::string(),
"uniqueName11", blink::WebSandboxFlags::kNone,
- FrameOwnerProperties());
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
frame_tree->AddFrame(child_267->child_at(0), process_id, 455,
blink::WebTreeScopeType::kDocument, std::string(),
"uniqueName12", blink::WebSandboxFlags::kNone,
- FrameOwnerProperties());
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
frame_tree->AddFrame(child_267->child_at(0)->child_at(0), process_id, 555,
blink::WebTreeScopeType::kDocument, std::string(),
"uniqueName13", blink::WebSandboxFlags::kNone,
- FrameOwnerProperties());
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
frame_tree->AddFrame(child_267->child_at(0)->child_at(0)->child_at(0),
process_id, 655, blink::WebTreeScopeType::kDocument,
std::string(), "uniqueName14",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone,
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties());
// Now that's it's fully built, verify the tree structure is as expected.
EXPECT_EQ(
@@ -296,13 +299,16 @@ TEST_F(FrameTreeTest, FindFrames) {
main_test_rfh()->OnCreateChildFrame(
22, blink::WebTreeScopeType::kDocument, "child0", "uniqueName0",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
main_test_rfh()->OnCreateChildFrame(
23, blink::WebTreeScopeType::kDocument, "child1", "uniqueName1",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
main_test_rfh()->OnCreateChildFrame(
24, blink::WebTreeScopeType::kDocument, std::string(), "uniqueName2",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
FrameTreeNode* child0 = root->child_at(0);
FrameTreeNode* child1 = root->child_at(1);
@@ -311,7 +317,8 @@ TEST_F(FrameTreeTest, FindFrames) {
// Add one grandchild frame.
child1->current_frame_host()->OnCreateChildFrame(
33, blink::WebTreeScopeType::kDocument, "grandchild", "uniqueName3",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
FrameTreeNode* grandchild = child1->child_at(0);
// Ensure they can be found by FTN id.
@@ -349,13 +356,16 @@ TEST_F(FrameTreeTest, GetSibling) {
FrameTreeNode* root = frame_tree->root();
main_test_rfh()->OnCreateChildFrame(
22, blink::WebTreeScopeType::kDocument, "child0", "uniqueName0",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
main_test_rfh()->OnCreateChildFrame(
23, blink::WebTreeScopeType::kDocument, "child1", "uniqueName1",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
main_test_rfh()->OnCreateChildFrame(
24, blink::WebTreeScopeType::kDocument, "child2", "uniqueName2",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
FrameTreeNode* child0 = root->child_at(0);
FrameTreeNode* child1 = root->child_at(1);
FrameTreeNode* child2 = root->child_at(2);
@@ -363,7 +373,8 @@ TEST_F(FrameTreeTest, GetSibling) {
// Add one grandchild frame.
child1->current_frame_host()->OnCreateChildFrame(
33, blink::WebTreeScopeType::kDocument, "grandchild", "uniqueName3",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
FrameTreeNode* grandchild = child1->child_at(0);
// Test PreviousSibling().
@@ -394,14 +405,16 @@ TEST_F(FrameTreeTest, ObserverWalksTreeDuringFrameCreation) {
// Simulate attaching a series of frames to build the frame tree.
main_test_rfh()->OnCreateChildFrame(
14, blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
EXPECT_EQ(
"RenderFrameHostChanged(new)(14) -> 2: []\n"
"RenderFrameCreated(14) -> 2: [14: []]",
activity.GetLog());
main_test_rfh()->OnCreateChildFrame(
18, blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
EXPECT_EQ(
"RenderFrameHostChanged(new)(18) -> 2: [14: []]\n"
"RenderFrameCreated(18) -> 2: [14: [], 18: []]",
@@ -421,14 +434,16 @@ TEST_F(FrameTreeTest, ObserverWalksTreeAfterCrash) {
main_test_rfh()->OnCreateChildFrame(
22, blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
EXPECT_EQ(
"RenderFrameHostChanged(new)(22) -> 2: []\n"
"RenderFrameCreated(22) -> 2: [22: []]",
activity.GetLog());
main_test_rfh()->OnCreateChildFrame(
23, blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
EXPECT_EQ(
"RenderFrameHostChanged(new)(23) -> 2: [22: []]\n"
"RenderFrameCreated(23) -> 2: [22: [], 23: []]",
@@ -458,7 +473,7 @@ TEST_F(FrameTreeTest, FailAddFrameWithWrongProcessId) {
ASSERT_FALSE(frame_tree->AddFrame(
root, process_id + 1, 1, blink::WebTreeScopeType::kDocument,
std::string(), "uniqueName0", blink::WebSandboxFlags::kNone,
- FrameOwnerProperties()));
+ ParsedFeaturePolicyHeader(), FrameOwnerProperties()));
ASSERT_EQ("2: []", GetTreeState(frame_tree));
}
@@ -472,16 +487,19 @@ TEST_F(FrameTreeTest, ProcessCrashClearsGlobalMap) {
main_test_rfh()->OnCreateChildFrame(
22, blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
main_test_rfh()->OnCreateChildFrame(
23, blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
// Add one grandchild frame.
RenderFrameHostImpl* child1_rfh = root->child_at(0)->current_frame_host();
child1_rfh->OnCreateChildFrame(
33, blink::WebTreeScopeType::kDocument, std::string(), "uniqueName2",
- blink::WebSandboxFlags::kNone, FrameOwnerProperties());
+ blink::WebSandboxFlags::kNone, ParsedFeaturePolicyHeader(),
+ FrameOwnerProperties());
// Ensure they can be found by id.
int id1 = root->child_at(0)->frame_tree_node_id();

Powered by Google App Engine
This is Rietveld 408576698