OLD | NEW |
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 Loading... |
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::Document, std::string(), | 135 blink::WebTreeScopeType::Document, std::string(), |
136 base::StringPrintf("uniqueName%d", child_id), | 136 base::StringPrintf("uniqueName%d", child_id), |
137 blink::WebSandboxFlags::None, FrameOwnerProperties()); | 137 blink::WebSandboxFlags::None, |
| 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 Loading... |
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 |
OLD | NEW |