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

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

Issue 13613003: cc: Make animations tick regardless of drawing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Drop extra statemachine function Created 7 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | cc/test/layer_tree_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/scheduler/scheduler.h" 7 #include "cc/scheduler/scheduler.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace cc { 10 namespace cc {
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 1070
1071 state.DidEnterVSync(); 1071 state.DidEnterVSync();
1072 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction()); 1072 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction());
1073 state.SetNeedsForcedRedraw(true); 1073 state.SetNeedsForcedRedraw(true);
1074 EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_FORCED, state.NextAction()); 1074 EXPECT_EQ(SchedulerStateMachine::ACTION_DRAW_FORCED, state.NextAction());
1075 state.UpdateState(state.NextAction()); 1075 state.UpdateState(state.NextAction());
1076 state.DidDrawIfPossibleCompleted(true); 1076 state.DidDrawIfPossibleCompleted(true);
1077 state.DidLeaveVSync(); 1077 state.DidLeaveVSync();
1078 } 1078 }
1079 1079
1080 TEST(SchedulerStateMachineTest, ReportIfNotDrawing) {
1081 SchedulerSettings default_scheduler_settings;
1082 SchedulerStateMachine state(default_scheduler_settings);
1083
1084 state.SetCanDraw(true);
1085 state.SetVisible(true);
1086 EXPECT_FALSE(state.DrawSuspendedUntilCommit());
1087
1088 state.SetCanDraw(false);
1089 state.SetVisible(true);
1090 EXPECT_TRUE(state.DrawSuspendedUntilCommit());
1091
1092 state.SetCanDraw(true);
1093 state.SetVisible(false);
1094 EXPECT_TRUE(state.DrawSuspendedUntilCommit());
1095
1096 state.SetCanDraw(false);
1097 state.SetVisible(false);
1098 EXPECT_TRUE(state.DrawSuspendedUntilCommit());
1099
1100 state.SetCanDraw(true);
1101 state.SetVisible(true);
1102 EXPECT_FALSE(state.DrawSuspendedUntilCommit());
1103 }
1104
1105 TEST(SchedulerStateMachineTest, ReportIfNotDrawingFromAcquiredTextures) {
1106 SchedulerSettings default_scheduler_settings;
1107 SchedulerStateMachine state(default_scheduler_settings);
1108 state.SetCanBeginFrame(true);
1109 state.SetCanDraw(true);
1110 state.SetVisible(true);
1111 EXPECT_FALSE(state.DrawSuspendedUntilCommit());
1112
1113 state.SetMainThreadNeedsLayerTextures();
1114 EXPECT_EQ(
1115 SchedulerStateMachine::ACTION_ACQUIRE_LAYER_TEXTURES_FOR_MAIN_THREAD,
1116 state.NextAction());
1117 state.UpdateState(state.NextAction());
1118 EXPECT_TRUE(state.DrawSuspendedUntilCommit());
1119
1120 EXPECT_EQ(SchedulerStateMachine::ACTION_BEGIN_FRAME, state.NextAction());
1121
1122 state.UpdateState(state.NextAction());
1123 EXPECT_TRUE(state.DrawSuspendedUntilCommit());
1124
1125 EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.NextAction());
1126
1127 state.BeginFrameComplete();
1128 EXPECT_TRUE(state.DrawSuspendedUntilCommit());
1129
1130 EXPECT_EQ(SchedulerStateMachine::ACTION_COMMIT, state.NextAction());
1131
1132 state.UpdateState(state.NextAction());
1133 EXPECT_FALSE(state.DrawSuspendedUntilCommit());
1134 }
1135
1080 } // namespace 1136 } // namespace
1081 } // namespace cc 1137 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | cc/test/layer_tree_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698