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 CC_TEST_SCHEDULER_TEST_COMMON_H_ | 5 #ifndef CC_TEST_SCHEDULER_TEST_COMMON_H_ |
6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_ | 6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/delay_based_time_source.h" | 9 #include "cc/delay_based_time_source.h" |
10 #include "cc/frame_rate_controller.h" | 10 #include "cc/frame_rate_controller.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 bool hasPendingTask() const { return m_pendingTask; } | 45 bool hasPendingTask() const { return m_pendingTask; } |
46 void runPendingTask(); | 46 void runPendingTask(); |
47 | 47 |
48 long long pendingDelayMs() const | 48 long long pendingDelayMs() const |
49 { | 49 { |
50 EXPECT_TRUE(hasPendingTask()); | 50 EXPECT_TRUE(hasPendingTask()); |
51 return m_pendingTaskDelay; | 51 return m_pendingTaskDelay; |
52 } | 52 } |
53 | 53 |
54 virtual void postTask(base::Closure cb) OVERRIDE; | 54 virtual void postTask(base::Closure cb) OVERRIDE; |
55 virtual void postDelayedTask(base::Closure cb, long long delay) OVERRIDE; | 55 virtual void postDelayedTask(base::Closure cb, base::TimeDelta delay) OVERRI
DE; |
56 virtual bool belongsToCurrentThread() const OVERRIDE; | 56 virtual bool belongsToCurrentThread() const OVERRIDE; |
57 | 57 |
58 protected: | 58 protected: |
59 scoped_ptr<base::Closure> m_pendingTask; | 59 scoped_ptr<base::Closure> m_pendingTask; |
60 long long m_pendingTaskDelay; | 60 long long m_pendingTaskDelay; |
61 bool m_runPendingTaskOnOverwrite; | 61 bool m_runPendingTaskOnOverwrite; |
62 }; | 62 }; |
63 | 63 |
64 class FakeTimeSource : public cc::TimeSource { | 64 class FakeTimeSource : public cc::TimeSource { |
65 public: | 65 public: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 class FakeFrameRateController : public cc::FrameRateController { | 116 class FakeFrameRateController : public cc::FrameRateController { |
117 public: | 117 public: |
118 FakeFrameRateController(scoped_refptr<cc::TimeSource> timer) : cc::FrameRate
Controller(timer) { } | 118 FakeFrameRateController(scoped_refptr<cc::TimeSource> timer) : cc::FrameRate
Controller(timer) { } |
119 | 119 |
120 int numFramesPending() const { return m_numFramesPending; } | 120 int numFramesPending() const { return m_numFramesPending; } |
121 }; | 121 }; |
122 | 122 |
123 } // namespace cc | 123 } // namespace cc |
124 | 124 |
125 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ | 125 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ |
OLD | NEW |