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 "testing/gtest/include/gtest/gtest.h"
16 class FakeTimeSourceClient
: public TimeSourceClient
{
18 FakeTimeSourceClient() { Reset(); }
19 void Reset() { tick_called_
= false; }
20 bool TickCalled() const { return tick_called_
; }
22 // TimeSourceClient implementation.
23 virtual void OnTimerTick() OVERRIDE
;
29 class FakeDelayBasedTimeSource
: public DelayBasedTimeSource
{
31 static scoped_refptr
<FakeDelayBasedTimeSource
> Create(
32 base::TimeDelta interval
, base::SingleThreadTaskRunner
* task_runner
) {
33 return make_scoped_refptr(new FakeDelayBasedTimeSource(interval
,
37 void SetNow(base::TimeTicks time
) { now_
= time
; }
38 virtual base::TimeTicks
Now() const OVERRIDE
;
41 FakeDelayBasedTimeSource(base::TimeDelta interval
,
42 base::SingleThreadTaskRunner
* task_runner
)
43 : DelayBasedTimeSource(interval
, task_runner
) {}
44 virtual ~FakeDelayBasedTimeSource() {}
51 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_