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 aa5c4aac39a1164318196bfee92197fcbc1a2909..0eb422aa421dc2ec60ca27f06d1d10718364ce29 100644 |
--- a/cc/scheduler/scheduler_state_machine_unittest.cc |
+++ b/cc/scheduler/scheduler_state_machine_unittest.cc |
@@ -200,6 +200,10 @@ void PerformAction(StateMachine* sm, SchedulerStateMachine::Action action) { |
case SchedulerStateMachine::ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK: |
sm->WillInvalidateCompositorFrameSink(); |
return; |
+ |
+ case SchedulerStateMachine::ACTION_RUN_IMPL_SIDE_INVALIDATION: |
+ sm->WillRunImplSideInvalidation(); |
+ return; |
} |
} |
@@ -2123,5 +2127,40 @@ TEST(SchedulerStateMachineTest, |
SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); |
} |
+TEST(SchedulerStateMachineTest, ImplSideInvalidations) { |
+ SchedulerSettings settings; |
+ StateMachine state(settings); |
+ SET_UP_STATE(state); |
+ |
+ // Set up request for the main frame and commit to create a pending tree. |
+ state.SetNeedsBeginMainFrame(); |
+ state.OnBeginImplFrame(); |
+ state.OnBeginImplFrame(); |
+ EXPECT_ACTION_UPDATE_STATE( |
+ SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
+ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
+ |
+ state.NotifyBeginMainFrameStarted(); |
+ state.NotifyReadyToCommit(); |
+ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); |
+ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
+ |
+ // Request an impl-side invalidation after the commit. The request should wait |
+ // till the current pending tree is activated. |
+ state.SetNeedsImplSideInvalidation(); |
+ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
+ |
+ // Activate the pending tree. |
+ state.NotifyReadyToActivate(); |
+ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE); |
+ |
+ // Since there is no main frame request, activating the pending tree should |
+ // run impl-side invalidations. |
+ EXPECT_ACTION_UPDATE_STATE( |
+ SchedulerStateMachine::ACTION_RUN_IMPL_SIDE_INVALIDATION); |
+ |
+ // Request a main frame, followed by another impl-side invalidation request. |
+} |
+ |
} // namespace |
} // namespace cc |