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/debug/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" |
11 | 11 |
12 // Macro to compare two enum values and get nice output. | 12 // Macro to compare two enum values and get nice output. |
13 // Without: | 13 // Without: |
14 // Value of: actual() Actual: 7 | 14 // Value of: actual() Actual: 7 |
15 // Expected: expected() Which is: 0 | 15 // Expected: expected() Which is: 0 |
16 // With: | 16 // With: |
17 // Value of: actual() Actual: "ACTION_ANIMATE" | 17 // Value of: actual() Actual: "ACTION_ANIMATE" |
(...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1806 SchedulerSettings settings; | 1806 SchedulerSettings settings; |
1807 settings.forward_begin_frames_to_children = true; | 1807 settings.forward_begin_frames_to_children = true; |
1808 StateMachine state(settings); | 1808 StateMachine state(settings); |
1809 SET_UP_STATE(state) | 1809 SET_UP_STATE(state) |
1810 | 1810 |
1811 EXPECT_FALSE(state.BeginFrameNeeded()); | 1811 EXPECT_FALSE(state.BeginFrameNeeded()); |
1812 state.SetChildrenNeedBeginFrames(true); | 1812 state.SetChildrenNeedBeginFrames(true); |
1813 EXPECT_TRUE(state.BeginFrameNeeded()); | 1813 EXPECT_TRUE(state.BeginFrameNeeded()); |
1814 } | 1814 } |
1815 | 1815 |
| 1816 TEST(SchedulerStateMachineTest, TestDeferCommit) { |
| 1817 SchedulerSettings settings; |
| 1818 StateMachine state(settings); |
| 1819 SET_UP_STATE(state) |
| 1820 |
| 1821 state.SetDeferCommits(true); |
| 1822 |
| 1823 state.SetNeedsCommit(); |
| 1824 EXPECT_TRUE(state.BeginFrameNeeded()); |
| 1825 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1826 |
| 1827 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
| 1828 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1829 |
| 1830 state.OnBeginImplFrameDeadline(); |
| 1831 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1832 |
| 1833 state.SetDeferCommits(false); |
| 1834 state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
| 1835 EXPECT_ACTION_UPDATE_STATE( |
| 1836 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
| 1837 } |
| 1838 |
1816 } // namespace | 1839 } // namespace |
1817 } // namespace cc | 1840 } // namespace cc |
OLD | NEW |