Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(671)

Side by Side Diff: components/scheduler/base/time_domain_unittest.cc

Issue 1741053002: Revert of Fix computation of runtime for throttled tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
48 void AsValueIntoInternal( 43 void AsValueIntoInternal(
49 base::trace_event::TracedValue* state) const override {} 44 base::trace_event::TracedValue* state) const override {}
50 45
51 bool MaybeAdvanceTime() override { return false; } 46 bool MaybeAdvanceTime() override { return false; }
52 const char* GetName() const override { return "Test"; } 47 const char* GetName() const override { return "Test"; }
53 void OnRegisterWithTaskQueueManager( 48 void OnRegisterWithTaskQueueManager(
54 TaskQueueManager* task_queue_manager) override {} 49 TaskQueueManager* task_queue_manager) override {}
55 50
56 MOCK_METHOD2(RequestWakeup, void(base::TimeTicks now, base::TimeDelta delay)); 51 MOCK_METHOD2(RequestWakeup, void(base::TimeTicks now, base::TimeDelta delay));
57 52
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 218
224 TEST_F(TimeDomainWithObserverTest, OnTimeDomainHasDelayedWork) { 219 TEST_F(TimeDomainWithObserverTest, OnTimeDomainHasDelayedWork) {
225 EXPECT_CALL(*observer_, OnTimeDomainHasDelayedWork()); 220 EXPECT_CALL(*observer_, OnTimeDomainHasDelayedWork());
226 EXPECT_CALL(*time_domain_.get(), RequestWakeup(_, _)); 221 EXPECT_CALL(*time_domain_.get(), RequestWakeup(_, _));
227 base::TimeTicks now = time_domain_->Now(); 222 base::TimeTicks now = time_domain_->Now();
228 time_domain_->ScheduleDelayedWork( 223 time_domain_->ScheduleDelayedWork(
229 task_queue_.get(), now + base::TimeDelta::FromMilliseconds(10), now); 224 task_queue_.get(), now + base::TimeDelta::FromMilliseconds(10), now);
230 } 225 }
231 226
232 } // namespace scheduler 227 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/base/time_domain.h ('k') | components/scheduler/base/virtual_time_domain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698