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 #include "cc/scheduler/scheduler.h" | 4 #include "cc/scheduler/scheduler.h" |
5 | 5 |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "cc/test/begin_frame_args_test.h" | 15 #include "cc/test/begin_frame_args_test.h" |
| 16 #include "cc/test/fake_output_surface.h" |
16 #include "cc/test/ordered_simple_task_runner.h" | 17 #include "cc/test/ordered_simple_task_runner.h" |
17 #include "cc/test/scheduler_test_common.h" | 18 #include "cc/test/scheduler_test_common.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 | 21 |
21 #define EXPECT_ACTION(action, client, action_index, expected_num_actions) \ | 22 #define EXPECT_ACTION(action, client, action_index, expected_num_actions) \ |
22 do { \ | 23 do { \ |
23 EXPECT_EQ(expected_num_actions, client.num_actions_()); \ | 24 EXPECT_EQ(expected_num_actions, client.num_actions_()); \ |
24 if (action_index >= 0) { \ | 25 if (action_index >= 0) { \ |
25 ASSERT_LT(action_index, client.num_actions_()) << scheduler; \ | 26 ASSERT_LT(action_index, client.num_actions_()) << scheduler; \ |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const char* Action(int i) const { return actions_[i]; } | 102 const char* Action(int i) const { return actions_[i]; } |
102 std::string StateForAction(int i) const { return states_[i]->ToString(); } | 103 std::string StateForAction(int i) const { return states_[i]->ToString(); } |
103 base::TimeTicks posted_begin_impl_frame_deadline() const { | 104 base::TimeTicks posted_begin_impl_frame_deadline() const { |
104 return posted_begin_impl_frame_deadline_; | 105 return posted_begin_impl_frame_deadline_; |
105 } | 106 } |
106 | 107 |
107 bool ExternalBeginFrame() { | 108 bool ExternalBeginFrame() { |
108 return scheduler_->settings().begin_frame_scheduling_enabled && | 109 return scheduler_->settings().begin_frame_scheduling_enabled && |
109 scheduler_->settings().throttle_frame_production; | 110 scheduler_->settings().throttle_frame_production; |
110 } | 111 } |
111 virtual FakeBeginFrameSource* GetExternalBeginFrameSource() OVERRIDE { | |
112 return &fake_frame_source_; | |
113 } | |
114 | 112 |
115 void AdvanceFrame() { | 113 void AdvanceFrame() { |
116 if (ExternalBeginFrame()) { | 114 if (ExternalBeginFrame()) { |
117 fake_frame_source_.TestSendBeginFrame( | 115 fake_frame_source_.TestSendBeginFrame( |
118 CreateBeginFrameArgsForTesting(now_src_)); | 116 CreateBeginFrameArgsForTesting(now_src_)); |
119 } | 117 } |
120 | 118 |
121 EXPECT_TRUE(task_runner().RunTasksWhile(ImplFrameDeadlinePending(false))); | 119 EXPECT_TRUE(task_runner().RunTasksWhile(ImplFrameDeadlinePending(false))); |
122 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 120 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
123 } | 121 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 } | 227 } |
230 | 228 |
231 virtual void DidBeginImplFrameDeadline() OVERRIDE {} | 229 virtual void DidBeginImplFrameDeadline() OVERRIDE {} |
232 | 230 |
233 base::Callback<bool(void)> ImplFrameDeadlinePending(bool state) { | 231 base::Callback<bool(void)> ImplFrameDeadlinePending(bool state) { |
234 return base::Bind(&FakeSchedulerClient::ImplFrameDeadlinePendingCallback, | 232 return base::Bind(&FakeSchedulerClient::ImplFrameDeadlinePendingCallback, |
235 base::Unretained(this), | 233 base::Unretained(this), |
236 state); | 234 state); |
237 } | 235 } |
238 | 236 |
| 237 scoped_ptr<FakeOutputSurface> output_surface_; |
| 238 |
239 protected: | 239 protected: |
240 bool ImplFrameDeadlinePendingCallback(bool state) { | 240 bool ImplFrameDeadlinePendingCallback(bool state) { |
241 return scheduler_->BeginImplFrameDeadlinePending() == state; | 241 return scheduler_->BeginImplFrameDeadlinePending() == state; |
242 } | 242 } |
243 | 243 |
244 bool draw_will_happen_; | 244 bool draw_will_happen_; |
245 bool swap_will_happen_if_draw_happens_; | 245 bool swap_will_happen_if_draw_happens_; |
246 bool automatic_swap_ack_; | 246 bool automatic_swap_ack_; |
247 int num_draws_; | 247 int num_draws_; |
248 bool log_anticipated_draw_time_change_; | 248 bool log_anticipated_draw_time_change_; |
249 bool swap_contains_incomplete_tile_; | 249 bool swap_contains_incomplete_tile_; |
250 bool redraw_will_happen_if_update_visible_tiles_happens_; | 250 bool redraw_will_happen_if_update_visible_tiles_happens_; |
251 base::TimeTicks posted_begin_impl_frame_deadline_; | 251 base::TimeTicks posted_begin_impl_frame_deadline_; |
252 std::vector<const char*> actions_; | 252 std::vector<const char*> actions_; |
253 std::vector<scoped_refptr<base::debug::ConvertableToTraceFormat> > states_; | 253 std::vector<scoped_refptr<base::debug::ConvertableToTraceFormat> > states_; |
254 scoped_ptr<TestScheduler> scheduler_; | 254 scoped_ptr<TestScheduler> scheduler_; |
255 scoped_refptr<TestNowSource> now_src_; | 255 scoped_refptr<TestNowSource> now_src_; |
256 FakeBeginFrameSourceForFakeSchedulerClient fake_frame_source_; | 256 FakeBeginFrameSourceForFakeSchedulerClient fake_frame_source_; |
257 }; | 257 }; |
258 | 258 |
259 void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, | 259 void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler, |
260 FakeSchedulerClient* client) { | 260 FakeSchedulerClient* client) { |
261 TRACE_EVENT0("cc", | 261 TRACE_EVENT0("cc", |
262 "SchedulerUnitTest::InitializeOutputSurfaceAndFirstCommit"); | 262 "SchedulerUnitTest::InitializeOutputSurfaceAndFirstCommit"); |
263 | 263 |
264 scheduler->DidCreateAndInitializeOutputSurface(); | 264 client->output_surface_ = FakeOutputSurface::Create3d(); |
| 265 scheduler->DidCreateAndInitializeOutputSurface(client->output_surface_.get()); |
265 scheduler->SetNeedsCommit(); | 266 scheduler->SetNeedsCommit(); |
266 scheduler->NotifyBeginMainFrameStarted(); | 267 scheduler->NotifyBeginMainFrameStarted(); |
267 scheduler->NotifyReadyToCommit(); | 268 scheduler->NotifyReadyToCommit(); |
268 if (scheduler->settings().impl_side_painting) | 269 if (scheduler->settings().impl_side_painting) |
269 scheduler->NotifyReadyToActivate(); | 270 scheduler->NotifyReadyToActivate(); |
270 | 271 |
271 // Go through the motions to draw the commit. | 272 // Go through the motions to draw the commit. |
272 client->AdvanceFrame(); | 273 client->AdvanceFrame(); |
273 | 274 |
274 // Run the posted deadline task. | 275 // Run the posted deadline task. |
(...skipping 14 matching lines...) Expand all Loading... |
289 TEST(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) { | 290 TEST(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) { |
290 FakeSchedulerClient client; | 291 FakeSchedulerClient client; |
291 SchedulerSettings default_scheduler_settings; | 292 SchedulerSettings default_scheduler_settings; |
292 TestScheduler* scheduler = client.CreateScheduler(default_scheduler_settings); | 293 TestScheduler* scheduler = client.CreateScheduler(default_scheduler_settings); |
293 scheduler->SetCanStart(); | 294 scheduler->SetCanStart(); |
294 scheduler->SetVisible(true); | 295 scheduler->SetVisible(true); |
295 scheduler->SetCanDraw(true); | 296 scheduler->SetCanDraw(true); |
296 | 297 |
297 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); | 298 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); |
298 client.Reset(); | 299 client.Reset(); |
299 scheduler->DidCreateAndInitializeOutputSurface(); | 300 client.output_surface_ = FakeOutputSurface::Create3d(); |
| 301 scheduler->DidCreateAndInitializeOutputSurface(client.output_surface_.get()); |
300 EXPECT_NO_ACTION(client); | 302 EXPECT_NO_ACTION(client); |
301 } | 303 } |
302 | 304 |
303 TEST(SchedulerTest, RequestCommit) { | 305 TEST(SchedulerTest, RequestCommit) { |
304 FakeSchedulerClient client; | 306 FakeSchedulerClient client; |
305 SchedulerSettings scheduler_settings; | 307 SchedulerSettings scheduler_settings; |
306 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); | 308 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); |
307 scheduler->SetCanStart(); | 309 scheduler->SetCanStart(); |
308 scheduler->SetVisible(true); | 310 scheduler->SetVisible(true); |
309 scheduler->SetCanDraw(true); | 311 scheduler->SetCanDraw(true); |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 base::TimeDelta::FromMilliseconds(1), | 1124 base::TimeDelta::FromMilliseconds(1), |
1123 base::TimeDelta::FromMilliseconds(32), | 1125 base::TimeDelta::FromMilliseconds(32), |
1124 base::TimeDelta::FromMilliseconds(32)); | 1126 base::TimeDelta::FromMilliseconds(32)); |
1125 client.set_log_anticipated_draw_time_change(true); | 1127 client.set_log_anticipated_draw_time_change(true); |
1126 SchedulerSettings default_scheduler_settings; | 1128 SchedulerSettings default_scheduler_settings; |
1127 TestScheduler* scheduler = client.CreateScheduler(default_scheduler_settings); | 1129 TestScheduler* scheduler = client.CreateScheduler(default_scheduler_settings); |
1128 | 1130 |
1129 scheduler->SetCanDraw(true); | 1131 scheduler->SetCanDraw(true); |
1130 scheduler->SetCanStart(); | 1132 scheduler->SetCanStart(); |
1131 scheduler->SetVisible(true); | 1133 scheduler->SetVisible(true); |
1132 scheduler->DidCreateAndInitializeOutputSurface(); | 1134 client.output_surface_ = FakeOutputSurface::Create3d(); |
| 1135 scheduler->DidCreateAndInitializeOutputSurface(client.output_surface_.get()); |
1133 | 1136 |
1134 scheduler->SetNeedsCommit(); | 1137 scheduler->SetNeedsCommit(); |
1135 EXPECT_TRUE(scheduler->CommitPending()); | 1138 EXPECT_TRUE(scheduler->CommitPending()); |
1136 scheduler->NotifyBeginMainFrameStarted(); | 1139 scheduler->NotifyBeginMainFrameStarted(); |
1137 scheduler->NotifyReadyToCommit(); | 1140 scheduler->NotifyReadyToCommit(); |
1138 scheduler->SetNeedsRedraw(); | 1141 scheduler->SetNeedsRedraw(); |
1139 | 1142 |
1140 BeginFrameArgs frame_args = CreateBeginFrameArgsForTesting(client.now_src()); | 1143 BeginFrameArgs frame_args = CreateBeginFrameArgsForTesting(client.now_src()); |
1141 frame_args.interval = base::TimeDelta::FromMilliseconds(1000); | 1144 frame_args.interval = base::TimeDelta::FromMilliseconds(1000); |
1142 client.GetExternalBeginFrameSource()->TestSendBeginFrame(frame_args); | 1145 client.output_surface_->TestSendBeginFrame(frame_args); |
1143 | 1146 |
1144 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1147 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1145 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1148 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1146 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 1149 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
1147 | 1150 |
1148 scheduler->DidSwapBuffers(); | 1151 scheduler->DidSwapBuffers(); |
1149 scheduler->DidSwapBuffersComplete(); | 1152 scheduler->DidSwapBuffersComplete(); |
1150 | 1153 |
1151 // At this point, we've drawn a frame. Start another commit, but hold off on | 1154 // At this point, we've drawn a frame. Start another commit, but hold off on |
1152 // the NotifyReadyToCommit for now. | 1155 // the NotifyReadyToCommit for now. |
1153 EXPECT_FALSE(scheduler->CommitPending()); | 1156 EXPECT_FALSE(scheduler->CommitPending()); |
1154 scheduler->SetNeedsCommit(); | 1157 scheduler->SetNeedsCommit(); |
1155 client.GetExternalBeginFrameSource()->TestSendBeginFrame(frame_args); | 1158 client.output_surface_->TestSendBeginFrame(frame_args); |
1156 EXPECT_TRUE(scheduler->CommitPending()); | 1159 EXPECT_TRUE(scheduler->CommitPending()); |
1157 | 1160 |
1158 // Draw and swap the frame, but don't ack the swap to simulate the Browser | 1161 // Draw and swap the frame, but don't ack the swap to simulate the Browser |
1159 // blocking on the renderer. | 1162 // blocking on the renderer. |
1160 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1163 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1161 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1164 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1162 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 1165 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
1163 scheduler->DidSwapBuffers(); | 1166 scheduler->DidSwapBuffers(); |
1164 | 1167 |
1165 // Spin the event loop a few times and make sure we get more | 1168 // Spin the event loop a few times and make sure we get more |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 1207 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
1205 client.Reset(); | 1208 client.Reset(); |
1206 scheduler->SetNeedsCommit(); | 1209 scheduler->SetNeedsCommit(); |
1207 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | 1210 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
1208 client.Reset(); | 1211 client.Reset(); |
1209 | 1212 |
1210 // Create a BeginFrame with a long deadline to avoid race conditions. | 1213 // Create a BeginFrame with a long deadline to avoid race conditions. |
1211 // This is the first BeginFrame, which will be handled immediately. | 1214 // This is the first BeginFrame, which will be handled immediately. |
1212 BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src()); | 1215 BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src()); |
1213 args.deadline += base::TimeDelta::FromHours(1); | 1216 args.deadline += base::TimeDelta::FromHours(1); |
1214 client.GetExternalBeginFrameSource()->TestSendBeginFrame(args); | 1217 client.output_surface_->TestSendBeginFrame(args); |
1215 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1218 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1216 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 1219 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1217 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1220 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1218 EXPECT_TRUE(client.needs_begin_frames()); | 1221 EXPECT_TRUE(client.needs_begin_frames()); |
1219 client.Reset(); | 1222 client.Reset(); |
1220 | 1223 |
1221 // Queue BeginFrames while we are still handling the previous BeginFrame. | 1224 // Queue BeginFrames while we are still handling the previous BeginFrame. |
1222 args.frame_time += base::TimeDelta::FromSeconds(1); | 1225 args.frame_time += base::TimeDelta::FromSeconds(1); |
1223 client.GetExternalBeginFrameSource()->TestSendBeginFrame(args); | 1226 client.output_surface_->TestSendBeginFrame(args); |
1224 args.frame_time += base::TimeDelta::FromSeconds(1); | 1227 args.frame_time += base::TimeDelta::FromSeconds(1); |
1225 client.GetExternalBeginFrameSource()->TestSendBeginFrame(args); | 1228 client.output_surface_->TestSendBeginFrame(args); |
1226 | 1229 |
1227 // If we don't swap on the deadline, we wait for the next BeginImplFrame. | 1230 // If we don't swap on the deadline, we wait for the next BeginImplFrame. |
1228 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1231 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1229 EXPECT_NO_ACTION(client); | 1232 EXPECT_NO_ACTION(client); |
1230 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 1233 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
1231 EXPECT_TRUE(client.needs_begin_frames()); | 1234 EXPECT_TRUE(client.needs_begin_frames()); |
1232 client.Reset(); | 1235 client.Reset(); |
1233 | 1236 |
1234 // NotifyReadyToCommit should trigger the commit. | 1237 // NotifyReadyToCommit should trigger the commit. |
1235 scheduler->NotifyBeginMainFrameStarted(); | 1238 scheduler->NotifyBeginMainFrameStarted(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 1284 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
1282 client.Reset(); | 1285 client.Reset(); |
1283 scheduler->SetNeedsCommit(); | 1286 scheduler->SetNeedsCommit(); |
1284 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | 1287 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
1285 client.Reset(); | 1288 client.Reset(); |
1286 | 1289 |
1287 // Create a BeginFrame with a long deadline to avoid race conditions. | 1290 // Create a BeginFrame with a long deadline to avoid race conditions. |
1288 // This is the first BeginFrame, which will be handled immediately. | 1291 // This is the first BeginFrame, which will be handled immediately. |
1289 BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src()); | 1292 BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src()); |
1290 args.deadline += base::TimeDelta::FromHours(1); | 1293 args.deadline += base::TimeDelta::FromHours(1); |
1291 client.GetExternalBeginFrameSource()->TestSendBeginFrame(args); | 1294 client.output_surface_->TestSendBeginFrame(args); |
1292 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1295 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1293 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 1296 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1294 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1297 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1295 EXPECT_TRUE(client.needs_begin_frames()); | 1298 EXPECT_TRUE(client.needs_begin_frames()); |
1296 client.Reset(); | 1299 client.Reset(); |
1297 | 1300 |
1298 // Queue BeginFrame while we are still handling the previous BeginFrame. | 1301 // Queue BeginFrame while we are still handling the previous BeginFrame. |
1299 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1302 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1300 args.frame_time += base::TimeDelta::FromSeconds(1); | 1303 args.frame_time += base::TimeDelta::FromSeconds(1); |
1301 client.GetExternalBeginFrameSource()->TestSendBeginFrame(args); | 1304 client.output_surface_->TestSendBeginFrame(args); |
1302 EXPECT_NO_ACTION(client); | 1305 EXPECT_NO_ACTION(client); |
1303 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1306 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1304 client.Reset(); | 1307 client.Reset(); |
1305 | 1308 |
1306 // NotifyReadyToCommit should trigger the pending commit and draw. | 1309 // NotifyReadyToCommit should trigger the pending commit and draw. |
1307 scheduler->NotifyBeginMainFrameStarted(); | 1310 scheduler->NotifyBeginMainFrameStarted(); |
1308 scheduler->NotifyReadyToCommit(); | 1311 scheduler->NotifyReadyToCommit(); |
1309 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); | 1312 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
1310 EXPECT_TRUE(client.needs_begin_frames()); | 1313 EXPECT_TRUE(client.needs_begin_frames()); |
1311 client.Reset(); | 1314 client.Reset(); |
(...skipping 10 matching lines...) Expand all Loading... |
1322 // but not a BeginMainFrame or draw. | 1325 // but not a BeginMainFrame or draw. |
1323 scheduler->SetNeedsCommit(); | 1326 scheduler->SetNeedsCommit(); |
1324 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. | 1327 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. |
1325 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1); | 1328 EXPECT_ACTION("WillBeginImplFrame", client, 0, 1); |
1326 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1329 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1327 EXPECT_TRUE(client.needs_begin_frames()); | 1330 EXPECT_TRUE(client.needs_begin_frames()); |
1328 client.Reset(); | 1331 client.Reset(); |
1329 | 1332 |
1330 // Queue BeginFrame while we are still handling the previous BeginFrame. | 1333 // Queue BeginFrame while we are still handling the previous BeginFrame. |
1331 args.frame_time += base::TimeDelta::FromSeconds(1); | 1334 args.frame_time += base::TimeDelta::FromSeconds(1); |
1332 client.GetExternalBeginFrameSource()->TestSendBeginFrame(args); | 1335 client.output_surface_->TestSendBeginFrame(args); |
1333 EXPECT_NO_ACTION(client); | 1336 EXPECT_NO_ACTION(client); |
1334 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1337 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1335 EXPECT_TRUE(client.needs_begin_frames()); | 1338 EXPECT_TRUE(client.needs_begin_frames()); |
1336 client.Reset(); | 1339 client.Reset(); |
1337 | 1340 |
1338 // Take us out of a swap throttled state. | 1341 // Take us out of a swap throttled state. |
1339 scheduler->DidSwapBuffersComplete(); | 1342 scheduler->DidSwapBuffersComplete(); |
1340 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1); | 1343 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1); |
1341 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1344 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1342 EXPECT_TRUE(client.needs_begin_frames()); | 1345 EXPECT_TRUE(client.needs_begin_frames()); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 TEST(SchedulerTest, DidLoseOutputSurfaceAfterOutputSurfaceIsInitialized) { | 1551 TEST(SchedulerTest, DidLoseOutputSurfaceAfterOutputSurfaceIsInitialized) { |
1549 FakeSchedulerClient client; | 1552 FakeSchedulerClient client; |
1550 SchedulerSettings scheduler_settings; | 1553 SchedulerSettings scheduler_settings; |
1551 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); | 1554 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); |
1552 scheduler->SetCanStart(); | 1555 scheduler->SetCanStart(); |
1553 scheduler->SetVisible(true); | 1556 scheduler->SetVisible(true); |
1554 scheduler->SetCanDraw(true); | 1557 scheduler->SetCanDraw(true); |
1555 | 1558 |
1556 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); | 1559 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); |
1557 client.Reset(); | 1560 client.Reset(); |
1558 scheduler->DidCreateAndInitializeOutputSurface(); | 1561 client.output_surface_ = FakeOutputSurface::Create3d(); |
| 1562 scheduler->DidCreateAndInitializeOutputSurface(client.output_surface_.get()); |
1559 EXPECT_NO_ACTION(client); | 1563 EXPECT_NO_ACTION(client); |
1560 | 1564 |
| 1565 client.output_surface_.reset(); |
1561 scheduler->DidLoseOutputSurface(); | 1566 scheduler->DidLoseOutputSurface(); |
1562 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); | 1567 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); |
1563 } | 1568 } |
1564 | 1569 |
1565 TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) { | 1570 TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) { |
1566 FakeSchedulerClient client; | 1571 FakeSchedulerClient client; |
1567 SchedulerSettings scheduler_settings; | 1572 SchedulerSettings scheduler_settings; |
1568 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); | 1573 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); |
1569 scheduler->SetCanStart(); | 1574 scheduler->SetCanStart(); |
1570 scheduler->SetVisible(true); | 1575 scheduler->SetVisible(true); |
1571 scheduler->SetCanDraw(true); | 1576 scheduler->SetCanDraw(true); |
1572 | 1577 |
1573 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); | 1578 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); |
1574 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 1579 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
1575 // SetNeedsCommit should begin the frame. | 1580 // SetNeedsCommit should begin the frame. |
1576 client.Reset(); | 1581 client.Reset(); |
1577 scheduler->SetNeedsCommit(); | 1582 scheduler->SetNeedsCommit(); |
1578 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | 1583 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
1579 | 1584 |
1580 client.Reset(); | 1585 client.Reset(); |
1581 client.AdvanceFrame(); | 1586 client.AdvanceFrame(); |
1582 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1587 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1583 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 1588 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1584 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1589 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1585 | 1590 |
1586 client.Reset(); | 1591 client.Reset(); |
| 1592 client.output_surface_.reset(); |
1587 scheduler->DidLoseOutputSurface(); | 1593 scheduler->DidLoseOutputSurface(); |
1588 // Do nothing when impl frame is in deadine pending state. | 1594 // Do nothing when impl frame is in deadine pending state. |
1589 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client); | 1595 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client); |
1590 | 1596 |
1591 client.Reset(); | 1597 client.Reset(); |
1592 scheduler->NotifyBeginMainFrameStarted(); | 1598 scheduler->NotifyBeginMainFrameStarted(); |
1593 scheduler->NotifyReadyToCommit(); | 1599 scheduler->NotifyReadyToCommit(); |
1594 EXPECT_ACTION("ScheduledActionCommit", client, 0, 1); | 1600 EXPECT_ACTION("ScheduledActionCommit", client, 0, 1); |
1595 | 1601 |
1596 client.Reset(); | 1602 client.Reset(); |
(...skipping 19 matching lines...) Expand all Loading... |
1616 scheduler->SetNeedsCommit(); | 1622 scheduler->SetNeedsCommit(); |
1617 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | 1623 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
1618 | 1624 |
1619 client.Reset(); | 1625 client.Reset(); |
1620 client.AdvanceFrame(); | 1626 client.AdvanceFrame(); |
1621 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1627 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1622 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 1628 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1623 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1629 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1624 | 1630 |
1625 client.Reset(); | 1631 client.Reset(); |
| 1632 client.output_surface_.reset(); |
1626 scheduler->DidLoseOutputSurface(); | 1633 scheduler->DidLoseOutputSurface(); |
1627 // Do nothing when impl frame is in deadine pending state. | 1634 // Do nothing when impl frame is in deadine pending state. |
1628 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client); | 1635 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client); |
1629 | 1636 |
1630 client.Reset(); | 1637 client.Reset(); |
1631 // Run posted deadline. | 1638 // Run posted deadline. |
1632 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1639 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1633 client.task_runner().RunTasksWhile(client.ImplFrameDeadlinePending(true)); | 1640 client.task_runner().RunTasksWhile(client.ImplFrameDeadlinePending(true)); |
1634 // OnBeginImplFrameDeadline didn't schedule any actions because main frame is | 1641 // OnBeginImplFrameDeadline didn't schedule any actions because main frame is |
1635 // not yet completed. | 1642 // not yet completed. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1695 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1689 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 1696 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1690 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1697 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1691 | 1698 |
1692 client.Reset(); | 1699 client.Reset(); |
1693 scheduler->NotifyBeginMainFrameStarted(); | 1700 scheduler->NotifyBeginMainFrameStarted(); |
1694 scheduler->NotifyReadyToCommit(); | 1701 scheduler->NotifyReadyToCommit(); |
1695 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); | 1702 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
1696 | 1703 |
1697 client.Reset(); | 1704 client.Reset(); |
| 1705 client.output_surface_.reset(); |
1698 scheduler->DidLoseOutputSurface(); | 1706 scheduler->DidLoseOutputSurface(); |
1699 if (impl_side_painting) { | 1707 if (impl_side_painting) { |
1700 // Sync tree should be forced to activate. | 1708 // Sync tree should be forced to activate. |
1701 EXPECT_ACTION("SetNeedsBeginFrames(false)", client, 0, 2); | 1709 EXPECT_ACTION("SetNeedsBeginFrames(false)", client, 0, 2); |
1702 EXPECT_ACTION("ScheduledActionActivateSyncTree", client, 1, 2); | 1710 EXPECT_ACTION("ScheduledActionActivateSyncTree", client, 1, 2); |
1703 } else { | 1711 } else { |
1704 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client); | 1712 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client); |
1705 } | 1713 } |
1706 | 1714 |
1707 client.Reset(); | 1715 client.Reset(); |
(...skipping 23 matching lines...) Expand all Loading... |
1731 scheduler->SetNeedsRedraw(); | 1739 scheduler->SetNeedsRedraw(); |
1732 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | 1740 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
1733 | 1741 |
1734 client.Reset(); | 1742 client.Reset(); |
1735 client.AdvanceFrame(); | 1743 client.AdvanceFrame(); |
1736 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1744 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1737 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); | 1745 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
1738 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1746 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1739 | 1747 |
1740 client.Reset(); | 1748 client.Reset(); |
| 1749 client.output_surface_.reset(); |
1741 scheduler->DidLoseOutputSurface(); | 1750 scheduler->DidLoseOutputSurface(); |
1742 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client); | 1751 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client); |
1743 | 1752 |
1744 client.Reset(); | 1753 client.Reset(); |
1745 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1754 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1746 EXPECT_ACTION("ScheduledActionManageTiles", client, 0, 2); | 1755 EXPECT_ACTION("ScheduledActionManageTiles", client, 0, 2); |
1747 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client, 1, 2); | 1756 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client, 1, 2); |
1748 } | 1757 } |
1749 | 1758 |
1750 TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) { | 1759 TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) { |
1751 FakeSchedulerClient client; | 1760 FakeSchedulerClient client; |
1752 SchedulerSettings scheduler_settings; | 1761 SchedulerSettings scheduler_settings; |
1753 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); | 1762 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); |
1754 scheduler->SetCanStart(); | 1763 scheduler->SetCanStart(); |
1755 scheduler->SetVisible(true); | 1764 scheduler->SetVisible(true); |
1756 scheduler->SetCanDraw(true); | 1765 scheduler->SetCanDraw(true); |
1757 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); | 1766 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); |
1758 | 1767 |
1759 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 1768 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
1760 client.Reset(); | 1769 client.Reset(); |
1761 scheduler->SetNeedsCommit(); | 1770 scheduler->SetNeedsCommit(); |
1762 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | 1771 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
1763 | 1772 |
1764 // Create a BeginFrame with a long deadline to avoid race conditions. | 1773 // Create a BeginFrame with a long deadline to avoid race conditions. |
1765 // This is the first BeginFrame, which will be handled immediately. | 1774 // This is the first BeginFrame, which will be handled immediately. |
1766 client.Reset(); | 1775 client.Reset(); |
1767 BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src()); | 1776 BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src()); |
1768 args.deadline += base::TimeDelta::FromHours(1); | 1777 args.deadline += base::TimeDelta::FromHours(1); |
1769 client.GetExternalBeginFrameSource()->TestSendBeginFrame(args); | 1778 client.output_surface_->TestSendBeginFrame(args); |
1770 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1779 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1771 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 1780 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1772 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1781 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1773 EXPECT_TRUE(client.needs_begin_frames()); | 1782 EXPECT_TRUE(client.needs_begin_frames()); |
1774 | 1783 |
1775 // Queue BeginFrames while we are still handling the previous BeginFrame. | 1784 // Queue BeginFrames while we are still handling the previous BeginFrame. |
1776 args.frame_time += base::TimeDelta::FromSeconds(1); | 1785 args.frame_time += base::TimeDelta::FromSeconds(1); |
1777 client.GetExternalBeginFrameSource()->TestSendBeginFrame(args); | 1786 client.output_surface_->TestSendBeginFrame(args); |
1778 args.frame_time += base::TimeDelta::FromSeconds(1); | 1787 args.frame_time += base::TimeDelta::FromSeconds(1); |
1779 client.GetExternalBeginFrameSource()->TestSendBeginFrame(args); | 1788 client.output_surface_->TestSendBeginFrame(args); |
1780 | 1789 |
1781 // If we don't swap on the deadline, we wait for the next BeginImplFrame. | 1790 // If we don't swap on the deadline, we wait for the next BeginImplFrame. |
1782 client.Reset(); | 1791 client.Reset(); |
1783 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1792 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1784 EXPECT_NO_ACTION(client); | 1793 EXPECT_NO_ACTION(client); |
1785 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 1794 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
1786 EXPECT_TRUE(client.needs_begin_frames()); | 1795 EXPECT_TRUE(client.needs_begin_frames()); |
1787 | 1796 |
1788 // NotifyReadyToCommit should trigger the commit. | 1797 // NotifyReadyToCommit should trigger the commit. |
1789 client.Reset(); | 1798 client.Reset(); |
1790 scheduler->NotifyBeginMainFrameStarted(); | 1799 scheduler->NotifyBeginMainFrameStarted(); |
1791 scheduler->NotifyReadyToCommit(); | 1800 scheduler->NotifyReadyToCommit(); |
1792 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); | 1801 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
1793 EXPECT_TRUE(client.needs_begin_frames()); | 1802 EXPECT_TRUE(client.needs_begin_frames()); |
1794 | 1803 |
1795 client.Reset(); | 1804 client.Reset(); |
1796 EXPECT_FALSE(scheduler->IsBeginRetroFrameArgsEmpty()); | 1805 EXPECT_FALSE(scheduler->IsBeginRetroFrameArgsEmpty()); |
| 1806 client.output_surface_.reset(); |
1797 scheduler->DidLoseOutputSurface(); | 1807 scheduler->DidLoseOutputSurface(); |
1798 EXPECT_ACTION("SetNeedsBeginFrames(false)", client, 0, 2); | 1808 EXPECT_ACTION("SetNeedsBeginFrames(false)", client, 0, 2); |
1799 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client, 1, 2); | 1809 EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client, 1, 2); |
1800 EXPECT_TRUE(scheduler->IsBeginRetroFrameArgsEmpty()); | 1810 EXPECT_TRUE(scheduler->IsBeginRetroFrameArgsEmpty()); |
1801 | 1811 |
1802 // Posted BeginRetroFrame is aborted. | 1812 // Posted BeginRetroFrame is aborted. |
1803 client.Reset(); | 1813 client.Reset(); |
1804 client.task_runner().RunPendingTasks(); | 1814 client.task_runner().RunPendingTasks(); |
1805 EXPECT_NO_ACTION(client); | 1815 EXPECT_NO_ACTION(client); |
1806 } | 1816 } |
(...skipping 10 matching lines...) Expand all Loading... |
1817 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 1827 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
1818 client.Reset(); | 1828 client.Reset(); |
1819 scheduler->SetNeedsCommit(); | 1829 scheduler->SetNeedsCommit(); |
1820 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); | 1830 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); |
1821 | 1831 |
1822 // Create a BeginFrame with a long deadline to avoid race conditions. | 1832 // Create a BeginFrame with a long deadline to avoid race conditions. |
1823 // This is the first BeginFrame, which will be handled immediately. | 1833 // This is the first BeginFrame, which will be handled immediately. |
1824 client.Reset(); | 1834 client.Reset(); |
1825 BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src()); | 1835 BeginFrameArgs args = CreateBeginFrameArgsForTesting(client.now_src()); |
1826 args.deadline += base::TimeDelta::FromHours(1); | 1836 args.deadline += base::TimeDelta::FromHours(1); |
1827 client.GetExternalBeginFrameSource()->TestSendBeginFrame(args); | 1837 client.output_surface_->TestSendBeginFrame(args); |
1828 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1838 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1829 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); | 1839 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); |
1830 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1840 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1831 EXPECT_TRUE(client.needs_begin_frames()); | 1841 EXPECT_TRUE(client.needs_begin_frames()); |
1832 | 1842 |
1833 // Queue BeginFrames while we are still handling the previous BeginFrame. | 1843 // Queue BeginFrames while we are still handling the previous BeginFrame. |
1834 args.frame_time += base::TimeDelta::FromSeconds(1); | 1844 args.frame_time += base::TimeDelta::FromSeconds(1); |
1835 client.GetExternalBeginFrameSource()->TestSendBeginFrame(args); | 1845 client.output_surface_->TestSendBeginFrame(args); |
1836 args.frame_time += base::TimeDelta::FromSeconds(1); | 1846 args.frame_time += base::TimeDelta::FromSeconds(1); |
1837 client.GetExternalBeginFrameSource()->TestSendBeginFrame(args); | 1847 client.output_surface_->TestSendBeginFrame(args); |
1838 | 1848 |
1839 // If we don't swap on the deadline, we wait for the next BeginImplFrame. | 1849 // If we don't swap on the deadline, we wait for the next BeginImplFrame. |
1840 client.Reset(); | 1850 client.Reset(); |
1841 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1851 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1842 EXPECT_NO_ACTION(client); | 1852 EXPECT_NO_ACTION(client); |
1843 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 1853 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
1844 EXPECT_TRUE(client.needs_begin_frames()); | 1854 EXPECT_TRUE(client.needs_begin_frames()); |
1845 | 1855 |
1846 // NotifyReadyToCommit should trigger the commit. | 1856 // NotifyReadyToCommit should trigger the commit. |
1847 client.Reset(); | 1857 client.Reset(); |
1848 scheduler->NotifyBeginMainFrameStarted(); | 1858 scheduler->NotifyBeginMainFrameStarted(); |
1849 scheduler->NotifyReadyToCommit(); | 1859 scheduler->NotifyReadyToCommit(); |
1850 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); | 1860 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client); |
1851 EXPECT_TRUE(client.needs_begin_frames()); | 1861 EXPECT_TRUE(client.needs_begin_frames()); |
1852 | 1862 |
1853 // BeginImplFrame should prepare the draw. | 1863 // BeginImplFrame should prepare the draw. |
1854 client.Reset(); | 1864 client.Reset(); |
1855 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. | 1865 client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. |
1856 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); | 1866 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); |
1857 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); | 1867 EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2); |
1858 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); | 1868 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); |
1859 EXPECT_TRUE(client.needs_begin_frames()); | 1869 EXPECT_TRUE(client.needs_begin_frames()); |
1860 | 1870 |
1861 client.Reset(); | 1871 client.Reset(); |
1862 EXPECT_FALSE(scheduler->IsBeginRetroFrameArgsEmpty()); | 1872 EXPECT_FALSE(scheduler->IsBeginRetroFrameArgsEmpty()); |
1863 scheduler->DidLoseOutputSurface(); | 1873 scheduler->DidLoseOutputSurface(); |
| 1874 client.output_surface_.reset(); |
1864 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client); | 1875 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client); |
1865 EXPECT_TRUE(scheduler->IsBeginRetroFrameArgsEmpty()); | 1876 EXPECT_TRUE(scheduler->IsBeginRetroFrameArgsEmpty()); |
1866 | 1877 |
1867 // BeginImplFrame deadline should abort drawing. | 1878 // BeginImplFrame deadline should abort drawing. |
1868 client.Reset(); | 1879 client.Reset(); |
1869 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1880 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1870 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); | 1881 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); |
1871 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); | 1882 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); |
1872 EXPECT_FALSE(client.needs_begin_frames()); | 1883 EXPECT_FALSE(client.needs_begin_frames()); |
1873 | 1884 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 EXPECT_FALSE(scheduler->frame_source().NeedsBeginFrames()); | 1925 EXPECT_FALSE(scheduler->frame_source().NeedsBeginFrames()); |
1915 | 1926 |
1916 client.Reset(); | 1927 client.Reset(); |
1917 client.task_runner().RunPendingTasks(); // Run posted deadline. | 1928 client.task_runner().RunPendingTasks(); // Run posted deadline. |
1918 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); | 1929 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); |
1919 EXPECT_FALSE(scheduler->frame_source().NeedsBeginFrames()); | 1930 EXPECT_FALSE(scheduler->frame_source().NeedsBeginFrames()); |
1920 } | 1931 } |
1921 | 1932 |
1922 } // namespace | 1933 } // namespace |
1923 } // namespace cc | 1934 } // namespace cc |
OLD | NEW |