| 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 "cc/scheduler/scheduler.h" | 7 #include "cc/scheduler/scheduler.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 #define EXPECT_ACTION_UPDATE_STATE(action) \ | 10 #define EXPECT_ACTION_UPDATE_STATE(action) \ |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // Failing the draw makes us require a commit. | 200 // Failing the draw makes us require a commit. |
| 201 state.DidDrawIfPossibleCompleted( | 201 state.DidDrawIfPossibleCompleted( |
| 202 DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS); | 202 DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS); |
| 203 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting()); | 203 state.OnBeginImplFrame(BeginFrameArgs::CreateForTesting()); |
| 204 EXPECT_ACTION_UPDATE_STATE( | 204 EXPECT_ACTION_UPDATE_STATE( |
| 205 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); | 205 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
| 206 EXPECT_TRUE(state.RedrawPending()); | 206 EXPECT_TRUE(state.RedrawPending()); |
| 207 EXPECT_TRUE(state.CommitPending()); | 207 EXPECT_TRUE(state.CommitPending()); |
| 208 } | 208 } |
| 209 | 209 |
| 210 TEST(SchedulerStateMachineTest, TestFailedDrawForMissingHighResDoesNothing) { | 210 TEST(SchedulerStateMachineTest, TestFailedDrawForMissingHighResNeedsCommit) { |
| 211 SchedulerSettings default_scheduler_settings; | 211 SchedulerSettings default_scheduler_settings; |
| 212 StateMachine state(default_scheduler_settings); | 212 StateMachine state(default_scheduler_settings); |
| 213 state.SetCanStart(); | 213 state.SetCanStart(); |
| 214 state.UpdateState(state.NextAction()); | 214 state.UpdateState(state.NextAction()); |
| 215 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); | 215 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); |
| 216 state.SetVisible(true); | 216 state.SetVisible(true); |
| 217 state.SetCanDraw(true); | 217 state.SetCanDraw(true); |
| 218 state.SetNeedsRedraw(true); | 218 state.SetNeedsRedraw(true); |
| 219 EXPECT_TRUE(state.RedrawPending()); | 219 EXPECT_TRUE(state.RedrawPending()); |
| 220 EXPECT_TRUE(state.BeginImplFrameNeeded()); | 220 EXPECT_TRUE(state.BeginImplFrameNeeded()); |
| (...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 1786 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1787 | 1787 |
| 1788 // The deadline is not triggered early until we enter prefer smoothness mode. | 1788 // The deadline is not triggered early until we enter prefer smoothness mode. |
| 1789 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); | 1789 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); |
| 1790 state.SetSmoothnessTakesPriority(true); | 1790 state.SetSmoothnessTakesPriority(true); |
| 1791 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); | 1791 EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); |
| 1792 } | 1792 } |
| 1793 | 1793 |
| 1794 } // namespace | 1794 } // namespace |
| 1795 } // namespace cc | 1795 } // namespace cc |
| OLD | NEW |