| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 void ExpectFrameTreeNodeObject(const trace_analyzer::TraceEvent* event) { | 40 void ExpectFrameTreeNodeObject(const trace_analyzer::TraceEvent* event) { |
| 41 EXPECT_EQ("navigation", event->category); | 41 EXPECT_EQ("navigation", event->category); |
| 42 EXPECT_EQ("FrameTreeNode", event->name); | 42 EXPECT_EQ("FrameTreeNode", event->name); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void ExpectFrameTreeNodeSnapshot(const trace_analyzer::TraceEvent* event) { | 45 void ExpectFrameTreeNodeSnapshot(const trace_analyzer::TraceEvent* event) { |
| 46 ExpectFrameTreeNodeObject(event); | 46 ExpectFrameTreeNodeObject(event); |
| 47 EXPECT_TRUE(event->HasArg("snapshot")); | 47 EXPECT_TRUE(event->HasArg("snapshot")); |
| 48 EXPECT_TRUE(event->arg_values.at("snapshot") | 48 EXPECT_TRUE(event->arg_values.at("snapshot") |
| 49 ->IsType(base::Value::Type::TYPE_DICTIONARY)); | 49 ->IsType(base::Value::Type::DICTIONARY)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 std::string GetParentNodeID(const trace_analyzer::TraceEvent* event) { | 52 std::string GetParentNodeID(const trace_analyzer::TraceEvent* event) { |
| 53 const base::Value* arg_snapshot = event->arg_values.at("snapshot").get(); | 53 const base::Value* arg_snapshot = event->arg_values.at("snapshot").get(); |
| 54 const base::DictionaryValue* snapshot; | 54 const base::DictionaryValue* snapshot; |
| 55 EXPECT_TRUE(arg_snapshot->GetAsDictionary(&snapshot)); | 55 EXPECT_TRUE(arg_snapshot->GetAsDictionary(&snapshot)); |
| 56 if (!snapshot->HasKey("parent")) | 56 if (!snapshot->HasKey("parent")) |
| 57 return std::string(); | 57 return std::string(); |
| 58 const base::DictionaryValue* parent; | 58 const base::DictionaryValue* parent; |
| 59 EXPECT_TRUE(snapshot->GetDictionary("parent", &parent)); | 59 EXPECT_TRUE(snapshot->GetDictionary("parent", &parent)); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 std::sort(events.begin(), events.end(), EventPointerCompare); | 255 std::sort(events.begin(), events.end(), EventPointerCompare); |
| 256 | 256 |
| 257 // Three snapshots are traced, one for each URL change. | 257 // Three snapshots are traced, one for each URL change. |
| 258 EXPECT_EQ(3u, events.size()); | 258 EXPECT_EQ(3u, events.size()); |
| 259 EXPECT_EQ(url1.spec(), GetSnapshotURL(events[0])); | 259 EXPECT_EQ(url1.spec(), GetSnapshotURL(events[0])); |
| 260 EXPECT_EQ(url2.spec(), GetSnapshotURL(events[1])); | 260 EXPECT_EQ(url2.spec(), GetSnapshotURL(events[1])); |
| 261 EXPECT_EQ("", GetSnapshotURL(events[2])); | 261 EXPECT_EQ("", GetSnapshotURL(events[2])); |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace content | 264 } // namespace content |
| OLD | NEW |