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 "platform/scheduler/renderer/idle_time_estimator.h" | 5 #include "platform/scheduler/renderer/idle_time_estimator.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
9 #include "cc/test/ordered_simple_task_runner.h" | 9 #include "cc/test/ordered_simple_task_runner.h" |
10 #include "platform/scheduler/base/task_queue_manager.h" | 10 #include "platform/scheduler/base/task_queue_manager.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 const scoped_refptr<TaskQueue>& compositor_task_runner, | 23 const scoped_refptr<TaskQueue>& compositor_task_runner, |
24 TestTimeSource* test_time_source, | 24 TestTimeSource* test_time_source, |
25 int sample_count, | 25 int sample_count, |
26 double estimation_percentile) | 26 double estimation_percentile) |
27 : IdleTimeEstimator(compositor_task_runner, | 27 : IdleTimeEstimator(compositor_task_runner, |
28 test_time_source, | 28 test_time_source, |
29 sample_count, | 29 sample_count, |
30 estimation_percentile) {} | 30 estimation_percentile) {} |
31 }; | 31 }; |
32 | 32 |
33 class IdleTimeEstimatorTest : public testing::Test { | 33 class IdleTimeEstimatorTest : public ::testing::Test { |
34 public: | 34 public: |
35 IdleTimeEstimatorTest() | 35 IdleTimeEstimatorTest() |
36 : frame_length_(base::TimeDelta::FromMilliseconds(16)) {} | 36 : frame_length_(base::TimeDelta::FromMilliseconds(16)) {} |
37 | 37 |
38 ~IdleTimeEstimatorTest() override {} | 38 ~IdleTimeEstimatorTest() override {} |
39 | 39 |
40 void SetUp() override { | 40 void SetUp() override { |
41 clock_.reset(new base::SimpleTestTickClock()); | 41 clock_.reset(new base::SimpleTestTickClock()); |
42 clock_->Advance(base::TimeDelta::FromMicroseconds(5000)); | 42 clock_->Advance(base::TimeDelta::FromMicroseconds(5000)); |
43 test_time_source_.reset(new TestTimeSource(clock_.get())); | 43 test_time_source_.reset(new TestTimeSource(clock_.get())); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 SimulateFrameWithTwoCompositorTasks(4, 4); | 159 SimulateFrameWithTwoCompositorTasks(4, 4); |
160 estimator_->DidCommitFrameToCompositor(); | 160 estimator_->DidCommitFrameToCompositor(); |
161 estimator_->DidProcessTask(task); | 161 estimator_->DidProcessTask(task); |
162 | 162 |
163 EXPECT_EQ(base::TimeDelta::FromMilliseconds(11), | 163 EXPECT_EQ(base::TimeDelta::FromMilliseconds(11), |
164 estimator_->GetExpectedIdleDuration(frame_length_)); | 164 estimator_->GetExpectedIdleDuration(frame_length_)); |
165 } | 165 } |
166 | 166 |
167 } // namespace scheduler | 167 } // namespace scheduler |
168 } // namespace blink | 168 } // namespace blink |
OLD | NEW |