| 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/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 Loading... |
| 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 |
| OLD | NEW |