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

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: Fixes for Brian's comments. Created 6 years, 3 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
« no previous file with comments | « cc/test/scheduler_test_common.h ('k') | cc/test/test_now_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 10
9 namespace cc { 11 namespace cc {
10 12
11 void FakeTimeSourceClient::OnTimerTick() { 13 void FakeTimeSourceClient::OnTimerTick() {
12 tick_called_ = true; 14 tick_called_ = true;
13 } 15 }
14 16
15 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; } 17 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; }
16 18
19 TestDelayBasedTimeSource::TestDelayBasedTimeSource(
20 scoped_refptr<TestNowSource> now_src,
21 base::TimeDelta interval,
22 OrderedSimpleTaskRunner* task_runner)
23 : DelayBasedTimeSource(interval, task_runner), now_src_(now_src) {
24 }
25
26 base::TimeTicks TestDelayBasedTimeSource::Now() const {
27 return now_src_->Now();
28 }
29
30 std::string TestDelayBasedTimeSource::TypeString() const {
31 return "TestDelayBasedTimeSource";
32 }
33
34 TestDelayBasedTimeSource::~TestDelayBasedTimeSource() {
35 }
36
37 TestScheduler::TestScheduler(
38 scoped_refptr<TestNowSource> now_src,
39 SchedulerClient* client,
40 const SchedulerSettings& scheduler_settings,
41 int layer_tree_host_id,
42 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner)
43 : Scheduler(client,
44 scheduler_settings,
45 layer_tree_host_id,
46 test_task_runner),
47 now_src_(now_src),
48 test_task_runner_(test_task_runner.get()) {
49 if (!settings_.begin_frame_scheduling_enabled) {
50 scoped_refptr<DelayBasedTimeSource> time_source =
51 TestDelayBasedTimeSource::Create(
52 now_src, VSyncInterval(), test_task_runner_);
53 synthetic_begin_frame_source_.reset(
54 new SyntheticBeginFrameSource(this, time_source));
55 }
56 }
57
58 base::TimeTicks TestScheduler::Now() const {
59 return now_src_->Now();
60 }
61
62 TestScheduler::~TestScheduler() {
63 }
64
17 } // namespace cc 65 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/scheduler_test_common.h ('k') | cc/test/test_now_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698