| 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 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); | 1206 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); |
| 1207 state.SetVisible(false); | 1207 state.SetVisible(false); |
| 1208 state.DidLoseOutputSurface(); | 1208 state.DidLoseOutputSurface(); |
| 1209 state.SetNeedsBeginMainFrame(); | 1209 state.SetNeedsBeginMainFrame(); |
| 1210 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 1210 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1211 state.SetVisible(true); | 1211 state.SetVisible(true); |
| 1212 EXPECT_ACTION_UPDATE_STATE( | 1212 EXPECT_ACTION_UPDATE_STATE( |
| 1213 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); | 1213 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); |
| 1214 } | 1214 } |
| 1215 | 1215 |
| 1216 // See ThreadProxy::BeginMainFrame "EarlyOut_NotVisible" / | 1216 // See ProxyMain::BeginMainFrame "EarlyOut_NotVisible" / |
| 1217 // "EarlyOut_OutputSurfaceLost" cases. | 1217 // "EarlyOut_OutputSurfaceLost" cases. |
| 1218 TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseInvisible) { | 1218 TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseInvisible) { |
| 1219 SchedulerSettings default_scheduler_settings; | 1219 SchedulerSettings default_scheduler_settings; |
| 1220 StateMachine state(default_scheduler_settings); | 1220 StateMachine state(default_scheduler_settings); |
| 1221 SET_UP_STATE(state) | 1221 SET_UP_STATE(state) |
| 1222 | 1222 |
| 1223 // Start clean and set commit. | 1223 // Start clean and set commit. |
| 1224 state.SetNeedsBeginMainFrame(); | 1224 state.SetNeedsBeginMainFrame(); |
| 1225 | 1225 |
| 1226 // Begin the frame while visible. | 1226 // Begin the frame while visible. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 // Start a new frame. | 1260 // Start a new frame. |
| 1261 state.OnBeginImplFrame(); | 1261 state.OnBeginImplFrame(); |
| 1262 EXPECT_ACTION_UPDATE_STATE( | 1262 EXPECT_ACTION_UPDATE_STATE( |
| 1263 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); | 1263 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); |
| 1264 | 1264 |
| 1265 // We should be starting the commit now. | 1265 // We should be starting the commit now. |
| 1266 EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); | 1266 EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); |
| 1267 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 1267 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 // See ThreadProxy::BeginMainFrame "EarlyOut_NoUpdates" case. | 1270 // See ProxyMain::BeginMainFrame "EarlyOut_NoUpdates" case. |
| 1271 TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) { | 1271 TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) { |
| 1272 SchedulerSettings default_scheduler_settings; | 1272 SchedulerSettings default_scheduler_settings; |
| 1273 StateMachine state(default_scheduler_settings); | 1273 StateMachine state(default_scheduler_settings); |
| 1274 state.SetVisible(true); | 1274 state.SetVisible(true); |
| 1275 EXPECT_ACTION_UPDATE_STATE( | 1275 EXPECT_ACTION_UPDATE_STATE( |
| 1276 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); | 1276 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); |
| 1277 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | 1277 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); |
| 1278 state.DidCreateAndInitializeOutputSurface(); | 1278 state.DidCreateAndInitializeOutputSurface(); |
| 1279 state.SetCanDraw(true); | 1279 state.SetCanDraw(true); |
| 1280 | 1280 |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2129 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); | 2129 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); |
| 2130 bool commit_has_no_updates = true; | 2130 bool commit_has_no_updates = true; |
| 2131 state.WillCommit(commit_has_no_updates); | 2131 state.WillCommit(commit_has_no_updates); |
| 2132 EXPECT_TRUE(state.ProactiveBeginFrameWanted()); | 2132 EXPECT_TRUE(state.ProactiveBeginFrameWanted()); |
| 2133 state.OnBeginImplFrame(); | 2133 state.OnBeginImplFrame(); |
| 2134 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); | 2134 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); |
| 2135 } | 2135 } |
| 2136 | 2136 |
| 2137 } // namespace | 2137 } // namespace |
| 2138 } // namespace cc | 2138 } // namespace cc |
| OLD | NEW |