OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CC_TEST_TEST_NOW_SOURCE_H_ | 5 #ifndef CC_TEST_TEST_NOW_SOURCE_H_ |
6 #define CC_TEST_TEST_NOW_SOURCE_H_ | 6 #define CC_TEST_TEST_NOW_SOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 void AdvanceNowMicroseconds(int64_t period_in_microseconds); | 30 void AdvanceNowMicroseconds(int64_t period_in_microseconds); |
31 void SetNowMicroseconds(int64_t time_in_microseconds); | 31 void SetNowMicroseconds(int64_t time_in_microseconds); |
32 | 32 |
33 static const base::TimeTicks kAbsoluteMaxNow; | 33 static const base::TimeTicks kAbsoluteMaxNow; |
34 | 34 |
35 // Tracing functions | 35 // Tracing functions |
36 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 36 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
37 void AsValueInto(base::trace_event::TracedValue* state) const; | 37 void AsValueInto(base::trace_event::TracedValue* state) const; |
38 std::string ToString() const; | 38 std::string ToString() const; |
39 | 39 |
| 40 int NumNowCalls() const { return num_now_calls_; } |
| 41 |
40 protected: | 42 protected: |
41 TestNowSource(); | 43 TestNowSource(); |
42 explicit TestNowSource(int64_t initial); | 44 explicit TestNowSource(int64_t initial); |
43 explicit TestNowSource(base::TimeTicks initial); | 45 explicit TestNowSource(base::TimeTicks initial); |
44 | 46 |
45 base::TimeTicks initial_; | 47 base::TimeTicks initial_; |
46 base::TimeTicks now_; | 48 base::TimeTicks now_; |
| 49 mutable int num_now_calls_; |
47 | 50 |
48 private: | 51 private: |
49 friend class base::RefCounted<TestNowSource>; | 52 friend class base::RefCounted<TestNowSource>; |
50 virtual ~TestNowSource(); | 53 virtual ~TestNowSource(); |
51 }; | 54 }; |
52 | 55 |
53 // gtest pretty printing functions | 56 // gtest pretty printing functions |
54 void PrintTo(const scoped_refptr<TestNowSource>& src, ::std::ostream* os); | 57 void PrintTo(const scoped_refptr<TestNowSource>& src, ::std::ostream* os); |
55 ::std::ostream& operator<<(::std::ostream& os, | 58 ::std::ostream& operator<<(::std::ostream& os, |
56 const scoped_refptr<TestNowSource>& src); | 59 const scoped_refptr<TestNowSource>& src); |
57 | 60 |
58 } // namespace cc | 61 } // namespace cc |
59 | 62 |
60 #endif // CC_TEST_TEST_NOW_SOURCE_H_ | 63 #endif // CC_TEST_TEST_NOW_SOURCE_H_ |
OLD | NEW |