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" |
| 11 #include "base/threading/platform_thread.h" |
11 #include <gtest/gtest.h> | 12 #include <gtest/gtest.h> |
12 #include <wtf/OwnPtr.h> | 13 #include <wtf/OwnPtr.h> |
13 | 14 |
14 namespace WebKitTests { | 15 namespace WebKitTests { |
15 | 16 |
16 class FakeCCTimeSourceClient : public WebCore::CCTimeSourceClient { | 17 class FakeCCTimeSourceClient : public WebCore::CCTimeSourceClient { |
17 public: | 18 public: |
18 FakeCCTimeSourceClient() { reset(); } | 19 FakeCCTimeSourceClient() { reset(); } |
19 void reset() { m_tickCalled = false; } | 20 void reset() { m_tickCalled = false; } |
20 bool tickCalled() const { return m_tickCalled; } | 21 bool tickCalled() const { return m_tickCalled; } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 virtual void postTask(PassOwnPtr<Task>) { ASSERT_NOT_REACHED(); } | 58 virtual void postTask(PassOwnPtr<Task>) { ASSERT_NOT_REACHED(); } |
58 virtual void postDelayedTask(PassOwnPtr<Task> task, long long delay) | 59 virtual void postDelayedTask(PassOwnPtr<Task> task, long long delay) |
59 { | 60 { |
60 if (m_runPendingTaskOnOverwrite && hasPendingTask()) | 61 if (m_runPendingTaskOnOverwrite && hasPendingTask()) |
61 runPendingTask(); | 62 runPendingTask(); |
62 | 63 |
63 EXPECT_TRUE(!hasPendingTask()); | 64 EXPECT_TRUE(!hasPendingTask()); |
64 m_pendingTask = task; | 65 m_pendingTask = task; |
65 m_pendingTaskDelay = delay; | 66 m_pendingTaskDelay = delay; |
66 } | 67 } |
67 virtual WTF::ThreadIdentifier threadID() const { return 0; } | 68 virtual base::PlatformThreadId threadID() const { return 0; } |
68 | 69 |
69 protected: | 70 protected: |
70 OwnPtr<Task> m_pendingTask; | 71 OwnPtr<Task> m_pendingTask; |
71 long long m_pendingTaskDelay; | 72 long long m_pendingTaskDelay; |
72 bool m_runPendingTaskOnOverwrite; | 73 bool m_runPendingTaskOnOverwrite; |
73 }; | 74 }; |
74 | 75 |
75 class FakeCCTimeSource : public WebCore::CCTimeSource { | 76 class FakeCCTimeSource : public WebCore::CCTimeSource { |
76 public: | 77 public: |
77 FakeCCTimeSource() | 78 FakeCCTimeSource() |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 class FakeCCFrameRateController : public WebCore::CCFrameRateController { | 125 class FakeCCFrameRateController : public WebCore::CCFrameRateController { |
125 public: | 126 public: |
126 FakeCCFrameRateController(PassRefPtr<WebCore::CCTimeSource> timer) : WebCore
::CCFrameRateController(timer) { } | 127 FakeCCFrameRateController(PassRefPtr<WebCore::CCTimeSource> timer) : WebCore
::CCFrameRateController(timer) { } |
127 | 128 |
128 int numFramesPending() const { return m_numFramesPending; } | 129 int numFramesPending() const { return m_numFramesPending; } |
129 }; | 130 }; |
130 | 131 |
131 } | 132 } |
132 | 133 |
133 #endif // CCSchedulerTestCommon_h | 134 #endif // CCSchedulerTestCommon_h |
OLD | NEW |