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 | 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/logging.h" | 10 #include "base/logging.h" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 scheduler_->SetCanDraw(true); | 400 scheduler_->SetCanDraw(true); |
401 | 401 |
402 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); | 402 EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_); |
403 client_->Reset(); | 403 client_->Reset(); |
404 scheduler_->DidCreateAndInitializeOutputSurface(); | 404 scheduler_->DidCreateAndInitializeOutputSurface(); |
405 EXPECT_NO_ACTION(client_); | 405 EXPECT_NO_ACTION(client_); |
406 } | 406 } |
407 | 407 |
408 TEST_F(SchedulerTest, SendBeginFramesToChildren) { | 408 TEST_F(SchedulerTest, SendBeginFramesToChildren) { |
409 scheduler_settings_.use_external_begin_frame_source = true; | 409 scheduler_settings_.use_external_begin_frame_source = true; |
410 scheduler_settings_.forward_begin_frames_to_children = true; | |
411 SetUpScheduler(true); | 410 SetUpScheduler(true); |
412 | 411 |
413 EXPECT_FALSE(client_->begin_frame_is_sent_to_children()); | 412 EXPECT_FALSE(client_->begin_frame_is_sent_to_children()); |
414 scheduler_->SetNeedsCommit(); | 413 scheduler_->SetNeedsCommit(); |
415 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 414 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
416 EXPECT_TRUE(client_->needs_begin_frames()); | 415 EXPECT_TRUE(client_->needs_begin_frames()); |
417 | 416 |
418 scheduler_->SetChildrenNeedBeginFrames(true); | 417 scheduler_->SetChildrenNeedBeginFrames(true); |
419 | 418 |
420 client_->Reset(); | 419 client_->Reset(); |
421 EXPECT_SCOPED(AdvanceFrame()); | 420 EXPECT_SCOPED(AdvanceFrame()); |
422 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); | 421 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); |
423 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 422 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
424 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 423 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
425 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 424 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
426 EXPECT_TRUE(client_->needs_begin_frames()); | 425 EXPECT_TRUE(client_->needs_begin_frames()); |
427 } | 426 } |
428 | 427 |
429 TEST_F(SchedulerTest, SendBeginFramesToChildrenWithoutCommit) { | 428 TEST_F(SchedulerTest, SendBeginFramesToChildrenWithoutCommit) { |
430 scheduler_settings_.use_external_begin_frame_source = true; | 429 scheduler_settings_.use_external_begin_frame_source = true; |
431 scheduler_settings_.forward_begin_frames_to_children = true; | |
432 SetUpScheduler(true); | 430 SetUpScheduler(true); |
433 | 431 |
434 EXPECT_FALSE(client_->needs_begin_frames()); | 432 EXPECT_FALSE(client_->needs_begin_frames()); |
435 scheduler_->SetChildrenNeedBeginFrames(true); | 433 scheduler_->SetChildrenNeedBeginFrames(true); |
436 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 434 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
437 EXPECT_TRUE(client_->needs_begin_frames()); | 435 EXPECT_TRUE(client_->needs_begin_frames()); |
438 | 436 |
439 client_->Reset(); | 437 client_->Reset(); |
440 EXPECT_SCOPED(AdvanceFrame()); | 438 EXPECT_SCOPED(AdvanceFrame()); |
441 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); | 439 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 task_runner().RunPendingTasks(); // Run posted deadline. | 494 task_runner().RunPendingTasks(); // Run posted deadline. |
497 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); | 495 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); |
498 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); | 496 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); |
499 client_->Reset(); | 497 client_->Reset(); |
500 } | 498 } |
501 | 499 |
502 TEST_F(SchedulerTest, RequestCommitAfterSetDeferCommit) { | 500 TEST_F(SchedulerTest, RequestCommitAfterSetDeferCommit) { |
503 scheduler_settings_.use_external_begin_frame_source = true; | 501 scheduler_settings_.use_external_begin_frame_source = true; |
504 SetUpScheduler(true); | 502 SetUpScheduler(true); |
505 | 503 |
506 scheduler_->SetCanStart(); | |
507 scheduler_->SetVisible(true); | |
508 scheduler_->SetCanDraw(true); | |
509 | |
510 scheduler_->SetDeferCommits(true); | 504 scheduler_->SetDeferCommits(true); |
511 | 505 |
512 scheduler_->SetNeedsCommit(); | 506 scheduler_->SetNeedsCommit(); |
513 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 507 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
514 | 508 |
515 client_->Reset(); | 509 client_->Reset(); |
516 AdvanceFrame(); | 510 AdvanceFrame(); |
517 // BeginMainFrame is not sent during the defer commit is on. | 511 // BeginMainFrame is not sent during the defer commit is on. |
518 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); | 512 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); |
519 | 513 |
(...skipping 12 matching lines...) Expand all Loading... |
532 AdvanceFrame(); | 526 AdvanceFrame(); |
533 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 527 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
534 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 528 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
535 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 529 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
536 } | 530 } |
537 | 531 |
538 TEST_F(SchedulerTest, DeferCommitWithRedraw) { | 532 TEST_F(SchedulerTest, DeferCommitWithRedraw) { |
539 scheduler_settings_.use_external_begin_frame_source = true; | 533 scheduler_settings_.use_external_begin_frame_source = true; |
540 SetUpScheduler(true); | 534 SetUpScheduler(true); |
541 | 535 |
542 scheduler_->SetCanStart(); | |
543 scheduler_->SetVisible(true); | |
544 scheduler_->SetCanDraw(true); | |
545 | |
546 scheduler_->SetDeferCommits(true); | 536 scheduler_->SetDeferCommits(true); |
547 | 537 |
548 scheduler_->SetNeedsCommit(); | 538 scheduler_->SetNeedsCommit(); |
549 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 539 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
550 | 540 |
551 client_->Reset(); | 541 client_->Reset(); |
552 scheduler_->SetNeedsRedraw(); | 542 scheduler_->SetNeedsRedraw(); |
553 EXPECT_NO_ACTION(client_); | 543 EXPECT_NO_ACTION(client_); |
554 | 544 |
555 client_->Reset(); | 545 client_->Reset(); |
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 client_->Reset(); | 2229 client_->Reset(); |
2240 | 2230 |
2241 task_runner().RunPendingTasks(); // Run posted deadline. | 2231 task_runner().RunPendingTasks(); // Run posted deadline. |
2242 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); | 2232 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); |
2243 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); | 2233 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); |
2244 client_->Reset(); | 2234 client_->Reset(); |
2245 } | 2235 } |
2246 | 2236 |
2247 } // namespace | 2237 } // namespace |
2248 } // namespace cc | 2238 } // namespace cc |
OLD | NEW |