Chromium Code Reviews| 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 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2193 // Disable auto-advancing of now_src | 2193 // Disable auto-advancing of now_src |
| 2194 client.task_runner().SetAutoAdvanceNowToPendingTasks(false); | 2194 client.task_runner().SetAutoAdvanceNowToPendingTasks(false); |
| 2195 | 2195 |
| 2196 // Deadline task is pending | 2196 // Deadline task is pending |
| 2197 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 2197 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
| 2198 client.task_runner().RunPendingTasks(); | 2198 client.task_runner().RunPendingTasks(); |
| 2199 // Deadline task runs immediately | 2199 // Deadline task runs immediately |
| 2200 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 2200 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
| 2201 } | 2201 } |
| 2202 | 2202 |
| 2203 TEST(SchedulerTest, BeginMainFrameAbortedTriggersImmediateDeadline) { | |
|
brianderson
2015/01/09 23:54:22
Does this test fail before this patch?
sunnyps
2015/01/13 19:36:01
Yes, it does.
| |
| 2204 FakeSchedulerClient client; | |
| 2205 SchedulerSettings settings; | |
| 2206 settings.use_external_begin_frame_source = true; | |
| 2207 | |
| 2208 CREATE_SCHEDULER_AND_INIT_SURFACE(settings); | |
| 2209 | |
| 2210 scheduler->SetNeedsCommit(); | |
| 2211 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | |
| 2212 client.Reset(); | |
| 2213 | |
| 2214 client.AdvanceFrame(); | |
| 2215 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | |
| 2216 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | |
| 2217 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | |
| 2218 client.Reset(); | |
| 2219 | |
| 2220 client.task_runner().RunUntilTime(client.now_src()->Now()); | |
| 2221 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | |
| 2222 | |
| 2223 scheduler->BeginMainFrameAborted(CommitEarlyOutReason::ABORTED_NOT_VISIBLE); | |
| 2224 | |
| 2225 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | |
| 2226 client.task_runner().RunUntilTime(client.now_src()->Now()); | |
| 2227 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | |
| 2228 | |
| 2229 EXPECT_NO_ACTION(client); | |
| 2230 } | |
| 2231 | |
| 2203 } // namespace | 2232 } // namespace |
| 2204 } // namespace cc | 2233 } // namespace cc |
| OLD | NEW |