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

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

Issue 1956333002: Change the base class of BlameContext into AsyncEnabledStateObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ThreadSafeObserver
Patch Set: Add note on thread safety for Enter() and Leave() 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/trace_event/blame_context.h" 5 #include "base/trace_event/blame_context.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 buffer->AddFragment(json->data()); 66 buffer->AddFragment(json->data());
67 if (!has_more_events) 67 if (!has_more_events)
68 quit_closure.Run(); 68 quit_closure.Run();
69 } 69 }
70 70
71 class BlameContextTest : public testing::Test { 71 class BlameContextTest : public testing::Test {
72 public: 72 public:
73 void StartTracing(); 73 void StartTracing();
74 void StopTracing(); 74 void StopTracing();
75 std::unique_ptr<trace_analyzer::TraceAnalyzer> CreateTraceAnalyzer(); 75 std::unique_ptr<trace_analyzer::TraceAnalyzer> CreateTraceAnalyzer();
76 protected:
77 MessageLoop loop_;
76 }; 78 };
77 79
78 void BlameContextTest::StartTracing() { 80 void BlameContextTest::StartTracing() {
79 trace_event::TraceLog::GetInstance()->SetEnabled( 81 trace_event::TraceLog::GetInstance()->SetEnabled(
80 trace_event::TraceConfig("*"), trace_event::TraceLog::RECORDING_MODE); 82 trace_event::TraceConfig("*"), trace_event::TraceLog::RECORDING_MODE);
81 } 83 }
82 84
83 void BlameContextTest::StopTracing() { 85 void BlameContextTest::StopTracing() {
84 trace_event::TraceLog::GetInstance()->SetDisabled(); 86 trace_event::TraceLog::GetInstance()->SetDisabled();
85 } 87 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 "}"; 213 "}";
212 214
213 std::string snapshot_json; 215 std::string snapshot_json;
214 JSONWriter::Write(*events[2]->GetKnownArgAsValue("snapshot"), &snapshot_json); 216 JSONWriter::Write(*events[2]->GetKnownArgAsValue("snapshot"), &snapshot_json);
215 EXPECT_EQ(kExpectedSnapshotJson, snapshot_json); 217 EXPECT_EQ(kExpectedSnapshotJson, snapshot_json);
216 } 218 }
217 219
218 } // namepace 220 } // namepace
219 } // namespace trace_event 221 } // namespace trace_event
220 } // namespace base 222 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/blame_context.cc ('k') | components/scheduler/base/task_queue_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698