Index: base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc |
diff --git a/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc b/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc |
index f423a74a8e94848dd9e3676b5f8d94f6c58577b6..de19ea25b863b269b6659d74da2b9f1c96cfd1a5 100644 |
--- a/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc |
+++ b/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc |
@@ -251,7 +251,7 @@ TEST_F(AllocationContextTrackerTest, BacktraceTakesTop) { |
} |
} |
-TEST_F(AllocationContextTrackerTest, TrackTaskContext) { |
+TEST_F(AllocationContextTrackerTest, TrackCategoryName) { |
const char kContext1[] = "context1"; |
const char kContext2[] = "context2"; |
{ |
@@ -270,6 +270,22 @@ TEST_F(AllocationContextTrackerTest, TrackTaskContext) { |
ASSERT_EQ(kContext2, ctx2.type_name); |
} |
+ { |
+ // Type should be category name of the last seen trace event. |
+ TRACE_EVENT0("Testing", kCupcake); |
+ AllocationContext ctx1 = |
+ AllocationContextTracker::GetInstanceForCurrentThread() |
+ ->GetContextSnapshot(); |
+ ASSERT_EQ("Testing", std::string(ctx1.type_name)); |
+ |
+ TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("Testing"), kCupcake); |
+ AllocationContext ctx2 = |
+ AllocationContextTracker::GetInstanceForCurrentThread() |
+ ->GetContextSnapshot(); |
+ ASSERT_EQ(TRACE_DISABLED_BY_DEFAULT("Testing"), |
+ std::string(ctx2.type_name)); |
+ } |
+ |
// Type should be nullptr without task event. |
AllocationContext ctx = |
AllocationContextTracker::GetInstanceForCurrentThread() |