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 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state); | 1723 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state); |
1724 EXPECT_ACTION_UPDATE_STATE( | 1724 EXPECT_ACTION_UPDATE_STATE( |
1725 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); | 1725 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
1726 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 1726 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
1727 state.DidSwapBuffersComplete(); | 1727 state.DidSwapBuffersComplete(); |
1728 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 1728 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
1729 | 1729 |
1730 // Finish the previous commit and draw it. | 1730 // Finish the previous commit and draw it. |
1731 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state); | 1731 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state); |
1732 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 1732 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
1733 | |
1734 // Verify we do not send another BeginMainFrame if was are swap throttled | |
1735 // and did not just swap. | |
1736 state.SetNeedsCommit(); | |
1737 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | |
1738 state.OnBeginImplFrame(); | |
1739 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | |
1740 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); | |
1741 state.OnBeginImplFrameDeadline(); | |
1742 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | |
1743 } | 1733 } |
1744 | 1734 |
1745 TEST(SchedulerStateMachineTest, | 1735 TEST(SchedulerStateMachineTest, |
1746 TestTriggerDeadlineImmediatelyOnLostOutputSurface) { | 1736 TestTriggerDeadlineImmediatelyOnLostOutputSurface) { |
1747 SchedulerSettings default_scheduler_settings; | 1737 SchedulerSettings default_scheduler_settings; |
1748 StateMachine state(default_scheduler_settings); | 1738 StateMachine state(default_scheduler_settings); |
1749 SET_UP_STATE(state) | 1739 SET_UP_STATE(state) |
1750 | 1740 |
1751 state.SetNeedsCommit(); | 1741 state.SetNeedsCommit(); |
1752 | 1742 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1899 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); | 1889 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); |
1900 bool commit_has_no_updates = true; | 1890 bool commit_has_no_updates = true; |
1901 state.UpdateStateOnCommit(commit_has_no_updates); | 1891 state.UpdateStateOnCommit(commit_has_no_updates); |
1902 EXPECT_TRUE(state.ProactiveBeginFrameWanted()); | 1892 EXPECT_TRUE(state.ProactiveBeginFrameWanted()); |
1903 state.OnBeginImplFrame(); | 1893 state.OnBeginImplFrame(); |
1904 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); | 1894 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); |
1905 } | 1895 } |
1906 | 1896 |
1907 } // namespace | 1897 } // namespace |
1908 } // namespace cc | 1898 } // namespace cc |
OLD | NEW |