| 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 EXPECT_FALSE(client_->needs_begin_frames()); | 447 EXPECT_FALSE(client_->needs_begin_frames()); |
| 448 scheduler_->SetChildrenNeedBeginFrames(true); | 448 scheduler_->SetChildrenNeedBeginFrames(true); |
| 449 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 449 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 450 EXPECT_TRUE(client_->needs_begin_frames()); | 450 EXPECT_TRUE(client_->needs_begin_frames()); |
| 451 | 451 |
| 452 client_->Reset(); | 452 client_->Reset(); |
| 453 EXPECT_SCOPED(AdvanceFrame()); | 453 EXPECT_SCOPED(AdvanceFrame()); |
| 454 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); | 454 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); |
| 455 } | 455 } |
| 456 | 456 |
| 457 TEST_F(SchedulerTest, VideoNeedsBeginFrames) { |
| 458 scheduler_settings_.use_external_begin_frame_source = true; |
| 459 SetUpScheduler(true); |
| 460 |
| 461 scheduler_->SetVideoNeedsBeginFrames(true); |
| 462 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 463 EXPECT_TRUE(client_->needs_begin_frames()); |
| 464 |
| 465 client_->Reset(); |
| 466 EXPECT_SCOPED(AdvanceFrame()); |
| 467 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 468 // WillBeginImplFrame is responsible for sending BeginFrames to video. |
| 469 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); |
| 470 |
| 471 client_->Reset(); |
| 472 EXPECT_SCOPED(AdvanceFrame()); |
| 473 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
| 474 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); |
| 475 |
| 476 client_->Reset(); |
| 477 scheduler_->SetVideoNeedsBeginFrames(false); |
| 478 EXPECT_NO_ACTION(client_); |
| 479 |
| 480 client_->Reset(); |
| 481 task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 482 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending()); |
| 483 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); |
| 484 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); |
| 485 EXPECT_FALSE(client_->needs_begin_frames()); |
| 486 } |
| 487 |
| 457 TEST_F(SchedulerTest, RequestCommit) { | 488 TEST_F(SchedulerTest, RequestCommit) { |
| 458 scheduler_settings_.use_external_begin_frame_source = true; | 489 scheduler_settings_.use_external_begin_frame_source = true; |
| 459 SetUpScheduler(true); | 490 SetUpScheduler(true); |
| 460 | 491 |
| 461 // SetNeedsCommit should begin the frame on the next BeginImplFrame. | 492 // SetNeedsCommit should begin the frame on the next BeginImplFrame. |
| 462 scheduler_->SetNeedsCommit(); | 493 scheduler_->SetNeedsCommit(); |
| 463 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 494 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
| 464 client_->Reset(); | 495 client_->Reset(); |
| 465 | 496 |
| 466 EXPECT_SCOPED(AdvanceFrame()); | 497 EXPECT_SCOPED(AdvanceFrame()); |
| (...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2525 | 2556 |
| 2526 // At the next BeginFrame, authoritative interval is used instead of previous | 2557 // At the next BeginFrame, authoritative interval is used instead of previous |
| 2527 // interval. | 2558 // interval. |
| 2528 EXPECT_NE(initial_interval, scheduler_->begin_impl_frame_args().interval); | 2559 EXPECT_NE(initial_interval, scheduler_->begin_impl_frame_args().interval); |
| 2529 EXPECT_EQ(authoritative_interval, | 2560 EXPECT_EQ(authoritative_interval, |
| 2530 scheduler_->begin_impl_frame_args().interval); | 2561 scheduler_->begin_impl_frame_args().interval); |
| 2531 } | 2562 } |
| 2532 | 2563 |
| 2533 } // namespace | 2564 } // namespace |
| 2534 } // namespace cc | 2565 } // namespace cc |
| OLD | NEW |