| 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 2c4a8f1f96cdcd476e1aa508e5984a44dddd1529..8ee6ca12074a70a88a845e7c3eeb0285c5ce53cb 100644
|
| --- a/cc/scheduler/scheduler_state_machine_unittest.cc
|
| +++ b/cc/scheduler/scheduler_state_machine_unittest.cc
|
| @@ -71,7 +71,6 @@ class StateMachine : public SchedulerStateMachine {
|
| bool NeedsCommit() const { return needs_commit_; }
|
|
|
| void SetNeedsRedraw(bool b) { needs_redraw_ = b; }
|
| - bool NeedsRedraw() const { return needs_redraw_; }
|
|
|
| void SetNeedsForcedRedrawForTimeout(bool b) {
|
| forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_COMMIT;
|
| @@ -664,7 +663,7 @@ TEST(SchedulerStateMachineTest, TestFullCycle) {
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
|
| EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW,
|
| state.CommitState());
|
| - EXPECT_TRUE(state.NeedsRedraw());
|
| + EXPECT_TRUE(state.needs_redraw());
|
|
|
| // Expect to do nothing until BeginFrame deadline
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -678,7 +677,7 @@ TEST(SchedulerStateMachineTest, TestFullCycle) {
|
| // Should be synchronized, no draw needed, no action needed.
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_IDLE, state.CommitState());
|
| - EXPECT_FALSE(state.NeedsRedraw());
|
| + EXPECT_FALSE(state.needs_redraw());
|
| }
|
|
|
| TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) {
|
| @@ -715,7 +714,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) {
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
|
| EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW,
|
| state.CommitState());
|
| - EXPECT_TRUE(state.NeedsRedraw());
|
| + EXPECT_TRUE(state.needs_redraw());
|
|
|
| // Expect to do nothing until BeginFrame deadline.
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| @@ -729,7 +728,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) {
|
| // Should be synchronized, no draw needed, no action needed.
|
| EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| EXPECT_EQ(SchedulerStateMachine::COMMIT_STATE_IDLE, state.CommitState());
|
| - EXPECT_FALSE(state.NeedsRedraw());
|
| + EXPECT_FALSE(state.needs_redraw());
|
|
|
| // Next BeginFrame should initiate second commit.
|
| state.OnBeginFrame(BeginFrameArgs::CreateForTesting());
|
| @@ -1614,5 +1613,38 @@ TEST(SchedulerStateMachineTest, AcquireTexturesWithAbort) {
|
| EXPECT_FALSE(state.PendingDrawsShouldBeAborted());
|
| }
|
|
|
| +TEST(SchedulerStateMachineTest,
|
| + TestTriggerDeadlineEarlyAfterAbortedCommit) {
|
| + SchedulerSettings settings;
|
| + settings.deadline_scheduling_enabled = true;
|
| + settings.impl_side_painting = true;
|
| + StateMachine state(settings);
|
| + state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
|
| + state.SetVisible(true);
|
| + state.SetCanDraw(true);
|
| +
|
| + // This test mirrors what happens during the first frame of a scroll gesture.
|
| + // First we get the input event and a BeginFrame.
|
| + state.OnBeginFrame(BeginFrameArgs::CreateForTesting());
|
| +
|
| + // As a response the compositor requests a redraw and a commit to tell the
|
| + // main thread about the new scroll offset.
|
| + state.SetNeedsRedraw(true);
|
| + state.SetNeedsCommit();
|
| +
|
| + // We should start the commit normally.
|
| + EXPECT_ACTION_UPDATE_STATE(
|
| + SchedulerStateMachine::ACTION_SEND_BEGIN_FRAME_TO_MAIN_THREAD);
|
| + EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
|
| +
|
| + // Since only the scroll offset changed, the main thread will abort the
|
| + // commit.
|
| + state.BeginFrameAbortedByMainThread(true);
|
| +
|
| + // Since the commit was aborted, we should draw right away instead of waiting
|
| + // for the deadline.
|
| + EXPECT_TRUE(state.ShouldTriggerBeginFrameDeadlineEarly());
|
| +}
|
| +
|
| } // namespace
|
| } // namespace cc
|
|
|