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 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1752 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state); | 1752 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state); |
1753 EXPECT_ACTION_UPDATE_STATE( | 1753 EXPECT_ACTION_UPDATE_STATE( |
1754 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); | 1754 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
1755 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 1755 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
1756 state.DidSwapBuffersComplete(); | 1756 state.DidSwapBuffersComplete(); |
1757 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 1757 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
1758 | 1758 |
1759 // Finish the previous commit and draw it. | 1759 // Finish the previous commit and draw it. |
1760 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state); | 1760 FinishPreviousCommitAndDrawWithoutExitingDeadline(&state); |
1761 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 1761 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1762 |
| 1763 // Verify we do not send another BeginMainFrame if was are swap throttled |
| 1764 // and did not just swap. |
| 1765 state.SetNeedsCommit(); |
| 1766 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1767 state.OnBeginImplFrame(); |
| 1768 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1769 EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); |
| 1770 state.OnBeginImplFrameDeadline(); |
| 1771 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
1762 } | 1772 } |
1763 | 1773 |
1764 TEST(SchedulerStateMachineTest, | 1774 TEST(SchedulerStateMachineTest, |
1765 TestTriggerDeadlineImmediatelyOnLostOutputSurface) { | 1775 TestTriggerDeadlineImmediatelyOnLostOutputSurface) { |
1766 SchedulerSettings default_scheduler_settings; | 1776 SchedulerSettings default_scheduler_settings; |
1767 StateMachine state(default_scheduler_settings); | 1777 StateMachine state(default_scheduler_settings); |
1768 SET_UP_STATE(state) | 1778 SET_UP_STATE(state) |
1769 | 1779 |
1770 state.SetNeedsCommit(); | 1780 state.SetNeedsCommit(); |
1771 | 1781 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); | 1928 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); |
1919 bool commit_has_no_updates = true; | 1929 bool commit_has_no_updates = true; |
1920 state.UpdateStateOnCommit(commit_has_no_updates); | 1930 state.UpdateStateOnCommit(commit_has_no_updates); |
1921 EXPECT_TRUE(state.ProactiveBeginFrameWanted()); | 1931 EXPECT_TRUE(state.ProactiveBeginFrameWanted()); |
1922 state.OnBeginImplFrame(); | 1932 state.OnBeginImplFrame(); |
1923 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); | 1933 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); |
1924 } | 1934 } |
1925 | 1935 |
1926 } // namespace | 1936 } // namespace |
1927 } // namespace cc | 1937 } // namespace cc |
OLD | NEW |