Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: cc/scheduler/scheduler_state_machine_unittest.cc

Issue 1417053005: cc: Split ThreadProxy into ProxyMain and ProxyImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from #18. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
2131 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); 2131 EXPECT_FALSE(state.ProactiveBeginFrameWanted());
2132 bool commit_has_no_updates = true; 2132 bool commit_has_no_updates = true;
2133 state.WillCommit(commit_has_no_updates); 2133 state.WillCommit(commit_has_no_updates);
2134 EXPECT_TRUE(state.ProactiveBeginFrameWanted()); 2134 EXPECT_TRUE(state.ProactiveBeginFrameWanted());
2135 state.OnBeginImplFrame(); 2135 state.OnBeginImplFrame();
2136 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); 2136 EXPECT_FALSE(state.ProactiveBeginFrameWanted());
2137 } 2137 }
2138 2138
2139 } // namespace 2139 } // namespace
2140 } // namespace cc 2140 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698