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

Unified Diff: base/debug/trace_event_unittest.cc

Issue 7778033: Add trace code to track all posted tasks in message_loop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed file/line merge from Location Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/debug/trace_event.cc ('k') | base/location.h » ('j') | base/location.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event_unittest.cc
diff --git a/base/debug/trace_event_unittest.cc b/base/debug/trace_event_unittest.cc
index a5c889f5608f4f7758174ac835a3af64e9beb60b..f04ee7746f9e5e68ad3ef4efe24571cb41c28ab3 100644
--- a/base/debug/trace_event_unittest.cc
+++ b/base/debug/trace_event_unittest.cc
@@ -58,9 +58,11 @@ class TraceEventTestFixture : public testing::Test {
private:
// We want our singleton torn down after each test.
ShadowingAtExitManager at_exit_manager_;
+ Lock lock_;
};
void TraceEventTestFixture::ManualTestSetUp() {
+ TraceLog::DeleteForTesting();
TraceLog::Resurrect();
TraceLog* tracelog = TraceLog::GetInstance();
ASSERT_TRUE(tracelog);
@@ -72,6 +74,7 @@ void TraceEventTestFixture::ManualTestSetUp() {
void TraceEventTestFixture::OnTraceDataCollected(
scoped_refptr<TraceLog::RefCountedString> json_events_str) {
+ AutoLock lock(lock_);
trace_string_ += json_events_str->data;
scoped_ptr<Value> root;
@@ -682,9 +685,9 @@ TEST_F(TraceEventTestFixture, DataCapturedOnThread) {
FROM_HERE, NewRunnableFunction(&TraceWithAllMacroVariants,
jar (doing other things) 2011/09/29 23:47:05 nit: Please run lint on these files. Indentation
jbates 2011/09/30 17:56:05 Done.
&task_complete_event));
task_complete_event.Wait();
+ thread.Stop();
TraceLog::GetInstance()->SetEnabled(false);
- thread.Stop();
ValidateAllTraceMacrosCreatedData(trace_parsed_, trace_string_);
}
@@ -710,14 +713,14 @@ TEST_F(TraceEventTestFixture, DataCapturedManyThreads) {
task_complete_events[i]->Wait();
}
- TraceLog::GetInstance()->SetEnabled(false);
-
for (int i = 0; i < num_threads; i++) {
threads[i]->Stop();
delete threads[i];
delete task_complete_events[i];
}
+ TraceLog::GetInstance()->SetEnabled(false);
+
ValidateInstantEventPresentOnEveryThread(trace_parsed_, trace_string_,
num_threads, num_events);
}
@@ -753,13 +756,14 @@ TEST_F(TraceEventTestFixture, ThreadNames) {
}
// Shut things down.
- TraceLog::GetInstance()->SetEnabled(false);
for (int i = 0; i < num_threads; i++) {
threads[i]->Stop();
delete threads[i];
delete task_complete_events[i];
}
+ TraceLog::GetInstance()->SetEnabled(false);
+
std::string tmp;
int tmp_int;
DictionaryValue* item;
« no previous file with comments | « base/debug/trace_event.cc ('k') | base/location.h » ('j') | base/location.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698