| 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 17 matching lines...) Expand all Loading... |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 class IdleTimeEstimatorTest : public testing::Test { | 30 class IdleTimeEstimatorTest : public testing::Test { |
| 31 public: | 31 public: |
| 32 IdleTimeEstimatorTest() | 32 IdleTimeEstimatorTest() |
| 33 : frame_length_(base::TimeDelta::FromMilliseconds(16)) {} | 33 : frame_length_(base::TimeDelta::FromMilliseconds(16)) {} |
| 34 | 34 |
| 35 ~IdleTimeEstimatorTest() override {} | 35 ~IdleTimeEstimatorTest() override {} |
| 36 | 36 |
| 37 void SetUp() override { | 37 void SetUp() override { |
| 38 clock_.reset(new base::SimpleTestTickClock()); | 38 clock_.reset(new base::SimpleTestTickClock( |
| 39 clock_->Advance(base::TimeDelta::FromMicroseconds(5000)); | 39 base::TimeTicks() + base::TimeDelta::FromMicroseconds(5000))); |
| 40 test_time_source_.reset(new TestTimeSource(clock_.get())); | 40 test_time_source_.reset(new TestTimeSource(clock_.get())); |
| 41 mock_task_runner_ = make_scoped_refptr( | 41 mock_task_runner_ = make_scoped_refptr( |
| 42 new cc::OrderedSimpleTaskRunner(clock_.get(), false)); | 42 new cc::OrderedSimpleTaskRunner(clock_.get(), false)); |
| 43 main_task_runner_ = SchedulerTqmDelegateForTest::Create( | 43 main_task_runner_ = SchedulerTqmDelegateForTest::Create( |
| 44 mock_task_runner_, make_scoped_ptr(new TestTimeSource(clock_.get()))); | 44 mock_task_runner_, make_scoped_ptr(new TestTimeSource(clock_.get()))); |
| 45 manager_ = make_scoped_ptr(new TaskQueueManager( | 45 manager_ = make_scoped_ptr(new TaskQueueManager( |
| 46 main_task_runner_, "test.scheduler", "test.scheduler", | 46 main_task_runner_, "test.scheduler", "test.scheduler", |
| 47 "test.scheduler.debug")); | 47 "test.scheduler.debug")); |
| 48 compositor_task_runner_ = | 48 compositor_task_runner_ = |
| 49 manager_->NewTaskQueue(TaskQueue::Spec("compositor_tq")); | 49 manager_->NewTaskQueue(TaskQueue::Spec("compositor_tq")); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 SimulateFrameWithTwoCompositorTasks(4, 4); | 157 SimulateFrameWithTwoCompositorTasks(4, 4); |
| 158 estimator_->DidCommitFrameToCompositor(); | 158 estimator_->DidCommitFrameToCompositor(); |
| 159 estimator_->DidProcessTask(task); | 159 estimator_->DidProcessTask(task); |
| 160 | 160 |
| 161 EXPECT_EQ(base::TimeDelta::FromMilliseconds(11), | 161 EXPECT_EQ(base::TimeDelta::FromMilliseconds(11), |
| 162 estimator_->GetExpectedIdleDuration(frame_length_)); | 162 estimator_->GetExpectedIdleDuration(frame_length_)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 | 165 |
| 166 } // namespace scheduler | 166 } // namespace scheduler |
| OLD | NEW |