| 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 2300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2311 EXPECT_SCOPED(client.AdvanceFrame()); | 2311 EXPECT_SCOPED(client.AdvanceFrame()); |
| 2312 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 2312 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
| 2313 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); | 2313 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
| 2314 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 2314 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 2315 EXPECT_TRUE(client.needs_begin_frames()); | 2315 EXPECT_TRUE(client.needs_begin_frames()); |
| 2316 client.Reset(); | 2316 client.Reset(); |
| 2317 client.task_runner().RunPendingTasks(); // Run posted deadline. | 2317 client.task_runner().RunPendingTasks(); // Run posted deadline. |
| 2318 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); | 2318 EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1); |
| 2319 } | 2319 } |
| 2320 | 2320 |
| 2321 TEST(SchedulerTest, BeginMainFrameAbortedTriggersImmediateDeadline) { | |
| 2322 FakeSchedulerClient client; | |
| 2323 SchedulerSettings settings; | |
| 2324 settings.use_external_begin_frame_source = true; | |
| 2325 | |
| 2326 CREATE_SCHEDULER_AND_INIT_SURFACE(settings); | |
| 2327 | |
| 2328 scheduler->SetNeedsCommit(); | |
| 2329 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | |
| 2330 client.Reset(); | |
| 2331 | |
| 2332 client.AdvanceFrame(); | |
| 2333 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | |
| 2334 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | |
| 2335 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | |
| 2336 client.Reset(); | |
| 2337 | |
| 2338 client.task_runner().RunUntilTime(client.now_src()->Now()); | |
| 2339 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | |
| 2340 | |
| 2341 scheduler->BeginMainFrameAborted(CommitEarlyOutReason::ABORTED_NOT_VISIBLE); | |
| 2342 | |
| 2343 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | |
| 2344 client.task_runner().RunUntilTime(client.now_src()->Now()); | |
| 2345 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | |
| 2346 | |
| 2347 EXPECT_NO_ACTION(client); | |
| 2348 } | |
| 2349 | |
| 2350 } // namespace | 2321 } // namespace |
| 2351 } // namespace cc | 2322 } // namespace cc |
| OLD | NEW |