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

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: Created 5 years, 1 month 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 // Start a new frame. 1259 // Start a new frame.
1260 state.OnBeginImplFrame(); 1260 state.OnBeginImplFrame();
1261 EXPECT_ACTION_UPDATE_STATE( 1261 EXPECT_ACTION_UPDATE_STATE(
1262 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); 1262 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
1263 1263
1264 // We should be starting the commit now. 1264 // We should be starting the commit now.
1265 EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); 1265 EXPECT_MAIN_FRAME_STATE(SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT);
1266 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1266 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1267 } 1267 }
1268 1268
1269 // See ThreadProxy::BeginMainFrame "EarlyOut_NoUpdates" case. 1269 // See ProxyMain::BeginMainFrame "EarlyOut_NoUpdates" case.
1270 TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) { 1270 TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) {
1271 SchedulerSettings default_scheduler_settings; 1271 SchedulerSettings default_scheduler_settings;
1272 StateMachine state(default_scheduler_settings); 1272 StateMachine state(default_scheduler_settings);
1273 state.SetVisible(true); 1273 state.SetVisible(true);
1274 EXPECT_ACTION_UPDATE_STATE( 1274 EXPECT_ACTION_UPDATE_STATE(
1275 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); 1275 SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
1276 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 1276 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
1277 state.DidCreateAndInitializeOutputSurface(); 1277 state.DidCreateAndInitializeOutputSurface();
1278 state.SetCanDraw(true); 1278 state.SetCanDraw(true);
1279 1279
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); 2126 EXPECT_FALSE(state.ProactiveBeginFrameWanted());
2127 bool commit_has_no_updates = true; 2127 bool commit_has_no_updates = true;
2128 state.WillCommit(commit_has_no_updates); 2128 state.WillCommit(commit_has_no_updates);
2129 EXPECT_TRUE(state.ProactiveBeginFrameWanted()); 2129 EXPECT_TRUE(state.ProactiveBeginFrameWanted());
2130 state.OnBeginImplFrame(); 2130 state.OnBeginImplFrame();
2131 EXPECT_FALSE(state.ProactiveBeginFrameWanted()); 2131 EXPECT_FALSE(state.ProactiveBeginFrameWanted());
2132 } 2132 }
2133 2133
2134 } // namespace 2134 } // namespace
2135 } // namespace cc 2135 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698