| 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 "content/renderer/scheduler/renderer_scheduler_impl.h" | 5 #include "content/renderer/scheduler/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 "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 EnableIdleTasks(); // Must start a new idle period before idle task runs. | 307 EnableIdleTasks(); // Must start a new idle period before idle task runs. |
| 308 RunUntilIdle(); | 308 RunUntilIdle(); |
| 309 // Execution of default task queue task should trigger execution of idle task. | 309 // Execution of default task queue task should trigger execution of idle task. |
| 310 EXPECT_EQ(2, run_count); | 310 EXPECT_EQ(2, run_count); |
| 311 } | 311 } |
| 312 | 312 |
| 313 TEST_F(RendererSchedulerImplTest, TestPostIdleTaskAfterWakeupWhileAwake) { | 313 TEST_F(RendererSchedulerImplTest, TestPostIdleTaskAfterWakeupWhileAwake) { |
| 314 base::TimeTicks deadline_in_task; | 314 base::TimeTicks deadline_in_task; |
| 315 int run_count = 0; | 315 int run_count = 0; |
| 316 | 316 |
| 317 default_task_runner_->PostTask(FROM_HERE, base::Bind(&NullTask)); | |
| 318 idle_task_runner_->PostIdleTaskAfterWakeup( | 317 idle_task_runner_->PostIdleTaskAfterWakeup( |
| 319 FROM_HERE, base::Bind(&IdleTestTask, &run_count, &deadline_in_task)); | 318 FROM_HERE, base::Bind(&IdleTestTask, &run_count, &deadline_in_task)); |
| 319 default_task_runner_->PostTask(FROM_HERE, base::Bind(&NullTask)); |
| 320 | 320 |
| 321 RunUntilIdle(); | 321 RunUntilIdle(); |
| 322 EnableIdleTasks(); // Must start a new idle period before idle task runs. | 322 EnableIdleTasks(); // Must start a new idle period before idle task runs. |
| 323 RunUntilIdle(); | 323 RunUntilIdle(); |
| 324 // Should run as the scheduler was already awakened by the normal task. | 324 // Should run as the scheduler was already awakened by the normal task. |
| 325 EXPECT_EQ(1, run_count); | 325 EXPECT_EQ(1, run_count); |
| 326 } | 326 } |
| 327 | 327 |
| 328 TEST_F(RendererSchedulerImplTest, TestPostIdleTaskWakesAfterWakeupIdleTask) { | 328 TEST_F(RendererSchedulerImplTest, TestPostIdleTaskWakesAfterWakeupIdleTask) { |
| 329 base::TimeTicks deadline_in_task; | 329 base::TimeTicks deadline_in_task; |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 EXPECT_EQ(Policy::COMPOSITOR_PRIORITY, CurrentPolicy()); | 1000 EXPECT_EQ(Policy::COMPOSITOR_PRIORITY, CurrentPolicy()); |
| 1001 | 1001 |
| 1002 // Process the input event with a new BeginMainFrame. | 1002 // Process the input event with a new BeginMainFrame. |
| 1003 DoMainFrame(); | 1003 DoMainFrame(); |
| 1004 clock_->AdvanceNow(2 * priority_escalation_after_input_duration()); | 1004 clock_->AdvanceNow(2 * priority_escalation_after_input_duration()); |
| 1005 RunUntilIdle(); | 1005 RunUntilIdle(); |
| 1006 EXPECT_EQ(Policy::NORMAL, CurrentPolicy()); | 1006 EXPECT_EQ(Policy::NORMAL, CurrentPolicy()); |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 } // namespace content | 1009 } // namespace content |
| OLD | NEW |