Index: cc/scheduler/scheduler_unittest.cc |
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc |
index 4da406f60ad4be2cf640a87f9912d08a2ac9828e..3e02e6a3b407c4cae5ffa243d35044fbc8512ff3 100644 |
--- a/cc/scheduler/scheduler_unittest.cc |
+++ b/cc/scheduler/scheduler_unittest.cc |
@@ -1481,6 +1481,43 @@ TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateCommit_DrawEstimateTooLong) { |
CheckMainFrameSkippedAfterLateCommit(expect_send_begin_main_frame)); |
} |
+// If the BeginMainFrame aborts, it doesn't actually insert a frame into the |
+// queue, which means there is no latency to recover. |
+TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateAbort) { |
+ scheduler_settings_.use_external_begin_frame_source = true; |
+ SetUpScheduler(true); |
+ |
+ // Use fast estimates so we think we can recover latency if needed. |
+ fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration); |
+ |
+ // Impl thread hits deadline before BeginMainFrame aborts. |
+ scheduler_->SetNeedsBeginMainFrame(); |
+ EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
+ EXPECT_SCOPED(AdvanceFrame()); |
+ EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
+ task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
+ EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); |
+ EXPECT_ACTION("AddObserver(this)", client_, 0, 3); |
sunnyps
2016/02/16 22:02:20
nit: Move these EXPECT_ACTION calls to below Advan
brianderson
2016/02/16 23:08:42
Done.
|
+ EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3); |
+ EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3); |
+ EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
+ |
+ // After aborting the frame, make sure we don't skip the |
+ // next BeginMainFrame. |
+ client_->Reset(); |
+ scheduler_->BeginMainFrameAborted(CommitEarlyOutReason::FINISHED_NO_UPDATES); |
+ EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
+ scheduler_->SetNeedsBeginMainFrame(); |
+ EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
+ EXPECT_SCOPED(AdvanceFrame()); |
+ EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline()); |
+ task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
+ EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline()); |
+ EXPECT_TRUE(client_->HasAction("WillBeginImplFrame")); |
+ EXPECT_TRUE(client_->HasAction("ScheduledActionSendBeginMainFrame")); |
sunnyps
2016/02/16 22:02:20
nit: same here.
brianderson
2016/02/16 23:08:42
Done.
|
+} |
+ |
void SchedulerTest::ImplFrameSkippedAfterLateSwapAck( |
bool swap_ack_before_deadline) { |
// To get into a high latency state, this test disables automatic swap acks. |