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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 class TestScheduler : public Scheduler { | 121 class TestScheduler : public Scheduler { |
122 public: | 122 public: |
123 TestScheduler( | 123 TestScheduler( |
124 base::SimpleTestTickClock* now_src, | 124 base::SimpleTestTickClock* now_src, |
125 SchedulerClient* client, | 125 SchedulerClient* client, |
126 const SchedulerSettings& scheduler_settings, | 126 const SchedulerSettings& scheduler_settings, |
127 int layer_tree_host_id, | 127 int layer_tree_host_id, |
128 OrderedSimpleTaskRunner* task_runner, | 128 OrderedSimpleTaskRunner* task_runner, |
129 std::unique_ptr<CompositorTimingHistory> compositor_timing_history); | 129 std::unique_ptr<CompositorTimingHistory> compositor_timing_history); |
130 | 130 |
| 131 // Extra test helper functionality |
| 132 bool IsBeginRetroFrameArgsEmpty() const { |
| 133 return begin_retro_frame_args_.empty(); |
| 134 } |
| 135 |
131 bool SwapThrottled() const { return state_machine_.SwapThrottled(); } | 136 bool SwapThrottled() const { return state_machine_.SwapThrottled(); } |
132 | 137 |
133 bool NeedsBeginMainFrame() const { | 138 bool NeedsBeginMainFrame() const { |
134 return state_machine_.needs_begin_main_frame(); | 139 return state_machine_.needs_begin_main_frame(); |
135 } | 140 } |
136 | 141 |
137 BeginFrameSource& frame_source() { return *begin_frame_source_; } | 142 BeginFrameSource& frame_source() { return *begin_frame_source_; } |
138 | 143 |
139 bool MainThreadMissedLastDeadline() const { | 144 bool MainThreadMissedLastDeadline() const { |
140 return state_machine_.main_thread_missed_last_deadline(); | 145 return state_machine_.main_thread_missed_last_deadline(); |
141 } | 146 } |
142 | 147 |
143 bool begin_frames_expected() const { | 148 bool begin_frames_expected() const { |
144 return begin_frame_source_ && observing_begin_frame_source_; | 149 return begin_frame_source_ && observing_begin_frame_source_; |
145 } | 150 } |
146 | 151 |
147 int current_frame_number() const { | |
148 return state_machine_.current_frame_number(); | |
149 } | |
150 | |
151 ~TestScheduler() override; | 152 ~TestScheduler() override; |
152 | 153 |
153 base::TimeDelta BeginImplFrameInterval() { | 154 base::TimeDelta BeginImplFrameInterval() { |
154 return begin_impl_frame_tracker_.Interval(); | 155 return begin_impl_frame_tracker_.Interval(); |
155 } | 156 } |
156 | 157 |
157 // Note: This setting will be overriden on the next BeginFrame in the | 158 // Note: This setting will be overriden on the next BeginFrame in the |
158 // scheduler. To control the value it gets on the next BeginFrame | 159 // scheduler. To control the value it gets on the next BeginFrame |
159 // Pass in a fake CompositorTimingHistory that indicates BeginMainFrame | 160 // Pass in a fake CompositorTimingHistory that indicates BeginMainFrame |
160 // to Activation is fast. | 161 // to Activation is fast. |
161 void SetCriticalBeginMainFrameToActivateIsFast(bool is_fast) { | 162 void SetCriticalBeginMainFrameToActivateIsFast(bool is_fast) { |
162 state_machine_.SetCriticalBeginMainFrameToActivateIsFast(is_fast); | 163 state_machine_.SetCriticalBeginMainFrameToActivateIsFast(is_fast); |
163 } | 164 } |
164 | 165 |
165 protected: | 166 protected: |
166 // Overridden from Scheduler. | 167 // Overridden from Scheduler. |
167 base::TimeTicks Now() const override; | 168 base::TimeTicks Now() const override; |
168 | 169 |
169 private: | 170 private: |
170 base::SimpleTestTickClock* now_src_; | 171 base::SimpleTestTickClock* now_src_; |
171 | 172 |
172 DISALLOW_COPY_AND_ASSIGN(TestScheduler); | 173 DISALLOW_COPY_AND_ASSIGN(TestScheduler); |
173 }; | 174 }; |
174 | 175 |
175 } // namespace cc | 176 } // namespace cc |
176 | 177 |
177 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ | 178 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ |
OLD | NEW |