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

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

Issue 1837013003: [tracing] Add support for profiling trace events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_trace
Patch Set: nits. Created 4 years, 8 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/trace_event/heap_profiler_allocation_context.h" 10 #include "base/trace_event/heap_profiler_allocation_context.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 ->GetContextSnapshot(); 53 ->GetContextSnapshot();
54 54
55 for (StackFrame frame : ctx.backtrace.frames) 55 for (StackFrame frame : ctx.backtrace.frames)
56 ASSERT_EQ(nullptr, frame); 56 ASSERT_EQ(nullptr, frame);
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 AllocationContextTracker::SetCaptureEnabled(true);
63 TraceLog::GetInstance()->SetEnabled(config, TraceLog::RECORDING_MODE); 64 TraceLog::GetInstance()->SetEnabled(config, TraceLog::RECORDING_MODE);
64 AllocationContextTracker::SetCaptureEnabled(true);
65 } 65 }
66 66
67 void TearDown() override { 67 void TearDown() override {
68 AllocationContextTracker::SetCaptureEnabled(false); 68 AllocationContextTracker::SetCaptureEnabled(false);
69 TraceLog::GetInstance()->SetDisabled(); 69 TraceLog::GetInstance()->SetDisabled();
70 } 70 }
71 }; 71 };
72 72
73 // Check that |TRACE_EVENT| macros push and pop to the pseudo stack correctly. 73 // Check that |TRACE_EVENT| macros push and pop to the pseudo stack correctly.
74 // Also check that |GetContextSnapshot| fills the backtrace with null pointers 74 // Also check that |GetContextSnapshot| fills the backtrace with null pointers
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 AllocationContext ctx = 224 AllocationContext ctx =
225 AllocationContextTracker::GetInstanceForCurrentThread() 225 AllocationContextTracker::GetInstanceForCurrentThread()
226 ->GetContextSnapshot(); 226 ->GetContextSnapshot();
227 ASSERT_EQ(kCupcake, ctx.backtrace.frames[0]); 227 ASSERT_EQ(kCupcake, ctx.backtrace.frames[0]);
228 ASSERT_EQ(kFroyo, ctx.backtrace.frames[11]); 228 ASSERT_EQ(kFroyo, ctx.backtrace.frames[11]);
229 } 229 }
230 } 230 }
231 231
232 } // namespace trace_event 232 } // namespace trace_event
233 } // namespace base 233 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698