| 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_unittest.h" | 5 #include "base/debug/trace_event_unittest.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <cstdlib> | 8 #include <cstdlib> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 2410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2421 TRACE_EVENT_INSTANT0("callback", "yes", TRACE_EVENT_SCOPE_GLOBAL); | 2421 TRACE_EVENT_INSTANT0("callback", "yes", TRACE_EVENT_SCOPE_GLOBAL); |
| 2422 TraceLog::GetInstance()->SetEventCallbackDisabled(); | 2422 TraceLog::GetInstance()->SetEventCallbackDisabled(); |
| 2423 TRACE_EVENT_INSTANT0("recording", "no", TRACE_EVENT_SCOPE_GLOBAL); | 2423 TRACE_EVENT_INSTANT0("recording", "no", TRACE_EVENT_SCOPE_GLOBAL); |
| 2424 TRACE_EVENT_INSTANT0("callback", "no", TRACE_EVENT_SCOPE_GLOBAL); | 2424 TRACE_EVENT_INSTANT0("callback", "no", TRACE_EVENT_SCOPE_GLOBAL); |
| 2425 | 2425 |
| 2426 DropTracedMetadataRecords(); | 2426 DropTracedMetadataRecords(); |
| 2427 VerifyCallbackAndRecordedEvents(2, 2); | 2427 VerifyCallbackAndRecordedEvents(2, 2); |
| 2428 } | 2428 } |
| 2429 | 2429 |
| 2430 TEST_F(TraceEventCallbackTest, TraceEventCallbackAndRecordingDuration) { | 2430 TEST_F(TraceEventCallbackTest, TraceEventCallbackAndRecordingDuration) { |
| 2431 TraceLog::GetInstance()->SetEventCallbackEnabled(CategoryFilter("*"), | 2431 TraceLog::GetInstance()->SetEventCallbackEnabled( |
| 2432 Callback); | 2432 CategoryFilter("callback"), Callback); |
| 2433 { | 2433 { |
| 2434 TRACE_EVENT0("callback", "duration1"); | 2434 TRACE_EVENT0("callback", "duration1"); |
| 2435 TraceLog::GetInstance()->SetEnabled( | 2435 TraceLog::GetInstance()->SetEnabled( |
| 2436 CategoryFilter("*"), | 2436 CategoryFilter("callback"), |
| 2437 TraceLog::RECORDING_MODE, | 2437 TraceLog::RECORDING_MODE, |
| 2438 TraceOptions()); | 2438 TraceOptions()); |
| 2439 TRACE_EVENT0("callback", "duration2"); | 2439 TRACE_EVENT0("callback", "duration2"); |
| 2440 EndTraceAndFlush(); | 2440 EndTraceAndFlush(); |
| 2441 TRACE_EVENT0("callback", "duration3"); | 2441 TRACE_EVENT0("callback", "duration3"); |
| 2442 } | 2442 } |
| 2443 TraceLog::GetInstance()->SetEventCallbackDisabled(); | 2443 TraceLog::GetInstance()->SetEventCallbackDisabled(); |
| 2444 | 2444 |
| 2445 ASSERT_EQ(6u, collected_events_names_.size()); | 2445 ASSERT_EQ(6u, collected_events_names_.size()); |
| 2446 VerifyCollectedEvent(0, TRACE_EVENT_PHASE_BEGIN, "callback", "duration1"); | 2446 VerifyCollectedEvent(0, TRACE_EVENT_PHASE_BEGIN, "callback", "duration1"); |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3084 EXPECT_EQ(original_option.enable_sampling, new_options.enable_sampling); | 3084 EXPECT_EQ(original_option.enable_sampling, new_options.enable_sampling); |
| 3085 EXPECT_EQ(original_option.enable_systrace, new_options.enable_systrace); | 3085 EXPECT_EQ(original_option.enable_systrace, new_options.enable_systrace); |
| 3086 } | 3086 } |
| 3087 } | 3087 } |
| 3088 } | 3088 } |
| 3089 } | 3089 } |
| 3090 | 3090 |
| 3091 | 3091 |
| 3092 } // namespace debug | 3092 } // namespace debug |
| 3093 } // namespace base | 3093 } // namespace base |
| OLD | NEW |