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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 task_runner().RunPendingTasks(); // Run posted deadline. | 523 task_runner().RunPendingTasks(); // Run posted deadline. |
524 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); | 524 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); |
525 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); | 525 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); |
526 client_->Reset(); | 526 client_->Reset(); |
527 } | 527 } |
528 | 528 |
529 TEST_F(SchedulerTest, RequestCommitAfterSetDeferCommit) { | 529 TEST_F(SchedulerTest, RequestCommitAfterSetDeferCommit) { |
530 scheduler_settings_.use_external_begin_frame_source = true; | 530 scheduler_settings_.use_external_begin_frame_source = true; |
531 SetUpScheduler(true); | 531 SetUpScheduler(true); |
532 | 532 |
533 scheduler_->SetCanStart(); | |
534 scheduler_->SetVisible(true); | |
535 scheduler_->SetCanDraw(true); | |
brianderson
2015/03/02 22:38:15
Why was this block removed?
simonhong
2015/03/03 22:54:12
This is just a clean up.
Above three function call
| |
536 | |
537 scheduler_->SetDeferCommits(true); | 533 scheduler_->SetDeferCommits(true); |
538 | 534 |
539 scheduler_->SetNeedsCommit(); | 535 scheduler_->SetNeedsCommit(); |
540 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 536 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
541 | 537 |
542 client_->Reset(); | 538 client_->Reset(); |
543 AdvanceFrame(); | 539 AdvanceFrame(); |
544 // BeginMainFrame is not sent during the defer commit is on. | 540 // BeginMainFrame is not sent during the defer commit is on. |
545 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); | 541 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); |
546 | 542 |
(...skipping 12 matching lines...) Expand all Loading... | |
559 AdvanceFrame(); | 555 AdvanceFrame(); |
560 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | 556 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
561 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | 557 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
562 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 558 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
563 } | 559 } |
564 | 560 |
565 TEST_F(SchedulerTest, DeferCommitWithRedraw) { | 561 TEST_F(SchedulerTest, DeferCommitWithRedraw) { |
566 scheduler_settings_.use_external_begin_frame_source = true; | 562 scheduler_settings_.use_external_begin_frame_source = true; |
567 SetUpScheduler(true); | 563 SetUpScheduler(true); |
568 | 564 |
569 scheduler_->SetCanStart(); | |
570 scheduler_->SetVisible(true); | |
571 scheduler_->SetCanDraw(true); | |
brianderson
2015/03/02 22:38:16
Why was this block removed?
simonhong
2015/03/03 22:54:12
ditto.
| |
572 | |
573 scheduler_->SetDeferCommits(true); | 565 scheduler_->SetDeferCommits(true); |
574 | 566 |
575 scheduler_->SetNeedsCommit(); | 567 scheduler_->SetNeedsCommit(); |
576 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); | 568 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); |
577 | 569 |
578 client_->Reset(); | 570 client_->Reset(); |
579 scheduler_->SetNeedsRedraw(); | 571 scheduler_->SetNeedsRedraw(); |
580 EXPECT_NO_ACTION(client_); | 572 EXPECT_NO_ACTION(client_); |
581 | 573 |
582 client_->Reset(); | 574 client_->Reset(); |
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2389 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); | 2381 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_); |
2390 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); | 2382 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending()); |
2391 client_->Reset(); | 2383 client_->Reset(); |
2392 | 2384 |
2393 task_runner().RunPendingTasks(); // Run posted deadline. | 2385 task_runner().RunPendingTasks(); // Run posted deadline. |
2394 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); | 2386 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2); |
2395 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); | 2387 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); |
2396 client_->Reset(); | 2388 client_->Reset(); |
2397 } | 2389 } |
2398 | 2390 |
2391 TEST_F(SchedulerTest, AuthoritativeVSyncInterval) { | |
2392 SetUpScheduler(true); | |
2393 | |
2394 base::TimeDelta initial_interval = | |
2395 scheduler_->begin_impl_frame_args().interval; | |
2396 base::TimeDelta authoritative_interval = | |
2397 base::TimeDelta::FromMilliseconds(33); | |
2398 | |
2399 scheduler_->SetNeedsCommit(); | |
2400 EXPECT_SCOPED(AdvanceFrame()); | |
2401 | |
2402 EXPECT_EQ(initial_interval, scheduler_->begin_impl_frame_args().interval); | |
2403 | |
2404 scheduler_->NotifyBeginMainFrameStarted(); | |
2405 scheduler_->NotifyReadyToCommit(); | |
2406 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | |
2407 | |
2408 scheduler_->SetAuthoritativeVSyncInterval(authoritative_interval); | |
2409 | |
2410 EXPECT_SCOPED(AdvanceFrame()); | |
2411 | |
2412 // At the next BeginFrame, authoritative interval is used. | |
2413 EXPECT_EQ(authoritative_interval, | |
brianderson
2015/03/02 22:38:16
Can you also EXPECT_NE to initial_interval so it's
simonhong
2015/03/03 22:54:12
Done.
| |
2414 scheduler_->begin_impl_frame_args().interval); | |
2415 } | |
2416 | |
2399 } // namespace | 2417 } // namespace |
2400 } // namespace cc | 2418 } // namespace cc |
OLD | NEW |