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 2440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2451 buffer_limit_reached_timestamp); | 2451 buffer_limit_reached_timestamp); |
2452 | 2452 |
2453 // Test that buffer_limit_reached_timestamp's value is between the timestamp | 2453 // Test that buffer_limit_reached_timestamp's value is between the timestamp |
2454 // of the last trace event and current time. | 2454 // of the last trace event and current time. |
2455 DropTracedMetadataRecords(); | 2455 DropTracedMetadataRecords(); |
2456 const DictionaryValue* last_trace_event = NULL; | 2456 const DictionaryValue* last_trace_event = NULL; |
2457 double last_trace_event_timestamp = 0; | 2457 double last_trace_event_timestamp = 0; |
2458 EXPECT_TRUE(trace_parsed_.GetDictionary(trace_parsed_.GetSize() - 1, | 2458 EXPECT_TRUE(trace_parsed_.GetDictionary(trace_parsed_.GetSize() - 1, |
2459 &last_trace_event)); | 2459 &last_trace_event)); |
2460 EXPECT_TRUE(last_trace_event->GetDouble("ts", &last_trace_event_timestamp)); | 2460 EXPECT_TRUE(last_trace_event->GetDouble("ts", &last_trace_event_timestamp)); |
2461 EXPECT_LT(last_trace_event_timestamp, buffer_limit_reached_timestamp); | 2461 EXPECT_LE(last_trace_event_timestamp, buffer_limit_reached_timestamp); |
2462 EXPECT_LT(buffer_limit_reached_timestamp, | 2462 EXPECT_LE(buffer_limit_reached_timestamp, |
2463 trace_log->OffsetNow().ToInternalValue()); | 2463 trace_log->OffsetNow().ToInternalValue()); |
2464 } | 2464 } |
2465 | 2465 |
2466 TEST_F(TraceEventTestFixture, TraceBufferRingBufferGetReturnChunk) { | 2466 TEST_F(TraceEventTestFixture, TraceBufferRingBufferGetReturnChunk) { |
2467 TraceLog::GetInstance()->SetEnabled(CategoryFilter("*"), | 2467 TraceLog::GetInstance()->SetEnabled(CategoryFilter("*"), |
2468 base::debug::TraceLog::RECORDING_MODE, | 2468 base::debug::TraceLog::RECORDING_MODE, |
2469 TraceLog::RECORD_CONTINUOUSLY); | 2469 TraceLog::RECORD_CONTINUOUSLY); |
2470 TraceBuffer* buffer = TraceLog::GetInstance()->trace_buffer(); | 2470 TraceBuffer* buffer = TraceLog::GetInstance()->trace_buffer(); |
2471 size_t capacity = buffer->Capacity(); | 2471 size_t capacity = buffer->Capacity(); |
2472 size_t num_chunks = capacity / TraceBufferChunk::kTraceBufferChunkSize; | 2472 size_t num_chunks = capacity / TraceBufferChunk::kTraceBufferChunkSize; |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2921 } | 2921 } |
2922 | 2922 |
2923 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { | 2923 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { |
2924 const char config[] = "DELAY(test.Delay;16;oneshot)"; | 2924 const char config[] = "DELAY(test.Delay;16;oneshot)"; |
2925 CategoryFilter filter(config); | 2925 CategoryFilter filter(config); |
2926 EXPECT_EQ(config, filter.ToString()); | 2926 EXPECT_EQ(config, filter.ToString()); |
2927 } | 2927 } |
2928 | 2928 |
2929 } // namespace debug | 2929 } // namespace debug |
2930 } // namespace base | 2930 } // namespace base |
OLD | NEW |