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/debug/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 #define EXPECT_ACTION_UPDATE_STATE(action) \ | 12 #define EXPECT_ACTION_UPDATE_STATE(action) \ |
13 EXPECT_EQ(action, state.NextAction()) << state.AsValue()->ToString(); \ | 13 EXPECT_STREQ(SchedulerStateMachine::ActionToString(action), \ |
| 14 SchedulerStateMachine::ActionToString(state.NextAction())) \ |
| 15 << state.AsValue()->ToPrettyString(); \ |
14 if (action == SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE || \ | 16 if (action == SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE || \ |
15 action == SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED) { \ | 17 action == SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED) { \ |
16 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, \ | 18 EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, \ |
17 state.begin_impl_frame_state()) \ | 19 state.begin_impl_frame_state()) \ |
18 << state.AsValue()->ToString(); \ | 20 << state.AsValue()->ToPrettyString(); \ |
19 } \ | 21 } \ |
20 state.UpdateState(action); \ | 22 state.UpdateState(action); \ |
21 if (action == SchedulerStateMachine::ACTION_NONE) { \ | 23 if (action == SchedulerStateMachine::ACTION_NONE) { \ |
22 if (state.begin_impl_frame_state() == \ | 24 if (state.begin_impl_frame_state() == \ |
23 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING) \ | 25 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING) \ |
24 state.OnBeginImplFrameDeadlinePending(); \ | 26 state.OnBeginImplFrameDeadlinePending(); \ |
25 if (state.begin_impl_frame_state() == \ | 27 if (state.begin_impl_frame_state() == \ |
26 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) \ | 28 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE) \ |
27 state.OnBeginImplFrameIdle(); \ | 29 state.OnBeginImplFrameIdle(); \ |
28 } | 30 } |
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 state.SetNeedsAnimate(); | 1783 state.SetNeedsAnimate(); |
1782 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 1784 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
1783 | 1785 |
1784 state.OnBeginImplFrameDeadline(); | 1786 state.OnBeginImplFrameDeadline(); |
1785 EXPECT_ACTION_UPDATE_STATE( | 1787 EXPECT_ACTION_UPDATE_STATE( |
1786 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); | 1788 SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); |
1787 } | 1789 } |
1788 | 1790 |
1789 } // namespace | 1791 } // namespace |
1790 } // namespace cc | 1792 } // namespace cc |
OLD | NEW |