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 "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
8 #include "cc/test/scheduler_test_common.h" | 8 #include "cc/test/scheduler_test_common.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 namespace { | 12 namespace { |
13 | 13 |
14 class FakeFrameRateControllerClient : public cc::FrameRateControllerClient { | 14 class FakeFrameRateControllerClient : public cc::FrameRateControllerClient { |
15 public: | 15 public: |
16 FakeFrameRateControllerClient() { Reset(); } | 16 FakeFrameRateControllerClient() { Reset(); } |
17 | 17 |
18 void Reset() { began_frame_ = false; } | 18 void Reset() { began_frame_ = false; } |
19 bool BeganFrame() const { return began_frame_; } | 19 bool BeganFrame() const { return began_frame_; } |
20 | 20 |
21 virtual void FrameRateControllerTick(bool throttled) OVERRIDE { | 21 virtual void FrameRateControllerTick( |
| 22 bool throttled, const BeginFrameArgs& args) OVERRIDE { |
22 began_frame_ = !throttled; | 23 began_frame_ = !throttled; |
23 } | 24 } |
24 | 25 |
25 protected: | 26 protected: |
26 bool began_frame_; | 27 bool began_frame_; |
27 }; | 28 }; |
28 | 29 |
29 TEST(FrameRateControllerTest, TestFrameThrottling_ImmediateAck) { | 30 TEST(FrameRateControllerTest, TestFrameThrottling_ImmediateAck) { |
30 scoped_refptr<base::TestSimpleTaskRunner> task_runner = | 31 scoped_refptr<base::TestSimpleTaskRunner> task_runner = |
31 new base::TestSimpleTaskRunner; | 32 new base::TestSimpleTaskRunner; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 177 |
177 // DidSwapBuffersComplete triggers a frame, make sure the BeginFrame | 178 // DidSwapBuffersComplete triggers a frame, make sure the BeginFrame |
178 // callback is called | 179 // callback is called |
179 controller.DidSwapBuffersComplete(); | 180 controller.DidSwapBuffersComplete(); |
180 task_runner->RunPendingTasks(); | 181 task_runner->RunPendingTasks(); |
181 EXPECT_TRUE(client.BeganFrame()); | 182 EXPECT_TRUE(client.BeganFrame()); |
182 } | 183 } |
183 | 184 |
184 } // namespace | 185 } // namespace |
185 } // namespace cc | 186 } // namespace cc |
OLD | NEW |