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

Unified Diff: cc/scheduler/scheduler_unittest.cc

Issue 1432463002: cc: Track BeginMainFrame more precisely in CompositorTimingHistory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit tests. New tests to be added. Created 5 years, 1 month 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 0846e954c2a11fef81cc2d4561f12877a4004f96..affb1c22e78f33fb697d844723e95aa4f759ecbf 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -319,7 +319,7 @@ class SchedulerTest : public testing::Test {
SCOPED_TRACE("Do first frame to commit after initialize.");
AdvanceFrame();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
scheduler_->NotifyReadyToDraw();
@@ -548,7 +548,7 @@ TEST_F(SchedulerTest, RequestCommit) {
client_->Reset();
// NotifyReadyToCommit should trigger the commit.
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
EXPECT_TRUE(client_->needs_begin_frames());
@@ -671,7 +671,7 @@ TEST_F(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
client_->Reset();
// Finish the first commit.
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
@@ -702,7 +702,7 @@ TEST_F(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
// Finishing the commit before the deadline should post a new deadline task
// to trigger the deadline early.
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
@@ -885,7 +885,7 @@ TEST_F(SchedulerTest, RequestCommitInsideDraw) {
EXPECT_EQ(1, client->num_draws());
EXPECT_TRUE(scheduler_->CommitPending());
EXPECT_TRUE(client->needs_begin_frames());
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
@@ -1271,7 +1271,7 @@ TEST_F(SchedulerTest, WaitForReadyToDrawDoNotPostDeadline) {
// Begin new frame.
EXPECT_SCOPED(AdvanceFrame());
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
@@ -1311,7 +1311,7 @@ TEST_F(SchedulerTest, WaitForReadyToDrawCancelledWhenLostOutputSurface) {
// Begin new frame.
EXPECT_SCOPED(AdvanceFrame());
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
@@ -1348,7 +1348,7 @@ void SchedulerTest::CheckMainFrameSkippedAfterLateCommit(
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 5);
@@ -1471,7 +1471,7 @@ void SchedulerTest::ImplFrameSkippedAfterLateSwapAck(
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 3, 4);
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
@@ -1520,7 +1520,7 @@ void SchedulerTest::ImplFrameSkippedAfterLateSwapAck(
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3);
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
@@ -1657,7 +1657,7 @@ void SchedulerTest::ImplFrameIsNotSkippedAfterLateSwapAck() {
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3);
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
@@ -1682,7 +1682,7 @@ void SchedulerTest::ImplFrameIsNotSkippedAfterLateSwapAck() {
client_->Reset();
scheduler_->DidSwapBuffersComplete();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
@@ -1767,7 +1767,7 @@ TEST_F(SchedulerTest,
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
@@ -1785,7 +1785,7 @@ TEST_F(SchedulerTest,
EXPECT_SCOPED(AdvanceFrame());
EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
@@ -1856,7 +1856,7 @@ TEST_F(SchedulerTest,
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
SendNextBeginFrame();
EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
@@ -1898,7 +1898,7 @@ TEST_F(
EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
EXPECT_FALSE(scheduler_->CommitPending());
@@ -1915,7 +1915,7 @@ TEST_F(
EXPECT_FALSE(scheduler_->CommitPending());
scheduler_->SetNeedsBeginMainFrame();
EXPECT_SCOPED(AdvanceFrame());
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
@@ -1970,7 +1970,7 @@ TEST_F(SchedulerTest,
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
scheduler_->DidSwapBuffersComplete();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_FALSE(scheduler_->CommitPending());
EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 6);
@@ -1991,7 +1991,7 @@ TEST_F(SchedulerTest,
EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4);
EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4);
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4);
@@ -2051,7 +2051,7 @@ TEST_F(
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
scheduler_->DidSwapBuffersComplete();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_FALSE(scheduler_->CommitPending());
EXPECT_ACTION("SetNeedsBeginFrames(true)", client_, 0, 6);
@@ -2072,7 +2072,7 @@ TEST_F(
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
scheduler_->DidSwapBuffersComplete();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
EXPECT_ACTION("WillBeginImplFrame", client_, 0, 4);
EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 4);
EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 4);
@@ -2126,7 +2126,7 @@ TEST_F(SchedulerTest, BeginRetroFrame) {
client_->Reset();
// NotifyReadyToCommit should trigger the commit.
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
EXPECT_TRUE(client_->needs_begin_frames());
@@ -2181,7 +2181,7 @@ TEST_F(SchedulerTest, RetroFrameDoesNotExpireTooEarly) {
EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
client_->Reset();
BeginFrameArgs retro_frame_args = SendNextBeginFrame();
@@ -2242,7 +2242,7 @@ TEST_F(SchedulerTest, RetroFrameExpiresOnTime) {
EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
client_->Reset();
BeginFrameArgs retro_frame_args = SendNextBeginFrame();
@@ -2359,7 +2359,7 @@ void SchedulerTest::BeginFramesNotFromClient(
client_->Reset();
// NotifyReadyToCommit should trigger the commit.
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
client_->Reset();
@@ -2449,7 +2449,7 @@ void SchedulerTest::BeginFramesNotFromClient_SwapThrottled(
client_->Reset();
// NotifyReadyToCommit should trigger the pending commit.
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
client_->Reset();
@@ -2574,7 +2574,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) {
EXPECT_NO_ACTION(client_);
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_ACTION("ScheduledActionCommit", client_, 0, 2);
EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 2);
@@ -2624,7 +2624,7 @@ TEST_F(SchedulerTest,
EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3);
EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3);
@@ -2646,7 +2646,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) {
EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
@@ -2725,7 +2725,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) {
// NotifyReadyToCommit should trigger the commit.
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
EXPECT_TRUE(client_->needs_begin_frames());
@@ -2785,7 +2785,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
// NotifyReadyToCommit should trigger the commit.
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
EXPECT_TRUE(client_->needs_begin_frames());
@@ -2842,7 +2842,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceWithSyntheticBeginFrameSource) {
// NotifyReadyToCommit should trigger the commit.
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
EXPECT_TRUE(scheduler_->frame_source().NeedsBeginFrames());
@@ -2881,7 +2881,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceWhenIdle) {
EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
@@ -2917,7 +2917,7 @@ TEST_F(SchedulerTest, ScheduledActionActivateAfterBecomingInvisible) {
EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
@@ -3061,7 +3061,7 @@ TEST_F(SchedulerTest, SendBeginMainFrameNotExpectedSoon) {
// Trigger a frame draw.
EXPECT_SCOPED(AdvanceFrame());
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
task_runner().RunPendingTasks();
@@ -3181,7 +3181,7 @@ TEST_F(SchedulerTest, SynchronousCompositorCommit) {
EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
EXPECT_NO_ACTION(client_);
// Next vsync.
@@ -3238,7 +3238,7 @@ TEST_F(SchedulerTest, SynchronousCompositorDoubleCommitWithoutDraw) {
EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
EXPECT_NO_ACTION(client_);
scheduler_->NotifyReadyToCommit();
@@ -3260,7 +3260,7 @@ TEST_F(SchedulerTest, SynchronousCompositorDoubleCommitWithoutDraw) {
EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
EXPECT_NO_ACTION(client_);
// Allow new commit even though previous commit hasn't been drawn.
@@ -3357,7 +3357,7 @@ TEST_F(SchedulerTest, SynchronousCompositorSendBeginMainFrameWhileIdle) {
EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_);
client_->Reset();
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
client_->Reset();
@@ -3416,7 +3416,7 @@ TEST_F(SchedulerTest, AuthoritativeVSyncInterval) {
EXPECT_EQ(initial_interval, scheduler_->BeginImplFrameInterval());
- scheduler_->NotifyBeginMainFrameStarted();
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
scheduler_->NotifyReadyToCommit();
scheduler_->NotifyReadyToActivate();
task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));

Powered by Google App Engine
This is Rietveld 408576698