OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "config.h" | 5 #include "config.h" |
6 #include "platform/scheduler/Scheduler.h" | 6 #include "platform/scheduler/Scheduler.h" |
7 | 7 |
8 #include "platform/TestingPlatformSupport.h" | 8 #include "platform/TestingPlatformSupport.h" |
9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
10 #include "public/platform/WebThread.h" | 10 #include "public/platform/WebThread.h" |
11 | 11 |
12 #include <gtest/gtest.h> | 12 #include <gtest/gtest.h> |
13 | 13 |
14 using WebCore::Scheduler; | 14 using blink::Scheduler; |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 class TestMainThread : public blink::WebThread { | 18 class TestMainThread : public blink::WebThread { |
19 public: | 19 public: |
20 // blink::WebThread implementation. | 20 // blink::WebThread implementation. |
21 virtual void postTask(Task* task) OVERRIDE | 21 virtual void postTask(Task* task) OVERRIDE |
22 { | 22 { |
23 m_pendingTasks.append(adoptPtr(task)); | 23 m_pendingTasks.append(adoptPtr(task)); |
24 } | 24 } |
(...skipping 21 matching lines...) Expand all Loading... |
46 void runPendingTasks() | 46 void runPendingTasks() |
47 { | 47 { |
48 while (!m_pendingTasks.isEmpty()) | 48 while (!m_pendingTasks.isEmpty()) |
49 m_pendingTasks.takeFirst()->run(); | 49 m_pendingTasks.takeFirst()->run(); |
50 } | 50 } |
51 | 51 |
52 private: | 52 private: |
53 WTF::Deque<OwnPtr<Task> > m_pendingTasks; | 53 WTF::Deque<OwnPtr<Task> > m_pendingTasks; |
54 }; | 54 }; |
55 | 55 |
56 class SchedulerTestingPlatformSupport : WebCore::TestingPlatformSupport { | 56 class SchedulerTestingPlatformSupport : blink::TestingPlatformSupport { |
57 public: | 57 public: |
58 SchedulerTestingPlatformSupport() | 58 SchedulerTestingPlatformSupport() |
59 : TestingPlatformSupport(TestingPlatformSupport::Config()) | 59 : TestingPlatformSupport(TestingPlatformSupport::Config()) |
60 , m_sharedTimerFunction(nullptr) | 60 , m_sharedTimerFunction(nullptr) |
61 , m_sharedTimerRunning(false) | 61 , m_sharedTimerRunning(false) |
62 , m_sharedTimerFireInterval(0) | 62 , m_sharedTimerFireInterval(0) |
63 { | 63 { |
64 } | 64 } |
65 | 65 |
66 // blink::Platform implementation. | 66 // blink::Platform implementation. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 EXPECT_EQ(1, s_sharedTimerTickCount); | 185 EXPECT_EQ(1, s_sharedTimerTickCount); |
186 | 186 |
187 m_scheduler->stopSharedTimer(); | 187 m_scheduler->stopSharedTimer(); |
188 EXPECT_FALSE(m_platformSupport.sharedTimerRunning()); | 188 EXPECT_FALSE(m_platformSupport.sharedTimerRunning()); |
189 | 189 |
190 m_scheduler->setSharedTimerFiredFunction(nullptr); | 190 m_scheduler->setSharedTimerFiredFunction(nullptr); |
191 EXPECT_FALSE(m_platformSupport.sharedTimerRunning()); | 191 EXPECT_FALSE(m_platformSupport.sharedTimerRunning()); |
192 } | 192 } |
193 | 193 |
194 } // namespace | 194 } // namespace |
OLD | NEW |