| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/scheduler/scheduler_state_machine.h" | 5 #include "cc/scheduler/scheduler_state_machine.h" |
| 6 | 6 |
| 7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 8 #include "cc/scheduler/scheduler.h" | 8 #include "cc/scheduler/scheduler.h" |
| 9 #include "cc/test/begin_frame_args_test.h" | 9 #include "cc/test/begin_frame_args_test.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 EXPECT_ACTION_UPDATE_STATE( | 324 EXPECT_ACTION_UPDATE_STATE( |
| 325 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); | 325 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
| 326 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 326 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 327 | 327 |
| 328 // Verify the pending commit doesn't overwrite the pending | 328 // Verify the pending commit doesn't overwrite the pending |
| 329 // tree until the pending tree has been activated. | 329 // tree until the pending tree has been activated. |
| 330 state.NotifyBeginMainFrameStarted(); | 330 state.NotifyBeginMainFrameStarted(); |
| 331 state.NotifyReadyToCommit(); | 331 state.NotifyReadyToCommit(); |
| 332 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 332 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 333 | 333 |
| 334 // Verify NotifyReadyToActivate unblocks activation, draw, and | 334 // Verify NotifyReadyToActivate unblocks activation, commit, and |
| 335 // commit in that order. | 335 // draw in that order. |
| 336 state.NotifyReadyToActivate(); | 336 state.NotifyReadyToActivate(); |
| 337 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE); | 337 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE); |
| 338 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); |
| 338 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 339 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 339 | 340 |
| 340 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); | 341 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); |
| 341 state.OnBeginImplFrameDeadline(); | 342 state.OnBeginImplFrameDeadline(); |
| 342 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); | 343 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); |
| 343 EXPECT_ACTION_UPDATE_STATE( | 344 EXPECT_ACTION_UPDATE_STATE( |
| 344 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); | 345 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); |
| 345 state.DidSwapBuffers(); | 346 state.DidSwapBuffers(); |
| 346 state.DidSwapBuffersComplete(); | 347 state.DidSwapBuffersComplete(); |
| 347 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); | |
| 348 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 348 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 349 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); | 349 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); |
| 350 } | 350 } |
| 351 | 351 |
| 352 TEST(SchedulerStateMachineTest, | 352 TEST(SchedulerStateMachineTest, |
| 353 TestFailedDrawForAnimationCheckerboardSetsNeedsCommitAndDoesNotDrawAgain) { | 353 TestFailedDrawForAnimationCheckerboardSetsNeedsCommitAndDoesNotDrawAgain) { |
| 354 SchedulerSettings default_scheduler_settings; | 354 SchedulerSettings default_scheduler_settings; |
| 355 StateMachine state(default_scheduler_settings); | 355 StateMachine state(default_scheduler_settings); |
| 356 SET_UP_STATE(state) | 356 SET_UP_STATE(state) |
| 357 state.SetNeedsRedraw(true); | 357 state.SetNeedsRedraw(true); |
| (...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); | 1968 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); |
| 1969 bool commit_has_no_updates = true; | 1969 bool commit_has_no_updates = true; |
| 1970 state.UpdateStateOnCommit(commit_has_no_updates); | 1970 state.UpdateStateOnCommit(commit_has_no_updates); |
| 1971 EXPECT_TRUE(state.ProactiveBeginFrameWanted()); | 1971 EXPECT_TRUE(state.ProactiveBeginFrameWanted()); |
| 1972 state.OnBeginImplFrame(); | 1972 state.OnBeginImplFrame(); |
| 1973 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); | 1973 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); |
| 1974 } | 1974 } |
| 1975 | 1975 |
| 1976 } // namespace | 1976 } // namespace |
| 1977 } // namespace cc | 1977 } // namespace cc |
| OLD | NEW |