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

Unified Diff: base/trace_event/trace_event_unittest.cc

Issue 2504753002: tracing: Introduce API for composite IDs (Closed)
Patch Set: comments Created 3 years, 11 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: base/trace_event/trace_event_unittest.cc
diff --git a/base/trace_event/trace_event_unittest.cc b/base/trace_event/trace_event_unittest.cc
index c22f660b43c183af60f21e055ffa975b11ee0f9b..13b9d415a67e1310037f040c3a19ba5129e8f55e 100644
--- a/base/trace_event/trace_event_unittest.cc
+++ b/base/trace_event/trace_event_unittest.cc
@@ -528,6 +528,8 @@ void TraceWithAllMacroVariants(WaitableEvent* task_complete_event) {
TRACE_ID_LOCAL(0x2000));
TRACE_LINK_IDS("all", "TRACE_LINK_IDS to a global ID", 0x1000,
TRACE_ID_GLOBAL(0x2000));
+ TRACE_LINK_IDS("all", "TRACE_LINK_IDS to a composite ID", 0x1000,
+ TRACE_ID_WITH_SCOPE("scope 1", 0x2000, 0x3000));
TRACE_EVENT_ASYNC_BEGIN0("all", "async default process scope", 0x1000);
TRACE_EVENT_ASYNC_BEGIN0("all", "async local id", TRACE_ID_LOCAL(0x2000));
@@ -1048,6 +1050,31 @@ void ValidateAllTraceMacrosCreatedData(const ListValue& trace_parsed) {
EXPECT_EQ("0x2000", id2);
}
+ EXPECT_FIND_("TRACE_LINK_IDS to a composite ID");
+ {
+ std::string ph;
+ EXPECT_TRUE((item && item->GetString("ph", &ph)));
+ EXPECT_EQ("=", ph);
+
+ EXPECT_FALSE(item->HasKey("scope"));
+ std::string id1;
+ EXPECT_TRUE(item->GetString("id", &id1));
+ EXPECT_EQ("0x1000", id1);
+
+ std::string scope;
+ EXPECT_TRUE(item->GetString("args.linked_id.scope", &scope));
+ EXPECT_EQ("scope 1", scope);
+ const base::ListValue* id2 = nullptr;
+ EXPECT_TRUE(item->GetList("args.linked_id.id", &id2));
+ EXPECT_EQ(static_cast<size_t>(2), id2->GetSize());
+ std::string part1;
+ EXPECT_TRUE(id2->GetString(0, &part1));
+ EXPECT_EQ("0x2000", part1);
+ std::string part2;
+ EXPECT_TRUE(id2->GetString(1, &part2));
+ EXPECT_EQ("0x3000", part2);
+ }
+
EXPECT_FIND_("async default process scope");
{
std::string ph;
« base/trace_event/trace_event_impl.cc ('K') | « base/trace_event/trace_event_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698