OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/pending_task.h" | 10 #include "base/pending_task.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 ->GetContextSnapshot(); | 54 ->GetContextSnapshot(); |
55 | 55 |
56 ASSERT_EQ(0u, ctx.backtrace.frame_count); | 56 ASSERT_EQ(0u, ctx.backtrace.frame_count); |
57 } | 57 } |
58 | 58 |
59 class AllocationContextTrackerTest : public testing::Test { | 59 class AllocationContextTrackerTest : public testing::Test { |
60 public: | 60 public: |
61 void SetUp() override { | 61 void SetUp() override { |
62 TraceConfig config(""); | 62 TraceConfig config(""); |
63 TraceLog::GetInstance()->SetEnabled(config, TraceLog::RECORDING_MODE); | 63 TraceLog::GetInstance()->SetEnabled(config, TraceLog::RECORDING_MODE); |
64 AllocationContextTracker::SetCaptureEnabled(true); | 64 AllocationContextTracker::SetCaptureMode( |
| 65 AllocationContextTracker::CaptureMode::PSEUDO_STACK); |
65 } | 66 } |
66 | 67 |
67 void TearDown() override { | 68 void TearDown() override { |
68 AllocationContextTracker::SetCaptureEnabled(false); | 69 AllocationContextTracker::SetCaptureMode( |
| 70 AllocationContextTracker::CaptureMode::DISABLED); |
69 TraceLog::GetInstance()->SetDisabled(); | 71 TraceLog::GetInstance()->SetDisabled(); |
70 } | 72 } |
71 }; | 73 }; |
72 | 74 |
73 // Check that |TRACE_EVENT| macros push and pop to the pseudo stack correctly. | 75 // Check that |TRACE_EVENT| macros push and pop to the pseudo stack correctly. |
74 TEST_F(AllocationContextTrackerTest, PseudoStackScopedTrace) { | 76 TEST_F(AllocationContextTrackerTest, PseudoStackScopedTrace) { |
75 StackFrame c = StackFrame::FromTraceEventName(kCupcake); | 77 StackFrame c = StackFrame::FromTraceEventName(kCupcake); |
76 StackFrame d = StackFrame::FromTraceEventName(kDonut); | 78 StackFrame d = StackFrame::FromTraceEventName(kDonut); |
77 StackFrame e = StackFrame::FromTraceEventName(kEclair); | 79 StackFrame e = StackFrame::FromTraceEventName(kEclair); |
78 StackFrame f = StackFrame::FromTraceEventName(kFroyo); | 80 StackFrame f = StackFrame::FromTraceEventName(kFroyo); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 275 |
274 // Type should be nullptr without task event. | 276 // Type should be nullptr without task event. |
275 AllocationContext ctx = | 277 AllocationContext ctx = |
276 AllocationContextTracker::GetInstanceForCurrentThread() | 278 AllocationContextTracker::GetInstanceForCurrentThread() |
277 ->GetContextSnapshot(); | 279 ->GetContextSnapshot(); |
278 ASSERT_FALSE(ctx.type_name); | 280 ASSERT_FALSE(ctx.type_name); |
279 } | 281 } |
280 | 282 |
281 } // namespace trace_event | 283 } // namespace trace_event |
282 } // namespace base | 284 } // namespace base |
OLD | NEW |