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

Unified Diff: base/trace_event/trace_event_unittest.cc

Issue 2504753002: tracing: Introduce API for composite IDs (Closed)
Patch Set: Slightly more efficient implementation Created 4 years, 1 month 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 81d043ac3945d3582b0a99c22f4adb22d1bd8a21..d72c574dff03b01d786cf89220ba8631a5d80ec0 100644
--- a/base/trace_event/trace_event_unittest.cc
+++ b/base/trace_event/trace_event_unittest.cc
@@ -524,6 +524,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_COMPOSITE(0x2000, 0x3000));
TRACE_EVENT_ASYNC_BEGIN0("all", "async default process scope", 0x1000);
TRACE_EVENT_ASYNC_BEGIN0("all", "async local id", TRACE_ID_LOCAL(0x2000));
@@ -1044,6 +1046,29 @@ 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);
+
+ EXPECT_FALSE(item->HasKey("args.linked_id.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