Index: cc/scheduler/scheduler_state_machine_unittest.cc |
diff --git a/cc/scheduler/scheduler_state_machine_unittest.cc b/cc/scheduler/scheduler_state_machine_unittest.cc |
index 93e2cc26faa84e547c97b8c21202b6d947a22f42..390b2bd9e75e479b51034a61b02996d2f791724f 100644 |
--- a/cc/scheduler/scheduler_state_machine_unittest.cc |
+++ b/cc/scheduler/scheduler_state_machine_unittest.cc |
@@ -203,6 +203,9 @@ void PerformAction(StateMachine* sm, SchedulerStateMachine::Action action) { |
} |
} |
+// TODO(eseckler): Add tests for frame numbers / |
+// last_frame_number_compositor_frame_was_fresh_. |
+ |
TEST(SchedulerStateMachineTest, BeginFrameNeeded) { |
SchedulerSettings default_scheduler_settings; |
StateMachine state(default_scheduler_settings); |
@@ -271,7 +274,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) { |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
EXPECT_FALSE(state.NeedsCommit()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
@@ -290,7 +293,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) { |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
EXPECT_TRUE(state.NeedsCommit()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
@@ -318,7 +321,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) { |
EXPECT_TRUE(state.NeedsCommit()); |
EXPECT_TRUE(state.BeginFrameNeeded()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 3); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); |
@@ -345,7 +348,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) { |
EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); |
EXPECT_TRUE(state.BeginFrameNeeded()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 4); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); |
@@ -367,7 +370,7 @@ TEST(SchedulerStateMachineTest, MainFrameBeforeActivationEnabled) { |
EXPECT_TRUE(state.BeginFrameNeeded()); |
// Commit to the pending tree. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -383,7 +386,7 @@ TEST(SchedulerStateMachineTest, MainFrameBeforeActivationEnabled) { |
// Verify that the next commit starts while there is still a pending tree. |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -420,7 +423,7 @@ TEST(SchedulerStateMachineTest, |
EXPECT_TRUE(state.BeginFrameNeeded()); |
// Start a frame. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
EXPECT_FALSE(state.CommitPending()); |
@@ -438,7 +441,7 @@ TEST(SchedulerStateMachineTest, |
// finishes and the requested commit wasn't actually necessary. |
EXPECT_TRUE(state.CommitPending()); |
EXPECT_TRUE(state.RedrawPending()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
state.SetDrawResultForTest(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS); |
@@ -457,7 +460,7 @@ TEST(SchedulerStateMachineTest, FailedDrawForMissingHighResNeedsCommit) { |
EXPECT_TRUE(state.BeginFrameNeeded()); |
// Start a frame. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
EXPECT_FALSE(state.CommitPending()); |
@@ -475,7 +478,7 @@ TEST(SchedulerStateMachineTest, FailedDrawForMissingHighResNeedsCommit) { |
// It doesn't request a draw until we get a new commit though. |
EXPECT_TRUE(state.CommitPending()); |
EXPECT_FALSE(state.RedrawPending()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -493,7 +496,7 @@ TEST(SchedulerStateMachineTest, FailedDrawForMissingHighResNeedsCommit) { |
EXPECT_TRUE(state.RedrawPending()); |
// Verify we draw with the new frame. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 3); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
state.SetDrawResultForTest(DRAW_SUCCESS); |
@@ -514,7 +517,7 @@ TEST(SchedulerStateMachineTest, |
// Start a commit. |
state.SetNeedsBeginMainFrame(); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -545,7 +548,7 @@ TEST(SchedulerStateMachineTest, |
EXPECT_TRUE(state.RedrawPending()); |
// The redraw should be forced at the end of the next BeginImplFrame. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -569,7 +572,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawsDoNotRestartForcedDraw) { |
// Start a commit. |
state.SetNeedsBeginMainFrame(); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -583,7 +586,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawsDoNotRestartForcedDraw) { |
// Fail the draw enough times to force a redraw. |
for (int i = 0; i < draw_limit; ++i) { |
state.SetNeedsRedraw(true); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, i + 2); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
state.SetDrawResultForTest(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS); |
@@ -604,7 +607,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawsDoNotRestartForcedDraw) { |
// redraw, but not back in IDLE. |
for (int i = 0; i < draw_limit; ++i) { |
state.SetNeedsRedraw(true); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, draw_limit + i + 2); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
state.SetDrawResultForTest(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS); |
@@ -626,7 +629,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawIsRetriedInNextBeginImplFrame) { |
// Start a draw. |
state.SetNeedsRedraw(true); |
EXPECT_TRUE(state.BeginFrameNeeded()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
EXPECT_TRUE(state.RedrawPending()); |
@@ -641,7 +644,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawIsRetriedInNextBeginImplFrame) { |
// We should not be trying to draw again now, but we have a commit pending. |
EXPECT_TRUE(state.BeginFrameNeeded()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
// We should try to draw again at the end of the next BeginImplFrame on |
@@ -662,7 +665,7 @@ TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) { |
// Draw the first frame. |
EXPECT_TRUE(state.BeginFrameNeeded()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
@@ -678,7 +681,7 @@ TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) { |
// Move to another frame. This should now draw. |
EXPECT_TRUE(state.BeginFrameNeeded()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); |
@@ -816,7 +819,7 @@ TEST(SchedulerStateMachineTest, TestCanRedraw_StopsDraw) { |
state.SetVisible(false); |
state.SetNeedsRedraw(true); |
if (j == 1) |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, i + 1); |
state.SetCanDraw(false); |
EXPECT_NE(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE, |
@@ -839,7 +842,7 @@ TEST(SchedulerStateMachineTest, |
state.SetNeedsBeginMainFrame(); |
state.SetNeedsRedraw(true); |
state.SetCanDraw(false); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_ABORT); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
@@ -863,7 +866,7 @@ TEST(SchedulerStateMachineTest, TestSetNeedsBeginMainFrameIsNotLost) { |
EXPECT_TRUE(state.BeginFrameNeeded()); |
// Begin the frame. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); |
@@ -892,7 +895,7 @@ TEST(SchedulerStateMachineTest, TestSetNeedsBeginMainFrameIsNotLost) { |
EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); |
EXPECT_ACTION(SchedulerStateMachine::ACTION_COMMIT); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_IMPL_FRAME_STATE( |
SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME); |
EXPECT_ACTION(SchedulerStateMachine::ACTION_COMMIT); |
@@ -924,7 +927,7 @@ TEST(SchedulerStateMachineTest, TestFullCycle) { |
state.SetNeedsBeginMainFrame(); |
// Begin the frame. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); |
@@ -970,7 +973,7 @@ TEST(SchedulerStateMachineTest, CommitWithoutDrawWithPendingTree) { |
state.SetNeedsBeginMainFrame(); |
// Make a main frame, commit and activate it. But don't draw it. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
state.NotifyBeginMainFrameStarted(); |
@@ -983,7 +986,7 @@ TEST(SchedulerStateMachineTest, CommitWithoutDrawWithPendingTree) { |
// pending tree and not clobber the active tree, we're able to start a new |
// begin frame and commit it. |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
state.NotifyBeginMainFrameStarted(); |
@@ -1002,7 +1005,7 @@ TEST(SchedulerStateMachineTest, DontCommitWithoutDrawWithoutPendingTree) { |
state.SetNeedsBeginMainFrame(); |
// Make a main frame, commit and activate it. But don't draw it. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
state.NotifyBeginMainFrameStarted(); |
@@ -1014,7 +1017,7 @@ TEST(SchedulerStateMachineTest, DontCommitWithoutDrawWithoutPendingTree) { |
// Try to make a new main frame before drawing, but since we would clobber the |
// active tree, we will not do so. |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
} |
@@ -1026,7 +1029,7 @@ TEST(SchedulerStateMachineTest, AbortedMainFrameDoesNotResetPendingTree) { |
// Perform a commit so that we have an active tree. |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -1041,7 +1044,7 @@ TEST(SchedulerStateMachineTest, AbortedMainFrameDoesNotResetPendingTree) { |
// Ask for another commit but abort it. Verify that we didn't reset pending |
// tree state. |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -1055,7 +1058,7 @@ TEST(SchedulerStateMachineTest, AbortedMainFrameDoesNotResetPendingTree) { |
// Ask for another commit that doesn't abort. |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 3); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -1084,7 +1087,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitToActive) { |
state.SetNeedsBeginMainFrame(); |
// Begin the frame. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); |
@@ -1111,7 +1114,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitToActive) { |
// Can't BeginMainFrame yet since last commit hasn't been drawn yet. |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
// Now call ready to draw which will allow the draw to happen and |
@@ -1124,7 +1127,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitToActive) { |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
// Can't BeginMainFrame yet since we're submit-frame throttled. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 3); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
// CompositorFrameAck unblocks BeginMainFrame. |
@@ -1154,7 +1157,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) { |
state.SetNeedsBeginMainFrame(); |
// Begin the frame. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); |
@@ -1193,7 +1196,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) { |
EXPECT_FALSE(state.needs_redraw()); |
// Next BeginImplFrame should initiate second commit. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
} |
@@ -1256,7 +1259,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseInvisible) { |
state.SetNeedsBeginMainFrame(); |
// Begin the frame while visible. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); |
@@ -1290,7 +1293,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseInvisible) { |
EXPECT_TRUE(state.NeedsCommit()); |
// Start a new frame. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
@@ -1312,7 +1315,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) { |
// Get into a begin frame / commit state. |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); |
@@ -1336,7 +1339,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) { |
EXPECT_FALSE(state.NeedsCommit()); |
EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_IDLE); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -1344,7 +1347,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) { |
// Verify another commit can start if requested, though. |
state.SetNeedsBeginMainFrame(); |
EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_IDLE); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 3); |
EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
} |
@@ -1360,14 +1363,14 @@ TEST(SchedulerStateMachineTest, TestFirstContextCreation) { |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
// Check that the first init does not SetNeedsBeginMainFrame. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
// Check that a needs commit initiates a BeginMainFrame. |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
} |
@@ -1392,7 +1395,7 @@ TEST(SchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) { |
state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); |
// When the context is recreated, we should begin a commit. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
} |
@@ -1414,14 +1417,14 @@ TEST(SchedulerStateMachineTest, |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
// Once context recreation begins, nothing should happen. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
// While context is recreating, commits shouldn't begin. |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -1438,7 +1441,7 @@ TEST(SchedulerStateMachineTest, |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
// When the BeginFrame comes in we should begin a commit |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 3); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -1464,7 +1467,7 @@ TEST(SchedulerStateMachineTest, |
// Finishing the first commit after initializing an CompositorFrameSink should |
// automatically cause a redraw. |
EXPECT_TRUE(state.RedrawPending()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 4); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); |
@@ -1472,7 +1475,7 @@ TEST(SchedulerStateMachineTest, |
EXPECT_FALSE(state.RedrawPending()); |
// Next frame as no work to do. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 5); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -1480,7 +1483,7 @@ TEST(SchedulerStateMachineTest, |
// Once the context is recreated, whether we draw should be based on |
// SetCanDraw if waiting on first draw after activate. |
state.SetNeedsRedraw(true); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 6); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
EXPECT_ACTION(SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE); |
@@ -1494,7 +1497,7 @@ TEST(SchedulerStateMachineTest, |
// SetCanDraw if waiting on first draw after activate. |
state.SetNeedsRedraw(true); |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 7); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -1526,7 +1529,7 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress) { |
// Set damage and expect a draw. |
state.SetNeedsRedraw(true); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -1560,7 +1563,7 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress) { |
EXPECT_ACTION( |
SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_IMPL_FRAME_STATE( |
SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME); |
EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); |
@@ -1583,7 +1586,7 @@ TEST(SchedulerStateMachineTest, |
// Set damage and expect a draw. |
state.SetNeedsRedraw(true); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -1617,7 +1620,7 @@ TEST(SchedulerStateMachineTest, |
EXPECT_ACTION( |
SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_IMPL_FRAME_STATE( |
SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME); |
EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); |
@@ -1633,7 +1636,7 @@ TEST(SchedulerStateMachineTest, |
// After we get a new CompositorFrameSink, the commit flow should start. |
state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 3); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -1667,7 +1670,7 @@ TEST(SchedulerStateMachineTest, |
state.DidCreateAndInitializeCompositorFrameSink(); |
EXPECT_FALSE(state.RedrawPending()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
} |
@@ -1730,7 +1733,7 @@ TEST(SchedulerStateMachineTest, TestNoBeginMainFrameWhenInvisible) { |
// When become visible again, the needs commit should still be pending. |
state.SetVisible(true); |
EXPECT_TRUE(state.BeginFrameNeeded()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
} |
@@ -1894,7 +1897,7 @@ TEST(SchedulerStateMachineTest, |
// This test mirrors what happens during the first frame of a scroll gesture. |
// First we get the input event and a BeginFrame. |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
// As a response the compositor requests a redraw and a commit to tell the |
// main thread about the new scroll offset. |
@@ -1929,7 +1932,7 @@ void FinishPreviousCommitAndDrawWithoutExitingDeadline( |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); |
@@ -1947,7 +1950,7 @@ TEST(SchedulerStateMachineTest, TestImplLatencyTakesPriority) { |
// in prefer impl latency mode. |
state.SetNeedsRedraw(true); |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -1984,7 +1987,7 @@ TEST(SchedulerStateMachineTest, TestImplLatencyTakesPriority) { |
// throttled and did not just submit one. |
state.SetNeedsBeginMainFrame(); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); |
state.OnBeginImplFrameDeadline(); |
@@ -1999,7 +2002,7 @@ TEST(SchedulerStateMachineTest, |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -2019,7 +2022,7 @@ TEST(SchedulerStateMachineTest, TestTriggerDeadlineImmediatelyWhenInvisible) { |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -2039,7 +2042,7 @@ TEST(SchedulerStateMachineTest, |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
@@ -2062,14 +2065,14 @@ TEST(SchedulerStateMachineTest, TestDeferCommit) { |
EXPECT_FALSE(state.BeginFrameNeeded()); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.OnBeginImplFrameDeadline(); |
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
state.SetDeferCommits(false); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 2); |
EXPECT_ACTION_UPDATE_STATE( |
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
} |
@@ -2083,7 +2086,7 @@ TEST(SchedulerStateMachineTest, EarlyOutCommitWantsProactiveBeginFrame) { |
bool commit_has_no_updates = true; |
state.WillCommit(commit_has_no_updates); |
EXPECT_TRUE(state.ProactiveBeginFrameWanted()); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
EXPECT_FALSE(state.ProactiveBeginFrameWanted()); |
} |
@@ -2095,7 +2098,7 @@ TEST(SchedulerStateMachineTest, |
// Set up the request for a commit and start a frame. |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
PerformAction(&state, SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
// Lose the CompositorFrameSink. |
@@ -2131,7 +2134,7 @@ TEST(SchedulerStateMachineTest, CompositorFrameSinkCreationWhileCommitPending) { |
// Set up the request for a commit and start a frame. |
state.SetNeedsBeginMainFrame(); |
- state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(0, 1); |
PerformAction(&state, SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
// Lose the CompositorFrameSink. |