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