| 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 20 matching lines...) Expand all Loading... |
| 80 | 80 |
| 81 virtual void setClient(cc::CCTimeSourceClient* client) OVERRIDE; | 81 virtual void setClient(cc::CCTimeSourceClient* client) OVERRIDE; |
| 82 virtual void setActive(bool b) OVERRIDE; | 82 virtual void setActive(bool b) OVERRIDE; |
| 83 virtual bool active() const OVERRIDE; | 83 virtual bool active() const OVERRIDE; |
| 84 virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelt
a interval) OVERRIDE { } | 84 virtual void setTimebaseAndInterval(base::TimeTicks timebase, base::TimeDelt
a interval) OVERRIDE { } |
| 85 virtual base::TimeTicks lastTickTime() OVERRIDE; | 85 virtual base::TimeTicks lastTickTime() OVERRIDE; |
| 86 virtual base::TimeTicks nextTickTime() OVERRIDE; | 86 virtual base::TimeTicks nextTickTime() OVERRIDE; |
| 87 | 87 |
| 88 void tick() | 88 void tick() |
| 89 { | 89 { |
| 90 ASSERT(m_active); | 90 ASSERT_TRUE(m_active); |
| 91 if (m_client) | 91 if (m_client) |
| 92 m_client->onTimerTick(); | 92 m_client->onTimerTick(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void setNextTickTime(base::TimeTicks nextTickTime) { m_nextTickTime = nextTi
ckTime; } | 95 void setNextTickTime(base::TimeTicks nextTickTime) { m_nextTickTime = nextTi
ckTime; } |
| 96 | 96 |
| 97 protected: | 97 protected: |
| 98 bool m_active; | 98 bool m_active; |
| 99 base::TimeTicks m_nextTickTime; | 99 base::TimeTicks m_nextTickTime; |
| 100 cc::CCTimeSourceClient* m_client; | 100 cc::CCTimeSourceClient* m_client; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 122 class FakeCCFrameRateController : public cc::CCFrameRateController { | 122 class FakeCCFrameRateController : public cc::CCFrameRateController { |
| 123 public: | 123 public: |
| 124 FakeCCFrameRateController(PassRefPtr<cc::CCTimeSource> timer) : cc::CCFrameR
ateController(timer) { } | 124 FakeCCFrameRateController(PassRefPtr<cc::CCTimeSource> timer) : cc::CCFrameR
ateController(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 |