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

Unified Diff: cc/scheduler/scheduler_unittest.cc

Issue 1681393003: cc: Add MainAndImplFrameTimeDelta UMA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Non bool version; Fix abort bug; Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: cc/scheduler/scheduler_unittest.cc
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index 9a30c34ba89444efde1add14f2e5c0f94b589ec2..f2046cc886acf1aad8e31500f188348bafe13d12 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -1483,6 +1483,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("SetNeedsBeginFrames(true)", client_, 0, 3);
+ 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"));
+}
+
void SchedulerTest::ImplFrameSkippedAfterLateSwapAck(
bool swap_ack_before_deadline) {
// To get into a high latency state, this test disables automatic swap acks.

Powered by Google App Engine
This is Rietveld 408576698