Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: cc/scheduler/frame_rate_controller_unittest.cc

Issue 16863005: cc: Add BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@nofrc12
Patch Set: Rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/scheduler/frame_rate_controller.cc ('k') | cc/scheduler/scheduler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « cc/scheduler/frame_rate_controller.cc ('k') | cc/scheduler/scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698