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