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

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

Issue 802353002: cc: Trigger BeginFrame when children needs it without SetNeedsCommit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | no next file » | 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.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 scheduler->SetVisible(true); 377 scheduler->SetVisible(true);
378 scheduler->SetCanDraw(true); 378 scheduler->SetCanDraw(true);
379 379
380 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client); 380 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
381 InitializeOutputSurfaceAndFirstCommit(scheduler, &client); 381 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
382 382
383 client.Reset(); 383 client.Reset();
384 EXPECT_FALSE(client.begin_frame_is_sent_to_children()); 384 EXPECT_FALSE(client.begin_frame_is_sent_to_children());
385 scheduler->SetNeedsCommit(); 385 scheduler->SetNeedsCommit();
386 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client); 386 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
387 client.Reset(); 387 EXPECT_TRUE(client.needs_begin_frames());
388 388
389 scheduler->SetChildrenNeedBeginFrames(true); 389 scheduler->SetChildrenNeedBeginFrames(true);
390 390
391 client.Reset();
391 client.AdvanceFrame(); 392 client.AdvanceFrame();
392 EXPECT_TRUE(client.begin_frame_is_sent_to_children()); 393 EXPECT_TRUE(client.begin_frame_is_sent_to_children());
393 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 394 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
394 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); 395 EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
395 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); 396 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
396 EXPECT_TRUE(client.needs_begin_frames()); 397 EXPECT_TRUE(client.needs_begin_frames());
398 }
399
400 TEST(SchedulerTest, SendBeginFramesToChildrenWithoutCommit) {
401 FakeSchedulerClient client;
402 SchedulerSettings scheduler_settings;
403 scheduler_settings.use_external_begin_frame_source = true;
404 scheduler_settings.forward_begin_frames_to_children = true;
405 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings);
406 scheduler->SetCanStart();
407 scheduler->SetVisible(true);
408 scheduler->SetCanDraw(true);
409
410 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
411 InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
412
397 client.Reset(); 413 client.Reset();
414 EXPECT_FALSE(client.needs_begin_frames());
415
416 scheduler->SetChildrenNeedBeginFrames(true);
417 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
418 EXPECT_TRUE(client.needs_begin_frames());
419
420 client.Reset();
421 client.AdvanceFrame();
422 EXPECT_TRUE(client.begin_frame_is_sent_to_children());
398 } 423 }
399 424
400 TEST(SchedulerTest, RequestCommit) { 425 TEST(SchedulerTest, RequestCommit) {
401 FakeSchedulerClient client; 426 FakeSchedulerClient client;
402 SchedulerSettings scheduler_settings; 427 SchedulerSettings scheduler_settings;
403 scheduler_settings.use_external_begin_frame_source = true; 428 scheduler_settings.use_external_begin_frame_source = true;
404 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings); 429 TestScheduler* scheduler = client.CreateScheduler(scheduler_settings);
405 scheduler->SetCanStart(); 430 scheduler->SetCanStart();
406 scheduler->SetVisible(true); 431 scheduler->SetVisible(true);
407 scheduler->SetCanDraw(true); 432 scheduler->SetCanDraw(true);
(...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after
2279 2304
2280 // Deadline task is pending 2305 // Deadline task is pending
2281 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); 2306 EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
2282 client.task_runner().RunPendingTasks(); 2307 client.task_runner().RunPendingTasks();
2283 // Deadline task runs immediately 2308 // Deadline task runs immediately
2284 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending()); 2309 EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
2285 } 2310 }
2286 2311
2287 } // namespace 2312 } // namespace
2288 } // namespace cc 2313 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698