Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: base/debug/trace_event_unittest.cc

Issue 402283002: Modify TraceEventTestFixture.TraceBufferVectorReportFull to assert the overflowed_at_ts is between … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 EXPECT_TRUE(trace_full_metadata); 2443 EXPECT_TRUE(trace_full_metadata);
2444 EXPECT_TRUE(trace_full_metadata->GetString("ph", &phase)); 2444 EXPECT_TRUE(trace_full_metadata->GetString("ph", &phase));
2445 EXPECT_EQ("M", phase); 2445 EXPECT_EQ("M", phase);
2446 EXPECT_TRUE(trace_full_metadata->GetDouble( 2446 EXPECT_TRUE(trace_full_metadata->GetDouble(
2447 "args.overflowed_at_ts", &buffer_limit_reached_timestamp)); 2447 "args.overflowed_at_ts", &buffer_limit_reached_timestamp));
2448 EXPECT_DOUBLE_EQ( 2448 EXPECT_DOUBLE_EQ(
2449 static_cast<double>( 2449 static_cast<double>(
2450 trace_log->buffer_limit_reached_timestamp_.ToInternalValue()), 2450 trace_log->buffer_limit_reached_timestamp_.ToInternalValue()),
2451 buffer_limit_reached_timestamp); 2451 buffer_limit_reached_timestamp);
2452 2452
2453 // Test that buffer_limit_reached_timestamp's value is near to the timestamp 2453 // Test that buffer_limit_reached_timestamp's value is between the timestamp
2454 // of the last trace event. 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 // The difference between the two timestamps should be less than 50ms. 2461 EXPECT_LT(last_trace_event_timestamp, buffer_limit_reached_timestamp);
2462 EXPECT_NEAR(last_trace_event_timestamp, buffer_limit_reached_timestamp, 50); 2462 EXPECT_LT(buffer_limit_reached_timestamp,
2463 trace_log->OffsetNow().ToInternalValue());
cpu_(ooo_6.6-7.5) 2014/07/24 22:58:18 I think this should be EXPECT_LE See the failure
2463 } 2464 }
2464 2465
2465 TEST_F(TraceEventTestFixture, TraceBufferRingBufferGetReturnChunk) { 2466 TEST_F(TraceEventTestFixture, TraceBufferRingBufferGetReturnChunk) {
2466 TraceLog::GetInstance()->SetEnabled(CategoryFilter("*"), 2467 TraceLog::GetInstance()->SetEnabled(CategoryFilter("*"),
2467 base::debug::TraceLog::RECORDING_MODE, 2468 base::debug::TraceLog::RECORDING_MODE,
2468 TraceLog::RECORD_CONTINUOUSLY); 2469 TraceLog::RECORD_CONTINUOUSLY);
2469 TraceBuffer* buffer = TraceLog::GetInstance()->trace_buffer(); 2470 TraceBuffer* buffer = TraceLog::GetInstance()->trace_buffer();
2470 size_t capacity = buffer->Capacity(); 2471 size_t capacity = buffer->Capacity();
2471 size_t num_chunks = capacity / TraceBufferChunk::kTraceBufferChunkSize; 2472 size_t num_chunks = capacity / TraceBufferChunk::kTraceBufferChunkSize;
2472 uint32 last_seq = 0; 2473 uint32 last_seq = 0;
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2920 } 2921 }
2921 2922
2922 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { 2923 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) {
2923 const char config[] = "DELAY(test.Delay;16;oneshot)"; 2924 const char config[] = "DELAY(test.Delay;16;oneshot)";
2924 CategoryFilter filter(config); 2925 CategoryFilter filter(config);
2925 EXPECT_EQ(config, filter.ToString()); 2926 EXPECT_EQ(config, filter.ToString());
2926 } 2927 }
2927 2928
2928 } // namespace debug 2929 } // namespace debug
2929 } // namespace base 2930 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698