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 #include "components/scheduler/renderer/renderer_scheduler_impl.h" | 5 #include "components/scheduler/renderer/renderer_scheduler_impl.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "cc/output/begin_frame_args.h" | 8 #include "cc/output/begin_frame_args.h" |
9 #include "cc/test/ordered_simple_task_runner.h" | 9 #include "cc/test/ordered_simple_task_runner.h" |
10 #include "cc/test/test_now_source.h" | 10 #include "cc/test/test_now_source.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 scheduler_->WillBeginFrame(cc::BeginFrameArgs::Create( | 207 scheduler_->WillBeginFrame(cc::BeginFrameArgs::Create( |
208 BEGINFRAME_FROM_HERE, clock_->Now(), base::TimeTicks(), | 208 BEGINFRAME_FROM_HERE, clock_->Now(), base::TimeTicks(), |
209 base::TimeDelta::FromMilliseconds(1000), cc::BeginFrameArgs::NORMAL)); | 209 base::TimeDelta::FromMilliseconds(1000), cc::BeginFrameArgs::NORMAL)); |
210 scheduler_->DidCommitFrameToCompositor(); | 210 scheduler_->DidCommitFrameToCompositor(); |
211 } | 211 } |
212 | 212 |
213 void EnableIdleTasks() { DoMainFrame(); } | 213 void EnableIdleTasks() { DoMainFrame(); } |
214 | 214 |
215 Policy CurrentPolicy() { return scheduler_->current_policy_; } | 215 Policy CurrentPolicy() { return scheduler_->current_policy_; } |
216 | 216 |
| 217 bool BeginMainFrameOnCriticalPath() { |
| 218 return scheduler_->begin_main_frame_on_critical_path_; |
| 219 } |
| 220 |
217 // Helper for posting several tasks of specific types. |task_descriptor| is a | 221 // Helper for posting several tasks of specific types. |task_descriptor| is a |
218 // string with space delimited task identifiers. The first letter of each | 222 // string with space delimited task identifiers. The first letter of each |
219 // task identifier specifies the task type: | 223 // task identifier specifies the task type: |
220 // - 'D': Default task | 224 // - 'D': Default task |
221 // - 'C': Compositor task | 225 // - 'C': Compositor task |
222 // - 'L': Loading task | 226 // - 'L': Loading task |
223 // - 'I': Idle task | 227 // - 'I': Idle task |
224 // - 'T': Timer task | 228 // - 'T': Timer task |
225 void PostTestTasks(std::vector<std::string>* run_order, | 229 void PostTestTasks(std::vector<std::string>* run_order, |
226 const std::string& task_descriptor) { | 230 const std::string& task_descriptor) { |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 | 1639 |
1636 TEST_F(RendererSchedulerImplTest, MismatchedDidHandleInputEventOnMainThread) { | 1640 TEST_F(RendererSchedulerImplTest, MismatchedDidHandleInputEventOnMainThread) { |
1637 // This should not DCHECK because there was no corresponding compositor side | 1641 // This should not DCHECK because there was no corresponding compositor side |
1638 // call to DidHandleInputEventOnCompositorThread with | 1642 // call to DidHandleInputEventOnCompositorThread with |
1639 // INPUT_EVENT_ACK_STATE_NOT_CONSUMED. There are legitimate reasons for the | 1643 // INPUT_EVENT_ACK_STATE_NOT_CONSUMED. There are legitimate reasons for the |
1640 // compositor to not be there and we don't want to make debugging impossible. | 1644 // compositor to not be there and we don't want to make debugging impossible. |
1641 scheduler_->DidHandleInputEventOnMainThread( | 1645 scheduler_->DidHandleInputEventOnMainThread( |
1642 FakeInputEvent(blink::WebInputEvent::GestureFlingStart)); | 1646 FakeInputEvent(blink::WebInputEvent::GestureFlingStart)); |
1643 } | 1647 } |
1644 | 1648 |
| 1649 TEST_F(RendererSchedulerImplTest, BeginMainFrameOnCriticalPath) { |
| 1650 ASSERT_FALSE(BeginMainFrameOnCriticalPath()); |
| 1651 |
| 1652 cc::BeginFrameArgs begin_frame_args = cc::BeginFrameArgs::Create( |
| 1653 BEGINFRAME_FROM_HERE, clock_->Now(), base::TimeTicks(), |
| 1654 base::TimeDelta::FromMilliseconds(1000), cc::BeginFrameArgs::NORMAL); |
| 1655 scheduler_->WillBeginFrame(begin_frame_args); |
| 1656 ASSERT_TRUE(BeginMainFrameOnCriticalPath()); |
| 1657 |
| 1658 begin_frame_args.on_critical_path = false; |
| 1659 scheduler_->WillBeginFrame(begin_frame_args); |
| 1660 ASSERT_FALSE(BeginMainFrameOnCriticalPath()); |
| 1661 } |
| 1662 |
1645 } // namespace scheduler | 1663 } // namespace scheduler |
OLD | NEW |