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

Side by Side Diff: content/browser/frame_host/frame_tree_node_blame_context_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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/frame_host/frame_tree_node_blame_context.h" 5 #include "content/browser/frame_host/frame_tree_node_blame_context.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/trace_event_analyzer.h" 9 #include "base/test/trace_event_analyzer.h"
10 #include "base/trace_event/trace_buffer.h" 10 #include "base/trace_event/trace_buffer.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 private: 129 private:
130 int CreateSubframes(FrameTreeNode* node, int self_id, const char* shape) { 130 int CreateSubframes(FrameTreeNode* node, int self_id, const char* shape) {
131 int consumption = 0; 131 int consumption = 0;
132 for (int child_num = 1; shape[consumption++] == '('; ++child_num) { 132 for (int child_num = 1; shape[consumption++] == '('; ++child_num) {
133 int child_id = self_id * 10 + child_num; 133 int child_id = self_id * 10 + child_num;
134 tree()->AddFrame(node, process_id(), child_id, 134 tree()->AddFrame(node, process_id(), child_id,
135 blink::WebTreeScopeType::kDocument, std::string(), 135 blink::WebTreeScopeType::kDocument, std::string(),
136 base::StringPrintf("uniqueName%d", child_id), 136 base::StringPrintf("uniqueName%d", child_id),
137 blink::WebSandboxFlags::kNone, FrameOwnerProperties()); 137 blink::WebSandboxFlags::kNone,
138 ParsedFeaturePolicyHeader(), FrameOwnerProperties());
138 FrameTreeNode* child = node->child_at(child_num - 1); 139 FrameTreeNode* child = node->child_at(child_num - 1);
139 consumption += CreateSubframes(child, child_id, shape + consumption); 140 consumption += CreateSubframes(child, child_id, shape + consumption);
140 } 141 }
141 return consumption; 142 return consumption;
142 } 143 }
143 }; 144 };
144 145
145 // Creates a frame tree, tests if (i) the creation of each new frame is 146 // Creates a frame tree, tests if (i) the creation of each new frame is
146 // correctly traced, and (ii) the topology given by the snapshots is correct. 147 // correctly traced, and (ii) the topology given by the snapshots is correct.
147 TEST_F(FrameTreeNodeBlameContextTest, FrameCreation) { 148 TEST_F(FrameTreeNodeBlameContextTest, FrameCreation) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 std::sort(events.begin(), events.end(), EventPointerCompare); 256 std::sort(events.begin(), events.end(), EventPointerCompare);
256 257
257 // Three snapshots are traced, one for each URL change. 258 // Three snapshots are traced, one for each URL change.
258 EXPECT_EQ(3u, events.size()); 259 EXPECT_EQ(3u, events.size());
259 EXPECT_EQ(url1.spec(), GetSnapshotURL(events[0])); 260 EXPECT_EQ(url1.spec(), GetSnapshotURL(events[0]));
260 EXPECT_EQ(url2.spec(), GetSnapshotURL(events[1])); 261 EXPECT_EQ(url2.spec(), GetSnapshotURL(events[1]));
261 EXPECT_EQ("", GetSnapshotURL(events[2])); 262 EXPECT_EQ("", GetSnapshotURL(events[2]));
262 } 263 }
263 264
264 } // namespace content 265 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree_node.cc ('k') | content/browser/frame_host/frame_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698