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); | |
1772 } | 1762 } |
1773 | 1763 |
1774 TEST(SchedulerStateMachineTest, | 1764 TEST(SchedulerStateMachineTest, |
1775 TestTriggerDeadlineImmediatelyOnLostOutputSurface) { | 1765 TestTriggerDeadlineImmediatelyOnLostOutputSurface) { |
1776 SchedulerSettings default_scheduler_settings; | 1766 SchedulerSettings default_scheduler_settings; |
1777 StateMachine state(default_scheduler_settings); | 1767 StateMachine state(default_scheduler_settings); |
1778 SET_UP_STATE(state) | 1768 SET_UP_STATE(state) |
1779 | 1769 |
1780 state.SetNeedsCommit(); | 1770 state.SetNeedsCommit(); |
1781 | 1771 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); | 1918 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); |
1929 bool commit_has_no_updates = true; | 1919 bool commit_has_no_updates = true; |
1930 state.UpdateStateOnCommit(commit_has_no_updates); | 1920 state.UpdateStateOnCommit(commit_has_no_updates); |
1931 EXPECT_TRUE(state.ProactiveBeginFrameWanted()); | 1921 EXPECT_TRUE(state.ProactiveBeginFrameWanted()); |
1932 state.OnBeginImplFrame(); | 1922 state.OnBeginImplFrame(); |
1933 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); | 1923 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); |
1934 } | 1924 } |
1935 | 1925 |
1936 } // namespace | 1926 } // namespace |
1937 } // namespace cc | 1927 } // namespace cc |
OLD | NEW |