OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CCSchedulerTestCommon_h | 5 #ifndef CCSchedulerTestCommon_h |
6 #define CCSchedulerTestCommon_h | 6 #define CCSchedulerTestCommon_h |
7 | 7 |
8 #include "CCDelayBasedTimeSource.h" | 8 #include "CCDelayBasedTimeSource.h" |
9 #include "CCFrameRateController.h" | 9 #include "CCFrameRateController.h" |
10 #include "CCThread.h" | 10 #include "CCThread.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 void runPendingTaskOnOverwrite(bool enable) | 41 void runPendingTaskOnOverwrite(bool enable) |
42 { | 42 { |
43 m_runPendingTaskOnOverwrite = enable; | 43 m_runPendingTaskOnOverwrite = enable; |
44 } | 44 } |
45 | 45 |
46 bool hasPendingTask() const { return m_pendingTask; } | 46 bool hasPendingTask() const { return m_pendingTask; } |
47 void runPendingTask() | 47 void runPendingTask() |
48 { | 48 { |
49 ASSERT(m_pendingTask); | 49 ASSERT_TRUE(m_pendingTask); |
50 OwnPtr<Task> task = m_pendingTask.release(); | 50 OwnPtr<Task> task = m_pendingTask.release(); |
51 task->performTask(); | 51 task->performTask(); |
52 } | 52 } |
53 | 53 |
54 long long pendingDelayMs() const | 54 long long pendingDelayMs() const |
55 { | 55 { |
56 EXPECT_TRUE(hasPendingTask()); | 56 EXPECT_TRUE(hasPendingTask()); |
57 return m_pendingTaskDelay; | 57 return m_pendingTaskDelay; |
58 } | 58 } |
59 | 59 |
(...skipping 17 matching lines...) Expand all Loading... |
77 | 77 |
78 virtual void setClient(cc::CCTimeSourceClient* client) OVERRIDE; | 78 virtual void setClient(cc::CCTimeSourceClient* client) OVERRIDE; |
79 virtual void setActive(bool b) OVERRIDE; | 79 virtual void setActive(bool b) OVERRIDE; |
80 virtual bool active() const OVERRIDE; | 80 virtual bool active() const OVERRIDE; |
81 virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelt
a interval) OVERRIDE { } | 81 virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelt
a interval) OVERRIDE { } |
82 virtual base::TimeTicks lastTickTime() OVERRIDE; | 82 virtual base::TimeTicks lastTickTime() OVERRIDE; |
83 virtual base::TimeTicks nextTickTime() OVERRIDE; | 83 virtual base::TimeTicks nextTickTime() OVERRIDE; |
84 | 84 |
85 void tick() | 85 void tick() |
86 { | 86 { |
87 ASSERT(m_active); | 87 ASSERT_TRUE(m_active); |
88 if (m_client) | 88 if (m_client) |
89 m_client->onTimerTick(); | 89 m_client->onTimerTick(); |
90 } | 90 } |
91 | 91 |
92 void setNextTickTime(base::TimeTicks nextTickTime) { m_nextTickTime = nextTi
ckTime; } | 92 void setNextTickTime(base::TimeTicks nextTickTime) { m_nextTickTime = nextTi
ckTime; } |
93 | 93 |
94 protected: | 94 protected: |
95 virtual ~FakeCCTimeSource() { } | 95 virtual ~FakeCCTimeSource() { } |
96 | 96 |
97 bool m_active; | 97 bool m_active; |
(...skipping 24 matching lines...) Expand all Loading... |
122 class FakeCCFrameRateController : public cc::CCFrameRateController { | 122 class FakeCCFrameRateController : public cc::CCFrameRateController { |
123 public: | 123 public: |
124 FakeCCFrameRateController(scoped_refptr<cc::CCTimeSource> timer) : cc::CCFra
meRateController(timer) { } | 124 FakeCCFrameRateController(scoped_refptr<cc::CCTimeSource> timer) : cc::CCFra
meRateController(timer) { } |
125 | 125 |
126 int numFramesPending() const { return m_numFramesPending; } | 126 int numFramesPending() const { return m_numFramesPending; } |
127 }; | 127 }; |
128 | 128 |
129 } | 129 } |
130 | 130 |
131 #endif // CCSchedulerTestCommon_h | 131 #endif // CCSchedulerTestCommon_h |
OLD | NEW |