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

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

Issue 98953002: Configure synthetic delays through TraceLog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only use category=value syntax for delays. Created 7 years 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 | Annotate | Revision Log
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 <cstdlib> 7 #include <cstdlib>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/debug/trace_event_synthetic_delay.h"
12 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
13 #include "base/json/json_writer.h" 14 #include "base/json/json_writer.h"
14 #include "base/memory/ref_counted_memory.h" 15 #include "base/memory/ref_counted_memory.h"
15 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
17 #include "base/process/process_handle.h" 18 #include "base/process/process_handle.h"
18 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
19 #include "base/synchronization/waitable_event.h" 20 #include "base/synchronization/waitable_event.h"
20 #include "base/threading/platform_thread.h" 21 #include "base/threading/platform_thread.h"
21 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
(...skipping 2553 matching lines...) Expand 10 before | Expand all | Expand 10 after
2575 const DictionaryValue* item; 2576 const DictionaryValue* item;
2576 EXPECT_TRUE(trace_parsed_.GetDictionary(i, &item)); 2577 EXPECT_TRUE(trace_parsed_.GetDictionary(i, &item));
2577 double timestamp; 2578 double timestamp;
2578 EXPECT_TRUE(item->GetDouble("ts", &timestamp)); 2579 EXPECT_TRUE(item->GetDouble("ts", &timestamp));
2579 EXPECT_GE(timestamp, last_timestamp); 2580 EXPECT_GE(timestamp, last_timestamp);
2580 EXPECT_LE(timestamp, end_time); 2581 EXPECT_LE(timestamp, end_time);
2581 last_timestamp = timestamp; 2582 last_timestamp = timestamp;
2582 } 2583 }
2583 } 2584 }
2584 2585
2586 TEST_F(TraceEventTestFixture, ConfigureSyntheticDelays) {
2587 BeginSpecificTrace("test.Delay=0.05");
2588
2589 base::TimeTicks start = base::TimeTicks::Now();
2590 {
2591 TRACE_EVENT_SYNTHETIC_DELAY("test.Delay");
2592 }
2593 base::TimeDelta duration = base::TimeTicks::Now() - start;
2594 EXPECT_GE(duration.InMilliseconds(), 50);
2595
2596 EndTraceAndFlush();
2597 }
2598
2585 } // namespace debug 2599 } // namespace debug
2586 } // namespace base 2600 } // namespace base
OLDNEW
« base/debug/trace_event_impl.cc ('K') | « base/debug/trace_event_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698