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

Side by Side Diff: cc/test/scheduler_test_common.cc

Issue 387493002: Fixing and enhancing OrderedSimpleTaskRunner to allow 100% deterministic tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Lots of changes. Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "cc/test/scheduler_test_common.h" 5 #include "cc/test/scheduler_test_common.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 void FakeTimeSourceClient::OnTimerTick() { 11 void FakeTimeSourceClient::OnTimerTick() {
12 tick_called_ = true; 12 tick_called_ = true;
13 } 13 }
14 14
15 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; } 15 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; }
16 16
17 void TestDelayBasedTimeSource::SetNow(base::TimeTicks time) {
18 test_task_runner_->SetNow(time);
19 }
20
21 std::string TestDelayBasedTimeSource::TypeString() const {
22 return "TestDelayBasedTimeSource";
23 }
24
25 base::TimeTicks TestDelayBasedTimeSource::Now() const {
26 return test_task_runner_->Now();
27 }
28
29 base::TimeTicks TestScheduler::Now() const {
30 return test_task_runner_->Now();
31 }
32
33 TestScheduler::TestScheduler(
34 SchedulerClient* client,
35 const SchedulerSettings& scheduler_settings,
36 int layer_tree_host_id,
37 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner)
38 : Scheduler(client,
39 scheduler_settings,
40 layer_tree_host_id,
41 test_task_runner),
42 test_task_runner_(test_task_runner.get()) {
43 if (!settings_.begin_frame_scheduling_enabled) {
44 scoped_refptr<DelayBasedTimeSource> time_source =
45 TestDelayBasedTimeSource::Create(VSyncInterval(), test_task_runner_);
46 synthetic_begin_frame_source_.reset(
47 new SyntheticBeginFrameSource(this, time_source));
48 }
49 }
50
51 void TestScheduler::SetNow(base::TimeTicks time) {
52 test_task_runner_->SetNow(time);
53 }
54
17 } // namespace cc 55 } // namespace cc
OLDNEW
« cc/test/ordered_simple_task_runner.cc ('K') | « cc/test/scheduler_test_common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698