| 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 "cc/scheduler/frame_rate_controller.h" | 5 #include "cc/scheduler/frame_rate_controller.h" |
| 6 | 6 |
| 7 #include "cc/test/scheduler_test_common.h" | 7 #include "cc/test/scheduler_test_common.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 class FakeFrameRateControllerClient : public cc::FrameRateControllerClient { | 13 class FakeFrameRateControllerClient : public cc::FrameRateControllerClient { |
| 14 public: | 14 public: |
| 15 FakeFrameRateControllerClient() { Reset(); } | 15 FakeFrameRateControllerClient() { Reset(); } |
| 16 | 16 |
| 17 void Reset() { began_frame_ = false; } | 17 void Reset() { began_frame_ = false; } |
| 18 bool BeganFrame() const { return began_frame_; } | 18 bool BeganFrame() const { return began_frame_; } |
| 19 | 19 |
| 20 virtual void BeginFrame(bool throttled) OVERRIDE { | 20 virtual void FrameRateControllerTick(bool throttled) OVERRIDE { |
| 21 began_frame_ = !throttled; | 21 began_frame_ = !throttled; |
| 22 } | 22 } |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 bool began_frame_; | 25 bool began_frame_; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 TEST(FrameRateControllerTest, TestFrameThrottling_ImmediateAck) { | 28 TEST(FrameRateControllerTest, TestFrameThrottling_ImmediateAck) { |
| 29 FakeThread thread; | 29 FakeThread thread; |
| 30 FakeFrameRateControllerClient client; | 30 FakeFrameRateControllerClient client; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 // DidSwapBuffersComplete triggers a frame, make sure the BeginFrame | 173 // DidSwapBuffersComplete triggers a frame, make sure the BeginFrame |
| 174 // callback is called | 174 // callback is called |
| 175 controller.DidSwapBuffersComplete(); | 175 controller.DidSwapBuffersComplete(); |
| 176 thread.RunPendingTask(); | 176 thread.RunPendingTask(); |
| 177 EXPECT_TRUE(client.BeganFrame()); | 177 EXPECT_TRUE(client.BeganFrame()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace | 180 } // namespace |
| 181 } // namespace cc | 181 } // namespace cc |
| OLD | NEW |