| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_SCHEDULER_TEST_COMMON_H_ | 5 #ifndef CC_TEST_SCHEDULER_TEST_COMMON_H_ |
| 6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_ | 6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // DelayBasedTimeSourceClient implementation. | 31 // DelayBasedTimeSourceClient implementation. |
| 32 void OnTimerTick() override; | 32 void OnTimerTick() override; |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 bool tick_called_; | 35 bool tick_called_; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 DISALLOW_COPY_AND_ASSIGN(FakeDelayBasedTimeSourceClient); | 38 DISALLOW_COPY_AND_ASSIGN(FakeDelayBasedTimeSourceClient); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 class FakeDelayBasedTimeSource : public DelayBasedTimeSource { | |
| 42 public: | |
| 43 explicit FakeDelayBasedTimeSource(base::SingleThreadTaskRunner* task_runner) | |
| 44 : DelayBasedTimeSource(task_runner) {} | |
| 45 ~FakeDelayBasedTimeSource() override {} | |
| 46 | |
| 47 void SetNow(base::TimeTicks time) { now_ = time; } | |
| 48 base::TimeTicks Now() const override; | |
| 49 | |
| 50 protected: | |
| 51 base::TimeTicks now_; | |
| 52 | |
| 53 private: | |
| 54 DISALLOW_COPY_AND_ASSIGN(FakeDelayBasedTimeSource); | |
| 55 }; | |
| 56 | |
| 57 class TestDelayBasedTimeSource : public DelayBasedTimeSource { | |
| 58 public: | |
| 59 TestDelayBasedTimeSource(base::SimpleTestTickClock* now_src, | |
| 60 OrderedSimpleTaskRunner* task_runner); | |
| 61 ~TestDelayBasedTimeSource() override; | |
| 62 | |
| 63 protected: | |
| 64 // Overridden from DelayBasedTimeSource | |
| 65 base::TimeTicks Now() const override; | |
| 66 std::string TypeString() const override; | |
| 67 | |
| 68 // Not owned. | |
| 69 base::SimpleTestTickClock* now_src_; | |
| 70 | |
| 71 private: | |
| 72 DISALLOW_COPY_AND_ASSIGN(TestDelayBasedTimeSource); | |
| 73 }; | |
| 74 | |
| 75 class FakeCompositorTimingHistory : public CompositorTimingHistory { | 41 class FakeCompositorTimingHistory : public CompositorTimingHistory { |
| 76 public: | 42 public: |
| 77 static std::unique_ptr<FakeCompositorTimingHistory> Create( | 43 static std::unique_ptr<FakeCompositorTimingHistory> Create( |
| 78 bool using_synchronous_renderer_compositor); | 44 bool using_synchronous_renderer_compositor); |
| 79 ~FakeCompositorTimingHistory() override; | 45 ~FakeCompositorTimingHistory() override; |
| 80 | 46 |
| 81 void SetAllEstimatesTo(base::TimeDelta duration); | 47 void SetAllEstimatesTo(base::TimeDelta duration); |
| 82 | 48 |
| 83 void SetBeginMainFrameQueueDurationCriticalEstimate(base::TimeDelta duration); | 49 void SetBeginMainFrameQueueDurationCriticalEstimate(base::TimeDelta duration); |
| 84 void SetBeginMainFrameQueueDurationNotCriticalEstimate( | 50 void SetBeginMainFrameQueueDurationNotCriticalEstimate( |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 136 |
| 171 private: | 137 private: |
| 172 base::SimpleTestTickClock* now_src_; | 138 base::SimpleTestTickClock* now_src_; |
| 173 | 139 |
| 174 DISALLOW_COPY_AND_ASSIGN(TestScheduler); | 140 DISALLOW_COPY_AND_ASSIGN(TestScheduler); |
| 175 }; | 141 }; |
| 176 | 142 |
| 177 } // namespace cc | 143 } // namespace cc |
| 178 | 144 |
| 179 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ | 145 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ |
| OLD | NEW |