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 "base/time.h" |
9 #include "cc/base/thread.h" | 10 #include "cc/base/thread.h" |
10 #include "cc/delay_based_time_source.h" | 11 #include "cc/delay_based_time_source.h" |
11 #include "cc/frame_rate_controller.h" | 12 #include "cc/frame_rate_controller.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 | 14 |
14 namespace cc { | 15 namespace cc { |
15 | 16 |
16 class FakeTimeSourceClient : public cc::TimeSourceClient { | 17 class FakeTimeSourceClient : public cc::TimeSourceClient { |
17 public: | 18 public: |
18 FakeTimeSourceClient() { reset(); } | 19 FakeTimeSourceClient() { reset(); } |
(...skipping 26 matching lines...) Expand all Loading... |
45 bool hasPendingTask() const { return m_pendingTask; } | 46 bool hasPendingTask() const { return m_pendingTask; } |
46 void runPendingTask(); | 47 void runPendingTask(); |
47 | 48 |
48 long long pendingDelayMs() const | 49 long long pendingDelayMs() const |
49 { | 50 { |
50 EXPECT_TRUE(hasPendingTask()); | 51 EXPECT_TRUE(hasPendingTask()); |
51 return m_pendingTaskDelay; | 52 return m_pendingTaskDelay; |
52 } | 53 } |
53 | 54 |
54 virtual void PostTask(base::Closure cb) OVERRIDE; | 55 virtual void PostTask(base::Closure cb) OVERRIDE; |
55 virtual void PostDelayedTask(base::Closure cb, long long delay_ms) OVERRIDE; | 56 virtual void PostDelayedTask(base::Closure cb, base::TimeDelta delay) |
| 57 OVERRIDE; |
56 virtual bool BelongsToCurrentThread() const OVERRIDE; | 58 virtual bool BelongsToCurrentThread() const OVERRIDE; |
57 | 59 |
58 protected: | 60 protected: |
59 scoped_ptr<base::Closure> m_pendingTask; | 61 scoped_ptr<base::Closure> m_pendingTask; |
60 long long m_pendingTaskDelay; | 62 long long m_pendingTaskDelay; |
61 bool m_runPendingTaskOnOverwrite; | 63 bool m_runPendingTaskOnOverwrite; |
62 }; | 64 }; |
63 | 65 |
64 class FakeTimeSource : public cc::TimeSource { | 66 class FakeTimeSource : public cc::TimeSource { |
65 public: | 67 public: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 class FakeFrameRateController : public cc::FrameRateController { | 118 class FakeFrameRateController : public cc::FrameRateController { |
117 public: | 119 public: |
118 FakeFrameRateController(scoped_refptr<cc::TimeSource> timer) : cc::FrameRate
Controller(timer) { } | 120 FakeFrameRateController(scoped_refptr<cc::TimeSource> timer) : cc::FrameRate
Controller(timer) { } |
119 | 121 |
120 int numFramesPending() const { return m_numFramesPending; } | 122 int numFramesPending() const { return m_numFramesPending; } |
121 }; | 123 }; |
122 | 124 |
123 } // namespace cc | 125 } // namespace cc |
124 | 126 |
125 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ | 127 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ |
OLD | NEW |