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 FrameRateControllerTick(bool throttled) OVERRIDE { | 20 virtual void FrameRateControllerTick( |
| 21 bool throttled, BeginFrameArgs args) OVERRIDE { |
21 began_frame_ = !throttled; | 22 began_frame_ = !throttled; |
22 } | 23 } |
23 | 24 |
24 protected: | 25 protected: |
25 bool began_frame_; | 26 bool began_frame_; |
26 }; | 27 }; |
27 | 28 |
28 TEST(FrameRateControllerTest, TestFrameThrottling_ImmediateAck) { | 29 TEST(FrameRateControllerTest, TestFrameThrottling_ImmediateAck) { |
29 FakeThread thread; | 30 FakeThread thread; |
30 FakeFrameRateControllerClient client; | 31 FakeFrameRateControllerClient client; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 173 |
173 // DidSwapBuffersComplete triggers a frame, make sure the BeginFrame | 174 // DidSwapBuffersComplete triggers a frame, make sure the BeginFrame |
174 // callback is called | 175 // callback is called |
175 controller.DidSwapBuffersComplete(); | 176 controller.DidSwapBuffersComplete(); |
176 thread.RunPendingTask(); | 177 thread.RunPendingTask(); |
177 EXPECT_TRUE(client.BeganFrame()); | 178 EXPECT_TRUE(client.BeganFrame()); |
178 } | 179 } |
179 | 180 |
180 } // namespace | 181 } // namespace |
181 } // namespace cc | 182 } // namespace cc |
OLD | NEW |