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 "platform/scheduler/renderer/renderer_scheduler_impl.h" | 5 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 EXPECT_EQ(RendererSchedulerImpl::UseCase::MAIN_THREAD_CUSTOM_INPUT_HANDLING, | 1361 EXPECT_EQ(RendererSchedulerImpl::UseCase::MAIN_THREAD_CUSTOM_INPUT_HANDLING, |
1362 CurrentUseCase()); | 1362 CurrentUseCase()); |
1363 | 1363 |
1364 // Note compositor tasks are prioritized. | 1364 // Note compositor tasks are prioritized. |
1365 EXPECT_THAT(run_order, | 1365 EXPECT_THAT(run_order, |
1366 testing::ElementsAre(std::string("C1"), std::string("C2"), | 1366 testing::ElementsAre(std::string("C1"), std::string("C2"), |
1367 std::string("D1"), std::string("D2"), | 1367 std::string("D1"), std::string("D2"), |
1368 std::string("I1"))); | 1368 std::string("I1"))); |
1369 } | 1369 } |
1370 | 1370 |
1371 TEST_F(RendererSchedulerImplTest, | 1371 TEST_F(RendererSchedulerImplTest, EventForwardedToMainThread_MouseClick) { |
1372 EventForwardedToMainThread_MouseClick) { | |
1373 // A mouse click should be detected as main thread input handling, which means | 1372 // A mouse click should be detected as main thread input handling, which means |
1374 // we won't try to defer expensive tasks because of one. We can, however, | 1373 // we won't try to defer expensive tasks because of one. We can, however, |
1375 // prioritize compositing/input handling. | 1374 // prioritize compositing/input handling. |
1376 std::vector<std::string> run_order; | 1375 std::vector<std::string> run_order; |
1377 PostTestTasks(&run_order, "I1 D1 C1 D2 C2"); | 1376 PostTestTasks(&run_order, "I1 D1 C1 D2 C2"); |
1378 EnableIdleTasks(); | 1377 EnableIdleTasks(); |
1379 | 1378 |
1380 scheduler_->DidHandleInputEventOnCompositorThread( | 1379 scheduler_->DidHandleInputEventOnCompositorThread( |
1381 FakeInputEvent(blink::WebInputEvent::MouseDown, | 1380 FakeInputEvent(blink::WebInputEvent::MouseDown, |
1382 blink::WebInputEvent::LeftButtonDown), | 1381 blink::WebInputEvent::LeftButtonDown), |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2158 base::RetainedRef(idle_task_runner_), &run_count, clock_.get(), | 2157 base::RetainedRef(idle_task_runner_), &run_count, clock_.get(), |
2159 idle_task_runtime, &actual_deadlines)); | 2158 idle_task_runtime, &actual_deadlines)); |
2160 idle_task_runner_->PostIdleTask( | 2159 idle_task_runner_->PostIdleTask( |
2161 FROM_HERE, | 2160 FROM_HERE, |
2162 base::Bind(&WillBeginFrameIdleTask, base::Unretained(scheduler_.get()), | 2161 base::Bind(&WillBeginFrameIdleTask, base::Unretained(scheduler_.get()), |
2163 next_begin_frame_number_++, clock_.get())); | 2162 next_begin_frame_number_++, clock_.get())); |
2164 RunUntilIdle(); | 2163 RunUntilIdle(); |
2165 EXPECT_EQ(4, run_count); | 2164 EXPECT_EQ(4, run_count); |
2166 } | 2165 } |
2167 | 2166 |
2168 | |
2169 TEST_F(RendererSchedulerImplTest, TestLongIdlePeriodInTouchStartPolicy) { | 2167 TEST_F(RendererSchedulerImplTest, TestLongIdlePeriodInTouchStartPolicy) { |
2170 base::TimeTicks deadline_in_task; | 2168 base::TimeTicks deadline_in_task; |
2171 int run_count = 0; | 2169 int run_count = 0; |
2172 | 2170 |
2173 idle_task_runner_->PostIdleTask( | 2171 idle_task_runner_->PostIdleTask( |
2174 FROM_HERE, base::Bind(&IdleTestTask, &run_count, &deadline_in_task)); | 2172 FROM_HERE, base::Bind(&IdleTestTask, &run_count, &deadline_in_task)); |
2175 | 2173 |
2176 // Observation of touchstart should defer the start of the long idle period. | 2174 // Observation of touchstart should defer the start of the long idle period. |
2177 scheduler_->DidHandleInputEventOnCompositorThread( | 2175 scheduler_->DidHandleInputEventOnCompositorThread( |
2178 FakeInputEvent(blink::WebInputEvent::TouchStart), | 2176 FakeInputEvent(blink::WebInputEvent::TouchStart), |
(...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3800 EXPECT_TRUE( | 3798 EXPECT_TRUE( |
3801 scheduler_->MainThreadSeemsUnresponsive(responsiveness_threshold())); | 3799 scheduler_->MainThreadSeemsUnresponsive(responsiveness_threshold())); |
3802 // Once we've dropped the lock, we realize the main thread is responsive. | 3800 // Once we've dropped the lock, we realize the main thread is responsive. |
3803 DropQueueingTimeEstimatorLock(); | 3801 DropQueueingTimeEstimatorLock(); |
3804 EXPECT_FALSE( | 3802 EXPECT_FALSE( |
3805 scheduler_->MainThreadSeemsUnresponsive(responsiveness_threshold())); | 3803 scheduler_->MainThreadSeemsUnresponsive(responsiveness_threshold())); |
3806 } | 3804 } |
3807 | 3805 |
3808 } // namespace scheduler | 3806 } // namespace scheduler |
3809 } // namespace blink | 3807 } // namespace blink |
OLD | NEW |