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 a39700e4fff4171d6701883d83d6a8ef98a85cdd..ed037049001ef7463c6211c931a0795c74457d79 100644 |
--- a/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc |
+++ b/base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc |
@@ -8,6 +8,7 @@ |
#include "base/memory/ref_counted.h" |
#include "base/pending_task.h" |
+#include "base/trace_event/heap_profiler.h" |
#include "base/trace_event/heap_profiler_allocation_context.h" |
#include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
#include "base/trace_event/trace_event.h" |
@@ -278,5 +279,18 @@ TEST_F(AllocationContextTrackerTest, TrackTaskContext) { |
ASSERT_FALSE(ctx.type_name); |
} |
+TEST_F(AllocationContextTrackerTest, IgnoreAllocationTest) { |
+ TRACE_EVENT0("Testing", kCupcake); |
+ TRACE_EVENT0("Testing", kDonut); |
+ HEAP_PROFILER_SCOPED_IGNORE; |
+ AllocationContext ctx = |
+ AllocationContextTracker::GetInstanceForCurrentThread() |
+ ->GetContextSnapshot(); |
+ const StringPiece kTracingOverhead("tracing_overhead"); |
+ ASSERT_EQ(kTracingOverhead, |
+ static_cast<const char*>(ctx.backtrace.frames[0].value)); |
+ ASSERT_EQ(1u, ctx.backtrace.frame_count); |
+} |
+ |
} // namespace trace_event |
} // namespace base |