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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 void TraceEventTestFixture::OnTraceDataCollected( | 93 void TraceEventTestFixture::OnTraceDataCollected( |
94 const scoped_refptr<base::RefCountedString>& events_str) { | 94 const scoped_refptr<base::RefCountedString>& events_str) { |
95 AutoLock lock(lock_); | 95 AutoLock lock(lock_); |
96 json_output_.json_output.clear(); | 96 json_output_.json_output.clear(); |
97 trace_buffer_.Start(); | 97 trace_buffer_.Start(); |
98 trace_buffer_.AddFragment(events_str->data()); | 98 trace_buffer_.AddFragment(events_str->data()); |
99 trace_buffer_.Finish(); | 99 trace_buffer_.Finish(); |
100 | 100 |
101 scoped_ptr<Value> root; | 101 scoped_ptr<Value> root; |
102 root.reset(base::JSONReader::Read(json_output_.json_output, false)); | 102 root.reset(base::JSONReader::Read(json_output_.json_output)); |
103 | 103 |
104 if (!root.get()) { | 104 if (!root.get()) { |
105 LOG(ERROR) << json_output_.json_output; | 105 LOG(ERROR) << json_output_.json_output; |
106 } | 106 } |
107 | 107 |
108 ListValue* root_list = NULL; | 108 ListValue* root_list = NULL; |
109 ASSERT_TRUE(root.get()); | 109 ASSERT_TRUE(root.get()); |
110 ASSERT_TRUE(root->GetAsList(&root_list)); | 110 ASSERT_TRUE(root->GetAsList(&root_list)); |
111 | 111 |
112 // Move items into our aggregate collection | 112 // Move items into our aggregate collection |
(...skipping 1252 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 |