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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCSchedulerStateMachine.h" | 7 #include "CCSchedulerStateMachine.h" |
8 | 8 |
9 #include <gtest/gtest.h> | 9 #include <gtest/gtest.h> |
10 #include <wtf/text/CString.h> | 10 #include <wtf/text/CString.h> |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 EXPECT_FALSE(state.needsCommit()); | 803 EXPECT_FALSE(state.needsCommit()); |
804 EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); | 804 EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); |
805 | 805 |
806 // Become invisible and abort the beginFrame. | 806 // Become invisible and abort the beginFrame. |
807 state.setVisible(false); | 807 state.setVisible(false); |
808 state.beginFrameAborted(); | 808 state.beginFrameAborted(); |
809 | 809 |
810 // We should now be back in the idle state as if we didn't start a frame at
all. | 810 // We should now be back in the idle state as if we didn't start a frame at
all. |
811 EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); | 811 EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); |
812 EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); | 812 EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction()); |
| 813 |
| 814 // Become visible again |
| 815 state.setVisible(true); |
| 816 |
| 817 // We should be beginning a frame now |
| 818 EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState()); |
| 819 EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); |
| 820 |
| 821 // Begin the frame |
| 822 state.updateState(state.nextAction()); |
| 823 |
| 824 // We should be starting the commit now |
| 825 EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS, state.com
mitState()); |
813 } | 826 } |
814 | 827 |
815 TEST(CCSchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) | 828 TEST(CCSchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) |
816 { | 829 { |
817 StateMachine state; | 830 StateMachine state; |
818 state.setCanBeginFrame(true); | 831 state.setCanBeginFrame(true); |
819 state.setVisible(true); | 832 state.setVisible(true); |
820 | 833 |
821 state.didLoseContext(); | 834 state.didLoseContext(); |
822 | 835 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 StateMachine state; | 1049 StateMachine state; |
1037 state.setCanBeginFrame(true); | 1050 state.setCanBeginFrame(true); |
1038 state.setVisible(true); | 1051 state.setVisible(true); |
1039 state.setNeedsCommit(true); | 1052 state.setNeedsCommit(true); |
1040 state.setNeedsForcedCommit(true); | 1053 state.setNeedsForcedCommit(true); |
1041 state.didLoseContext(); | 1054 state.didLoseContext(); |
1042 EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); | 1055 EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_FRAME, state.nextAction()); |
1043 } | 1056 } |
1044 | 1057 |
1045 } | 1058 } |
OLD | NEW |