Factor out a BluetoothChannelMac base class and a BluetoothRfcommChannelMac subclass.
[chromium-blink-merge.git] / cc / test / scheduler_test_common.h
blob596358a205877ad26517cbcd54182ab602348254
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"
14 namespace cc {
16 class FakeTimeSourceClient : public TimeSourceClient {
17 public:
18 FakeTimeSourceClient() { Reset(); }
19 void Reset() { tick_called_ = false; }
20 bool TickCalled() const { return tick_called_; }
22 // TimeSourceClient implementation.
23 virtual void OnTimerTick() OVERRIDE;
25 protected:
26 bool tick_called_;
29 class FakeDelayBasedTimeSource : public DelayBasedTimeSource {
30 public:
31 static scoped_refptr<FakeDelayBasedTimeSource> Create(
32 base::TimeDelta interval, base::SingleThreadTaskRunner* task_runner) {
33 return make_scoped_refptr(new FakeDelayBasedTimeSource(interval,
34 task_runner));
37 void SetNow(base::TimeTicks time) { now_ = time; }
38 virtual base::TimeTicks Now() const OVERRIDE;
40 protected:
41 FakeDelayBasedTimeSource(base::TimeDelta interval,
42 base::SingleThreadTaskRunner* task_runner)
43 : DelayBasedTimeSource(interval, task_runner) {}
44 virtual ~FakeDelayBasedTimeSource() {}
46 base::TimeTicks now_;
49 } // namespace cc
51 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_