| 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 98d5b18cf9ff949ca81ab79850c790049caddf94..4c2c267a5a493ebbbe734017265f2af8b8f7325b 100644
|
| --- a/cc/scheduler/scheduler_state_machine_unittest.cc
|
| +++ b/cc/scheduler/scheduler_state_machine_unittest.cc
|
| @@ -132,6 +132,8 @@ class StateMachine : public SchedulerStateMachine {
|
| }
|
|
|
| using SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineImmediately;
|
| + using SchedulerStateMachine::ProactiveBeginFrameWanted;
|
| + using SchedulerStateMachine::UpdateStateOnCommit;
|
| };
|
|
|
| TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) {
|
| @@ -152,8 +154,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) {
|
|
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| EXPECT_FALSE(state.BeginFrameNeeded());
|
| - state.OnBeginImplFrame(
|
| - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
|
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| state.OnBeginImplFrameDeadline();
|
| @@ -171,8 +172,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) {
|
|
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| EXPECT_FALSE(state.BeginFrameNeeded());
|
| - state.OnBeginImplFrame(
|
| - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| state.OnBeginImplFrameDeadline();
|
| }
|
| @@ -190,8 +190,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) {
|
|
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
|
|
| - state.OnBeginImplFrame(
|
| - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| }
|
| @@ -224,7 +223,7 @@ TEST(SchedulerStateMachineTest, MainFrameBeforeActivationEnabled) {
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
|
|
| // Commit to the pending tree.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -240,7 +239,7 @@ TEST(SchedulerStateMachineTest, MainFrameBeforeActivationEnabled) {
|
|
|
| // Verify that the next commit starts while there is still a pending tree.
|
| state.SetNeedsCommit();
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -277,7 +276,7 @@ TEST(SchedulerStateMachineTest,
|
| state.SetNeedsRedraw(true);
|
| EXPECT_TRUE(state.RedrawPending());
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| state.OnBeginImplFrameDeadline();
|
| @@ -294,7 +293,7 @@ TEST(SchedulerStateMachineTest,
|
|
|
| // Failing the draw makes us require a commit.
|
| state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| @@ -310,7 +309,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawForMissingHighResNeedsCommit) {
|
| EXPECT_TRUE(state.RedrawPending());
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
|
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| state.OnBeginImplFrameDeadline();
|
| @@ -324,7 +323,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawForMissingHighResNeedsCommit) {
|
|
|
| // Missing high res content requires a commit (but not a redraw)
|
| state.DidDrawIfPossibleCompleted(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT);
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_FALSE(state.RedrawPending());
|
| @@ -339,7 +338,7 @@ TEST(SchedulerStateMachineTest,
|
| state.SetNeedsRedraw(true);
|
| EXPECT_TRUE(state.RedrawPending());
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| state.OnBeginImplFrameDeadline();
|
| @@ -360,7 +359,7 @@ TEST(SchedulerStateMachineTest,
|
|
|
| // Failing the draw for animation checkerboards makes us require a commit.
|
| state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS);
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| @@ -377,7 +376,7 @@ TEST(SchedulerStateMachineTest,
|
| // Start a commit.
|
| state.SetNeedsCommit();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -407,7 +406,7 @@ TEST(SchedulerStateMachineTest,
|
| EXPECT_TRUE(state.RedrawPending());
|
|
|
| // The redraw should be forced at the end of the next BeginImplFrame.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| @@ -431,7 +430,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawsDoNotRestartForcedDraw) {
|
| // Start a commit.
|
| state.SetNeedsCommit();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -484,7 +483,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawIsRetriedInNextBeginImplFrame) {
|
| // Start a draw.
|
| state.SetNeedsRedraw(true);
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| state.OnBeginImplFrameDeadline();
|
| @@ -501,7 +500,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(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| @@ -523,7 +522,7 @@ TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) {
|
|
|
| // Draw the first frame.
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| @@ -542,7 +541,7 @@ TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) {
|
|
|
| // Move to another frame. This should now draw.
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
|
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -677,8 +676,7 @@ TEST(SchedulerStateMachineTest, TestCanRedraw_StopsDraw) {
|
| state.SetVisible(false);
|
| state.SetNeedsRedraw(true);
|
| if (j == 1)
|
| - state.OnBeginImplFrame(
|
| - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
|
|
| state.SetCanDraw(false);
|
| EXPECT_NE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE,
|
| @@ -700,7 +698,7 @@ TEST(SchedulerStateMachineTest,
|
| state.SetNeedsRedraw(true);
|
| state.SetVisible(true);
|
| state.SetCanDraw(false);
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT);
|
| EXPECT_ACTION_UPDATE_STATE(
|
| @@ -724,7 +722,7 @@ TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) {
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
|
|
| // Begin the frame.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_COMMIT_STATE(
|
| @@ -758,7 +756,7 @@ TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) {
|
| EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
|
| EXPECT_ACTION(SchedulerStateMachine::ACTION_COMMIT);
|
|
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_IMPL_FRAME_STATE(
|
| SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING);
|
| EXPECT_ACTION(SchedulerStateMachine::ACTION_COMMIT);
|
| @@ -791,7 +789,7 @@ TEST(SchedulerStateMachineTest, TestFullCycle) {
|
| state.SetNeedsCommit();
|
|
|
| // Begin the frame.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_COMMIT_STATE(
|
| @@ -837,7 +835,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithMainThreadLowLatencyMode) {
|
| state.SetNeedsCommit();
|
|
|
| // Begin the frame.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_COMMIT_STATE(
|
| @@ -867,7 +865,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithMainThreadLowLatencyMode) {
|
|
|
| // Haven't draw since last commit, do not begin new main frame.
|
| state.SetNeedsCommit();
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| @@ -898,7 +896,7 @@ TEST(SchedulerStateMachineTest,
|
| state.SetNeedsCommit();
|
|
|
| // Begin the frame.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_COMMIT_STATE(
|
| @@ -929,7 +927,7 @@ TEST(SchedulerStateMachineTest,
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| // Cannot BeginMainFrame yet since last commit is not yet activated and drawn.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_COMMIT_STATE(
|
| SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_ACTIVATION);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -950,7 +948,7 @@ TEST(SchedulerStateMachineTest,
|
| state.DidSwapBuffersComplete();
|
|
|
| // Haven't draw since last commit, do not begin new main frame.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| @@ -978,7 +976,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) {
|
| state.SetNeedsCommit();
|
|
|
| // Begin the frame.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_COMMIT_STATE(
|
| @@ -1018,7 +1016,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) {
|
| EXPECT_FALSE(state.needs_redraw());
|
|
|
| // Next BeginImplFrame should initiate second commit.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| }
|
| @@ -1044,7 +1042,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseInvisible) {
|
| state.SetNeedsCommit();
|
|
|
| // Begin the frame while visible.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_COMMIT_STATE(
|
| @@ -1078,7 +1076,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseInvisible) {
|
| EXPECT_TRUE(state.NeedsCommit());
|
|
|
| // Start a new frame.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
|
|
| @@ -1100,7 +1098,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) {
|
|
|
| // Get into a begin frame / commit state.
|
| state.SetNeedsCommit();
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_COMMIT_STATE(
|
| @@ -1129,7 +1127,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) {
|
| EXPECT_FALSE(state.NeedsCommit());
|
| EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
|
|
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| state.OnBeginImplFrameDeadline();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -1137,7 +1135,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) {
|
| // Verify another commit can start if requested, though.
|
| state.SetNeedsCommit();
|
| EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| }
|
|
|
| @@ -1154,14 +1152,14 @@ TEST(SchedulerStateMachineTest, TestFirstContextCreation) {
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| // Check that the first init does not SetNeedsCommit.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| 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.SetNeedsCommit();
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| }
|
| @@ -1185,7 +1183,7 @@ TEST(SchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) {
|
| state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
|
|
|
| // When the context is recreated, we should begin a commit.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| }
|
| @@ -1209,14 +1207,14 @@ TEST(SchedulerStateMachineTest,
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| // Once context recreation begins, nothing should happen.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| 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.SetNeedsCommit();
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| state.OnBeginImplFrameDeadline();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -1232,7 +1230,7 @@ TEST(SchedulerStateMachineTest,
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| // When the BeginFrame comes in we should begin a commit
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -1258,7 +1256,7 @@ TEST(SchedulerStateMachineTest,
|
| // Finishing the first commit after initializing an output surface should
|
| // automatically cause a redraw.
|
| EXPECT_TRUE(state.RedrawPending());
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| state.OnBeginImplFrameDeadline();
|
| @@ -1268,7 +1266,7 @@ TEST(SchedulerStateMachineTest,
|
| EXPECT_FALSE(state.RedrawPending());
|
|
|
| // Next frame as no work to do.
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| state.OnBeginImplFrameDeadline();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -1276,7 +1274,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(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| state.OnBeginImplFrameDeadline();
|
| @@ -1292,7 +1290,7 @@ TEST(SchedulerStateMachineTest,
|
| // SetCanDraw if waiting on first draw after activate.
|
| state.SetNeedsRedraw(true);
|
| state.SetNeedsCommit();
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| @@ -1326,7 +1324,7 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress) {
|
|
|
| // Set damage and expect a draw.
|
| state.SetNeedsRedraw(true);
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| @@ -1359,7 +1357,7 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress) {
|
| EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
|
| EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
|
|
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_IMPL_FRAME_STATE(
|
| SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING);
|
| EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
|
| @@ -1387,7 +1385,7 @@ TEST(SchedulerStateMachineTest,
|
|
|
| // Set damage and expect a draw.
|
| state.SetNeedsRedraw(true);
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| @@ -1420,7 +1418,7 @@ TEST(SchedulerStateMachineTest,
|
| EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
|
| EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
|
|
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_IMPL_FRAME_STATE(
|
| SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING);
|
| EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
|
| @@ -1441,7 +1439,7 @@ TEST(SchedulerStateMachineTest,
|
|
|
| // After we get a new output surface, the commit flow should start.
|
| state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -1472,7 +1470,7 @@ TEST(SchedulerStateMachineTest, DontDrawBeforeCommitAfterLostOutputSurface) {
|
| state.DidCreateAndInitializeOutputSurface();
|
|
|
| EXPECT_FALSE(state.RedrawPending());
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| }
|
|
|
| @@ -1586,7 +1584,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(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
|
|
| // As a response the compositor requests a redraw and a commit to tell the
|
| // main thread about the new scroll offset.
|
| @@ -1621,7 +1619,7 @@ void FinishPreviousCommitAndDrawWithoutExitingDeadline(
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| @@ -1642,7 +1640,7 @@ TEST(SchedulerStateMachineTest, TestImplLatencyTakesPriority) {
|
| // in prefer impl latency mode.
|
| state.SetNeedsRedraw(true);
|
| state.SetNeedsCommit();
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| @@ -1679,7 +1677,7 @@ TEST(SchedulerStateMachineTest, TestImplLatencyTakesPriority) {
|
| // and did not just swap.
|
| state.SetNeedsCommit();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately());
|
| state.OnBeginImplFrameDeadline();
|
| @@ -1694,7 +1692,7 @@ TEST(SchedulerStateMachineTest,
|
|
|
| state.SetNeedsCommit();
|
|
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -1717,7 +1715,7 @@ TEST(SchedulerStateMachineTest, TestSetNeedsAnimate) {
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
|
|
| state.OnBeginImplFrameDeadlinePending();
|
| @@ -1739,7 +1737,7 @@ TEST(SchedulerStateMachineTest, TestAnimateBeforeCommit) {
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
|
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| @@ -1763,7 +1761,7 @@ TEST(SchedulerStateMachineTest, TestAnimateAfterCommitBeforeDraw) {
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
|
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| @@ -1791,7 +1789,7 @@ TEST(SchedulerStateMachineTest, TestSetNeedsAnimateAfterAnimate) {
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE);
|
|
|
| state.SetNeedsAnimate();
|
| @@ -1823,17 +1821,30 @@ TEST(SchedulerStateMachineTest, TestDeferCommit) {
|
| EXPECT_TRUE(state.BeginFrameNeeded());
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| state.OnBeginImplFrameDeadline();
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
|
|
| state.SetDeferCommits(false);
|
| - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
|
| + state.OnBeginImplFrame();
|
| EXPECT_ACTION_UPDATE_STATE(
|
| SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
|
| }
|
|
|
| +TEST(SchedulerStateMachineTest, EarlyOutCommitWantsProactiveBeginFrame) {
|
| + SchedulerSettings settings;
|
| + StateMachine state(settings);
|
| + SET_UP_STATE(state);
|
| +
|
| + EXPECT_FALSE(state.ProactiveBeginFrameWanted());
|
| + bool commit_has_no_updates = true;
|
| + state.UpdateStateOnCommit(commit_has_no_updates);
|
| + EXPECT_TRUE(state.ProactiveBeginFrameWanted());
|
| + state.OnBeginImplFrame();
|
| + EXPECT_FALSE(state.ProactiveBeginFrameWanted());
|
| +}
|
| +
|
| } // namespace
|
| } // namespace cc
|
|
|