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 3// found in the LICENSE file. 4 5#include "cc/test/scheduler_test_common.h" 6 7#include <string> 8 9#include "base/logging.h" 10 11namespace cc { 12 13void FakeTimeSourceClient::OnTimerTick() { 14 tick_called_ = true; 15} 16 17base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; } 18 19TestDelayBasedTimeSource::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 26base::TimeTicks TestDelayBasedTimeSource::Now() const { 27 return now_src_->Now(); 28} 29 30std::string TestDelayBasedTimeSource::TypeString() const { 31 return "TestDelayBasedTimeSource"; 32} 33 34TestDelayBasedTimeSource::~TestDelayBasedTimeSource() { 35} 36 37TestScheduler::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 58base::TimeTicks TestScheduler::Now() const { 59 return now_src_->Now(); 60} 61 62TestScheduler::~TestScheduler() { 63} 64 65} // namespace cc 66