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

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

Issue 1005553004: cc: Add support for handling authoritative vsync interval (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/scheduler.cc ('k') | cc/test/fake_proxy.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/scheduler.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2265 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); 2265 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
2266 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); 2266 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
2267 client_->Reset(); 2267 client_->Reset();
2268 2268
2269 task_runner().RunPendingTasks(); // Run posted deadline. 2269 task_runner().RunPendingTasks(); // Run posted deadline.
2270 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); 2270 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2);
2271 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); 2271 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
2272 client_->Reset(); 2272 client_->Reset();
2273 } 2273 }
2274 2274
2275 TEST_F(SchedulerTest, AuthoritativeVSyncInterval) {
2276 SetUpScheduler(true);
2277
2278 base::TimeDelta initial_interval =
2279 scheduler_->begin_impl_frame_args().interval;
2280 base::TimeDelta authoritative_interval =
2281 base::TimeDelta::FromMilliseconds(33);
2282
2283 scheduler_->SetNeedsCommit();
2284 EXPECT_SCOPED(AdvanceFrame());
2285
2286 EXPECT_EQ(initial_interval, scheduler_->begin_impl_frame_args().interval);
2287
2288 scheduler_->NotifyBeginMainFrameStarted();
2289 scheduler_->NotifyReadyToCommit();
2290 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
2291
2292 scheduler_->SetAuthoritativeVSyncInterval(authoritative_interval);
2293
2294 EXPECT_SCOPED(AdvanceFrame());
2295
2296 // At the next BeginFrame, authoritative interval is used instead of previous
2297 // interval.
2298 EXPECT_NE(initial_interval, scheduler_->begin_impl_frame_args().interval);
2299 EXPECT_EQ(authoritative_interval,
2300 scheduler_->begin_impl_frame_args().interval);
2301 }
2302
2275 } // namespace 2303 } // namespace
2276 } // namespace cc 2304 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/test/fake_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698