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/base/time_domain.h" | 5 #include "components/scheduler/base/time_domain.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.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 "components/scheduler/base/task_queue_impl.h" | 10 #include "components/scheduler/base/task_queue_impl.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 using TimeDomain::NextScheduledTaskQueue; | 33 using TimeDomain::NextScheduledTaskQueue; |
34 using TimeDomain::ScheduleDelayedWork; | 34 using TimeDomain::ScheduleDelayedWork; |
35 using TimeDomain::UnregisterQueue; | 35 using TimeDomain::UnregisterQueue; |
36 using TimeDomain::UpdateWorkQueues; | 36 using TimeDomain::UpdateWorkQueues; |
37 using TimeDomain::RegisterAsUpdatableTaskQueue; | 37 using TimeDomain::RegisterAsUpdatableTaskQueue; |
38 | 38 |
39 // TimeSource implementation: | 39 // TimeSource implementation: |
40 LazyNow CreateLazyNow() const override { return LazyNow(now_); } | 40 LazyNow CreateLazyNow() const override { return LazyNow(now_); } |
41 base::TimeTicks Now() const override { return now_; } | 41 base::TimeTicks Now() const override { return now_; } |
42 | 42 |
| 43 base::TimeTicks ComputeDelayedRunTime(base::TimeTicks time_domain_now, |
| 44 base::TimeDelta delay) const override { |
| 45 return time_domain_now + delay; |
| 46 } |
| 47 |
43 void AsValueIntoInternal( | 48 void AsValueIntoInternal( |
44 base::trace_event::TracedValue* state) const override {} | 49 base::trace_event::TracedValue* state) const override {} |
45 | 50 |
46 bool MaybeAdvanceTime() override { return false; } | 51 bool MaybeAdvanceTime() override { return false; } |
47 const char* GetName() const override { return "Test"; } | 52 const char* GetName() const override { return "Test"; } |
48 void OnRegisterWithTaskQueueManager( | 53 void OnRegisterWithTaskQueueManager( |
49 TaskQueueManager* task_queue_manager) override {} | 54 TaskQueueManager* task_queue_manager) override {} |
50 | 55 |
51 MOCK_METHOD2(RequestWakeup, void(base::TimeTicks now, base::TimeDelta delay)); | 56 MOCK_METHOD2(RequestWakeup, void(base::TimeTicks now, base::TimeDelta delay)); |
52 | 57 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 223 |
219 TEST_F(TimeDomainWithObserverTest, OnTimeDomainHasDelayedWork) { | 224 TEST_F(TimeDomainWithObserverTest, OnTimeDomainHasDelayedWork) { |
220 EXPECT_CALL(*observer_, OnTimeDomainHasDelayedWork()); | 225 EXPECT_CALL(*observer_, OnTimeDomainHasDelayedWork()); |
221 EXPECT_CALL(*time_domain_.get(), RequestWakeup(_, _)); | 226 EXPECT_CALL(*time_domain_.get(), RequestWakeup(_, _)); |
222 base::TimeTicks now = time_domain_->Now(); | 227 base::TimeTicks now = time_domain_->Now(); |
223 time_domain_->ScheduleDelayedWork( | 228 time_domain_->ScheduleDelayedWork( |
224 task_queue_.get(), now + base::TimeDelta::FromMilliseconds(10), now); | 229 task_queue_.get(), now + base::TimeDelta::FromMilliseconds(10), now); |
225 } | 230 } |
226 | 231 |
227 } // namespace scheduler | 232 } // namespace scheduler |
OLD | NEW |