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 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCScheduler.h" | 7 #include "CCScheduler.h" |
8 | 8 |
9 #include "CCSchedulerTestCommon.h" | 9 #include "cc/dcheck.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "CCSchedulerTestCommon.h" |
12 #include <wtf/OwnPtr.h> | 13 #include <wtf/OwnPtr.h> |
13 | 14 |
14 using namespace cc; | 15 using namespace cc; |
15 using namespace WebKitTests; | 16 using namespace WebKitTests; |
16 using namespace WTF; | 17 using namespace WTF; |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 class FakeCCSchedulerClient : public CCSchedulerClient { | 21 class FakeCCSchedulerClient : public CCSchedulerClient { |
21 public: | 22 public: |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossi
ble() OVERRIDE | 217 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossi
ble() OVERRIDE |
217 { | 218 { |
218 // Only setNeedsRedraw the first time this is called | 219 // Only setNeedsRedraw the first time this is called |
219 if (!m_numDraws) | 220 if (!m_numDraws) |
220 m_scheduler->setNeedsRedraw(); | 221 m_scheduler->setNeedsRedraw(); |
221 return FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible(); | 222 return FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible(); |
222 } | 223 } |
223 | 224 |
224 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced(
) OVERRIDE | 225 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced(
) OVERRIDE |
225 { | 226 { |
226 ASSERT_NOT_REACHED(); | 227 NOTREACHED(); |
227 return CCScheduledActionDrawAndSwapResult(true, true); | 228 return CCScheduledActionDrawAndSwapResult(true, true); |
228 } | 229 } |
229 | 230 |
230 virtual void scheduledActionCommit() OVERRIDE { } | 231 virtual void scheduledActionCommit() OVERRIDE { } |
231 virtual void scheduledActionBeginContextRecreation() OVERRIDE { } | 232 virtual void scheduledActionBeginContextRecreation() OVERRIDE { } |
232 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE { } | 233 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE { } |
233 | 234 |
234 protected: | 235 protected: |
235 CCScheduler* m_scheduler; | 236 CCScheduler* m_scheduler; |
236 }; | 237 }; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossi
ble() OVERRIDE | 319 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossi
ble() OVERRIDE |
319 { | 320 { |
320 // Only setNeedsCommit the first time this is called | 321 // Only setNeedsCommit the first time this is called |
321 if (!m_numDraws) | 322 if (!m_numDraws) |
322 m_scheduler->setNeedsCommit(); | 323 m_scheduler->setNeedsCommit(); |
323 return FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible(); | 324 return FakeCCSchedulerClient::scheduledActionDrawAndSwapIfPossible(); |
324 } | 325 } |
325 | 326 |
326 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced(
) OVERRIDE | 327 virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced(
) OVERRIDE |
327 { | 328 { |
328 ASSERT_NOT_REACHED(); | 329 NOTREACHED(); |
329 return CCScheduledActionDrawAndSwapResult(true, true); | 330 return CCScheduledActionDrawAndSwapResult(true, true); |
330 } | 331 } |
331 | 332 |
332 virtual void scheduledActionCommit() OVERRIDE { } | 333 virtual void scheduledActionCommit() OVERRIDE { } |
333 virtual void scheduledActionBeginContextRecreation() OVERRIDE { } | 334 virtual void scheduledActionBeginContextRecreation() OVERRIDE { } |
334 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE { } | 335 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE { } |
335 | 336 |
336 protected: | 337 protected: |
337 CCScheduler* m_scheduler; | 338 CCScheduler* m_scheduler; |
338 }; | 339 }; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 // Get the compositor to do a scheduledActionDrawAndSwapForced. | 463 // Get the compositor to do a scheduledActionDrawAndSwapForced. |
463 scheduler->setNeedsRedraw(); | 464 scheduler->setNeedsRedraw(); |
464 scheduler->setNeedsForcedRedraw(); | 465 scheduler->setNeedsForcedRedraw(); |
465 EXPECT_TRUE(client.hasAction("scheduledActionDrawAndSwapForced")); | 466 EXPECT_TRUE(client.hasAction("scheduledActionDrawAndSwapForced")); |
466 | 467 |
467 // We should not have told the frame rate controller that we began a frame. | 468 // We should not have told the frame rate controller that we began a frame. |
468 EXPECT_EQ(0, controllerPtr->numFramesPending()); | 469 EXPECT_EQ(0, controllerPtr->numFramesPending()); |
469 } | 470 } |
470 | 471 |
471 } | 472 } |
OLD | NEW |