OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/debug/trace_event.h" | 5 #include "base/debug/trace_event.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 const char* value); | 51 const char* value); |
52 bool FindMatchingValue(const char* key, | 52 bool FindMatchingValue(const char* key, |
53 const char* value); | 53 const char* value); |
54 bool FindNonMatchingValue(const char* key, | 54 bool FindNonMatchingValue(const char* key, |
55 const char* value); | 55 const char* value); |
56 void Clear() { | 56 void Clear() { |
57 trace_parsed_.Clear(); | 57 trace_parsed_.Clear(); |
58 json_output_.json_output.clear(); | 58 json_output_.json_output.clear(); |
59 } | 59 } |
60 | 60 |
61 virtual void SetUp() { | 61 virtual void SetUp() OVERRIDE { |
62 old_thread_name_ = PlatformThread::GetName(); | 62 old_thread_name_ = PlatformThread::GetName(); |
63 } | 63 } |
64 virtual void TearDown() { | 64 virtual void TearDown() OVERRIDE { |
65 if (TraceLog::GetInstance()) | 65 if (TraceLog::GetInstance()) |
66 EXPECT_FALSE(TraceLog::GetInstance()->IsEnabled()); | 66 EXPECT_FALSE(TraceLog::GetInstance()->IsEnabled()); |
67 PlatformThread::SetName(old_thread_name_ ? old_thread_name_ : ""); | 67 PlatformThread::SetName(old_thread_name_ ? old_thread_name_ : ""); |
68 } | 68 } |
69 | 69 |
70 const char* old_thread_name_; | 70 const char* old_thread_name_; |
71 ListValue trace_parsed_; | 71 ListValue trace_parsed_; |
72 base::debug::TraceResultBuffer trace_buffer_; | 72 base::debug::TraceResultBuffer trace_buffer_; |
73 base::debug::TraceResultBuffer::SimpleOutput json_output_; | 73 base::debug::TraceResultBuffer::SimpleOutput json_output_; |
74 | 74 |
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 Clear(); | 1365 Clear(); |
1366 | 1366 |
1367 trace_buffer_.Start(); | 1367 trace_buffer_.Start(); |
1368 trace_buffer_.AddFragment("bla1,bla2,bla3,bla4"); | 1368 trace_buffer_.AddFragment("bla1,bla2,bla3,bla4"); |
1369 trace_buffer_.Finish(); | 1369 trace_buffer_.Finish(); |
1370 EXPECT_STREQ(json_output_.json_output.c_str(), "[bla1,bla2,bla3,bla4]"); | 1370 EXPECT_STREQ(json_output_.json_output.c_str(), "[bla1,bla2,bla3,bla4]"); |
1371 } | 1371 } |
1372 | 1372 |
1373 } // namespace debug | 1373 } // namespace debug |
1374 } // namespace base | 1374 } // namespace base |
OLD | NEW |