OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/idle_time_estimator.h" | 5 #include "components/scheduler/renderer/idle_time_estimator.h" |
6 | 6 |
7 #include "base/test/simple_test_tick_clock.h" | 7 #include "base/test/simple_test_tick_clock.h" |
8 #include "cc/test/ordered_simple_task_runner.h" | 8 #include "cc/test/ordered_simple_task_runner.h" |
9 #include "components/scheduler/base/task_queue_manager.h" | 9 #include "components/scheduler/base/task_queue_manager.h" |
10 #include "components/scheduler/base/test_time_source.h" | 10 #include "components/scheduler/base/test_time_source.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 | 137 |
138 TEST_F(IdleTimeEstimatorTest, Estimation_MultipleTasks) { | 138 TEST_F(IdleTimeEstimatorTest, Estimation_MultipleTasks) { |
139 SimulateFrameWithTwoCompositorTasks(1, 4); | 139 SimulateFrameWithTwoCompositorTasks(1, 4); |
140 SimulateFrameWithTwoCompositorTasks(1, 4); | 140 SimulateFrameWithTwoCompositorTasks(1, 4); |
141 | 141 |
142 EXPECT_EQ(base::TimeDelta::FromMilliseconds(11), | 142 EXPECT_EQ(base::TimeDelta::FromMilliseconds(11), |
143 estimator_->GetExpectedIdleDuration(frame_length_)); | 143 estimator_->GetExpectedIdleDuration(frame_length_)); |
144 } | 144 } |
145 | 145 |
| 146 TEST_F(IdleTimeEstimatorTest, IgnoresNestedTasks) { |
| 147 SimulateFrameWithOneCompositorTask(5); |
| 148 SimulateFrameWithOneCompositorTask(5); |
| 149 |
| 150 base::PendingTask task(FROM_HERE, base::Closure()); |
| 151 estimator_->WillProcessTask(task); |
| 152 SimulateFrameWithTwoCompositorTasks(4, 4); |
| 153 SimulateFrameWithTwoCompositorTasks(4, 4); |
| 154 SimulateFrameWithTwoCompositorTasks(4, 4); |
| 155 SimulateFrameWithTwoCompositorTasks(4, 4); |
| 156 estimator_->DidCommitFrameToCompositor(); |
| 157 estimator_->DidProcessTask(task); |
| 158 |
| 159 EXPECT_EQ(base::TimeDelta::FromMilliseconds(11), |
| 160 estimator_->GetExpectedIdleDuration(frame_length_)); |
| 161 } |
| 162 |
| 163 |
146 } // namespace scheduler | 164 } // namespace scheduler |
OLD | NEW |