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/child/idle_helper.h" | 5 #include "components/scheduler/child/idle_helper.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/callback.h" | 9 #include "base/callback.h" |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/test/simple_test_tick_clock.h" | 11 #include "base/test/simple_test_tick_clock.h" |
10 #include "cc/test/ordered_simple_task_runner.h" | 12 #include "cc/test/ordered_simple_task_runner.h" |
11 #include "components/scheduler/base/real_time_domain.h" | 13 #include "components/scheduler/base/real_time_domain.h" |
12 #include "components/scheduler/base/task_queue.h" | 14 #include "components/scheduler/base/task_queue.h" |
13 #include "components/scheduler/base/task_queue_manager.h" | 15 #include "components/scheduler/base/task_queue_manager.h" |
14 #include "components/scheduler/base/test_time_source.h" | 16 #include "components/scheduler/base/test_time_source.h" |
15 #include "components/scheduler/child/scheduler_helper.h" | 17 #include "components/scheduler/child/scheduler_helper.h" |
16 #include "components/scheduler/child/scheduler_tqm_delegate_for_test.h" | 18 #include "components/scheduler/child/scheduler_tqm_delegate_for_test.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void EndIdlePeriodIdleTask(IdleHelper* idle_helper, base::TimeTicks deadline) { | 129 void EndIdlePeriodIdleTask(IdleHelper* idle_helper, base::TimeTicks deadline) { |
128 idle_helper->EndIdlePeriod(); | 130 idle_helper->EndIdlePeriod(); |
129 } | 131 } |
130 | 132 |
131 scoped_refptr<SchedulerTqmDelegate> CreateTaskRunnerDelegate( | 133 scoped_refptr<SchedulerTqmDelegate> CreateTaskRunnerDelegate( |
132 base::MessageLoop* message_loop, | 134 base::MessageLoop* message_loop, |
133 scoped_refptr<cc::OrderedSimpleTaskRunner> mock_task_runner, | 135 scoped_refptr<cc::OrderedSimpleTaskRunner> mock_task_runner, |
134 scoped_ptr<TestTimeSource> test_time_source) { | 136 scoped_ptr<TestTimeSource> test_time_source) { |
135 if (message_loop) | 137 if (message_loop) |
136 return SchedulerTqmDelegateImpl::Create(message_loop, | 138 return SchedulerTqmDelegateImpl::Create(message_loop, |
137 test_time_source.Pass()); | 139 std::move(test_time_source)); |
138 | 140 |
139 return SchedulerTqmDelegateForTest::Create(mock_task_runner, | 141 return SchedulerTqmDelegateForTest::Create(mock_task_runner, |
140 test_time_source.Pass()); | 142 std::move(test_time_source)); |
141 } | 143 } |
142 | 144 |
143 }; // namespace | 145 }; // namespace |
144 | 146 |
145 class IdleHelperForTest : public IdleHelper, public IdleHelper::Delegate { | 147 class IdleHelperForTest : public IdleHelper, public IdleHelper::Delegate { |
146 public: | 148 public: |
147 explicit IdleHelperForTest( | 149 explicit IdleHelperForTest( |
148 SchedulerHelper* scheduler_helper, | 150 SchedulerHelper* scheduler_helper, |
149 base::TimeDelta required_quiescence_duration_before_long_idle_period) | 151 base::TimeDelta required_quiescence_duration_before_long_idle_period) |
150 : IdleHelper(scheduler_helper, | 152 : IdleHelper(scheduler_helper, |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 EXPECT_EQ(0, run_count); | 1141 EXPECT_EQ(0, run_count); |
1140 | 1142 |
1141 default_task_runner_->PostDelayedTask(FROM_HERE, base::Bind(&NullTask), | 1143 default_task_runner_->PostDelayedTask(FROM_HERE, base::Bind(&NullTask), |
1142 more_than_min_deadline_duration); | 1144 more_than_min_deadline_duration); |
1143 idle_helper_->EnableLongIdlePeriod(); | 1145 idle_helper_->EnableLongIdlePeriod(); |
1144 RunUntilIdle(); | 1146 RunUntilIdle(); |
1145 EXPECT_EQ(1, run_count); | 1147 EXPECT_EQ(1, run_count); |
1146 } | 1148 } |
1147 | 1149 |
1148 } // namespace scheduler | 1150 } // namespace scheduler |
OLD | NEW |