cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / cc / test / scheduler_test_common.h
blob4236fff7a538a5cdf7c38f852f04fe63cd742d10
1 // Copyright 2011 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.
5 #ifndef CC_TEST_SCHEDULER_TEST_COMMON_H_
6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/time.h"
11 #include "cc/scheduler/delay_based_time_source.h"
12 #include "cc/scheduler/frame_rate_controller.h"
13 #include "testing/gtest/include/gtest/gtest.h"
15 namespace cc {
17 class FakeTimeSourceClient : public cc::TimeSourceClient {
18 public:
19 FakeTimeSourceClient() { Reset(); }
20 void Reset() { tick_called_ = false; }
21 bool TickCalled() const { return tick_called_; }
23 // TimeSourceClient implementation.
24 virtual void OnTimerTick() OVERRIDE;
26 protected:
27 bool tick_called_;
30 class FakeDelayBasedTimeSource : public cc::DelayBasedTimeSource {
31 public:
32 static scoped_refptr<FakeDelayBasedTimeSource> Create(
33 base::TimeDelta interval, base::SingleThreadTaskRunner* task_runner) {
34 return make_scoped_refptr(new FakeDelayBasedTimeSource(interval,
35 task_runner));
38 void SetNow(base::TimeTicks time) { now_ = time; }
39 virtual base::TimeTicks Now() const OVERRIDE;
41 protected:
42 FakeDelayBasedTimeSource(base::TimeDelta interval,
43 base::SingleThreadTaskRunner* task_runner)
44 : DelayBasedTimeSource(interval, task_runner) {}
45 virtual ~FakeDelayBasedTimeSource() {}
47 base::TimeTicks now_;
50 class FakeFrameRateController : public cc::FrameRateController {
51 public:
52 explicit FakeFrameRateController(scoped_refptr<cc::TimeSource> timer)
53 : cc::FrameRateController(timer) {}
55 int NumFramesPending() const { return num_frames_pending_; }
58 } // namespace cc
60 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_