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

Side by Side Diff: base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc

Issue 1916033002: Revert of [tracing] Add native allocation tracing mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 ->GetContextSnapshot(); 55 ->GetContextSnapshot();
56 56
57 ASSERT_EQ(0u, ctx.backtrace.frame_count); 57 ASSERT_EQ(0u, ctx.backtrace.frame_count);
58 } 58 }
59 59
60 class AllocationContextTrackerTest : public testing::Test { 60 class AllocationContextTrackerTest : public testing::Test {
61 public: 61 public:
62 void SetUp() override { 62 void SetUp() override {
63 TraceConfig config(""); 63 TraceConfig config("");
64 TraceLog::GetInstance()->SetEnabled(config, TraceLog::RECORDING_MODE); 64 TraceLog::GetInstance()->SetEnabled(config, TraceLog::RECORDING_MODE);
65 AllocationContextTracker::SetCaptureMode( 65 AllocationContextTracker::SetCaptureEnabled(true);
66 AllocationContextTracker::CaptureMode::PSEUDO_STACK);
67 } 66 }
68 67
69 void TearDown() override { 68 void TearDown() override {
70 AllocationContextTracker::SetCaptureMode( 69 AllocationContextTracker::SetCaptureEnabled(false);
71 AllocationContextTracker::CaptureMode::DISABLED);
72 TraceLog::GetInstance()->SetDisabled(); 70 TraceLog::GetInstance()->SetDisabled();
73 } 71 }
74 }; 72 };
75 73
76 // Check that |TRACE_EVENT| macros push and pop to the pseudo stack correctly. 74 // Check that |TRACE_EVENT| macros push and pop to the pseudo stack correctly.
77 TEST_F(AllocationContextTrackerTest, PseudoStackScopedTrace) { 75 TEST_F(AllocationContextTrackerTest, PseudoStackScopedTrace) {
78 StackFrame c = StackFrame::FromTraceEventName(kCupcake); 76 StackFrame c = StackFrame::FromTraceEventName(kCupcake);
79 StackFrame d = StackFrame::FromTraceEventName(kDonut); 77 StackFrame d = StackFrame::FromTraceEventName(kDonut);
80 StackFrame e = StackFrame::FromTraceEventName(kEclair); 78 StackFrame e = StackFrame::FromTraceEventName(kEclair);
81 StackFrame f = StackFrame::FromTraceEventName(kFroyo); 79 StackFrame f = StackFrame::FromTraceEventName(kFroyo);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 AllocationContextTracker::GetInstanceForCurrentThread() 287 AllocationContextTracker::GetInstanceForCurrentThread()
290 ->GetContextSnapshot(); 288 ->GetContextSnapshot();
291 const StringPiece kTracingOverhead("tracing_overhead"); 289 const StringPiece kTracingOverhead("tracing_overhead");
292 ASSERT_EQ(kTracingOverhead, 290 ASSERT_EQ(kTracingOverhead,
293 static_cast<const char*>(ctx.backtrace.frames[0].value)); 291 static_cast<const char*>(ctx.backtrace.frames[0].value));
294 ASSERT_EQ(1u, ctx.backtrace.frame_count); 292 ASSERT_EQ(1u, ctx.backtrace.frame_count);
295 } 293 }
296 294
297 } // namespace trace_event 295 } // namespace trace_event
298 } // namespace base 296 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698