| 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/test/trace_event_analyzer.h" | 5 #include "base/test/trace_event_analyzer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 void TraceEventAnalyzerTest::BeginTracing() { | 53 void TraceEventAnalyzerTest::BeginTracing() { |
| 54 output_.json_output.clear(); | 54 output_.json_output.clear(); |
| 55 buffer_.Start(); | 55 buffer_.Start(); |
| 56 base::trace_event::TraceLog::GetInstance()->SetEnabled( | 56 base::trace_event::TraceLog::GetInstance()->SetEnabled( |
| 57 base::trace_event::TraceConfig("*", ""), | 57 base::trace_event::TraceConfig("*", ""), |
| 58 base::trace_event::TraceLog::RECORDING_MODE); | 58 base::trace_event::TraceLog::RECORDING_MODE); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void TraceEventAnalyzerTest::EndTracing() { | 61 void TraceEventAnalyzerTest::EndTracing() { |
| 62 base::trace_event::TraceLog::GetInstance()->SetDisabled(); | 62 base::trace_event::TraceLog::GetInstance()->SetDisabled(); |
| 63 base::WaitableEvent flush_complete_event(false, false); | 63 base::WaitableEvent flush_complete_event( |
| 64 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 65 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 64 base::trace_event::TraceLog::GetInstance()->Flush( | 66 base::trace_event::TraceLog::GetInstance()->Flush( |
| 65 base::Bind(&TraceEventAnalyzerTest::OnTraceDataCollected, | 67 base::Bind(&TraceEventAnalyzerTest::OnTraceDataCollected, |
| 66 base::Unretained(this), | 68 base::Unretained(this), |
| 67 base::Unretained(&flush_complete_event))); | 69 base::Unretained(&flush_complete_event))); |
| 68 flush_complete_event.Wait(); | 70 flush_complete_event.Wait(); |
| 69 buffer_.Finish(); | 71 buffer_.Finish(); |
| 70 } | 72 } |
| 71 | 73 |
| 72 } // namespace | 74 } // namespace |
| 73 | 75 |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 std::unique_ptr<base::Value> arg; | 946 std::unique_ptr<base::Value> arg; |
| 945 events[0]->GetArgAsValue("arg", &arg); | 947 events[0]->GetArgAsValue("arg", &arg); |
| 946 base::DictionaryValue* arg_dict; | 948 base::DictionaryValue* arg_dict; |
| 947 EXPECT_TRUE(arg->GetAsDictionary(&arg_dict)); | 949 EXPECT_TRUE(arg->GetAsDictionary(&arg_dict)); |
| 948 std::string property; | 950 std::string property; |
| 949 EXPECT_TRUE(arg_dict->GetString("property", &property)); | 951 EXPECT_TRUE(arg_dict->GetString("property", &property)); |
| 950 EXPECT_EQ("value", property); | 952 EXPECT_EQ("value", property); |
| 951 } | 953 } |
| 952 | 954 |
| 953 } // namespace trace_analyzer | 955 } // namespace trace_analyzer |
| OLD | NEW |