| 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 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2611 EXPECT_NO_ACTION(client_); | 2611 EXPECT_NO_ACTION(client_); |
| 2612 | 2612 |
| 2613 // Allow new commit even though previous commit hasn't been drawn. | 2613 // Allow new commit even though previous commit hasn't been drawn. |
| 2614 scheduler_->NotifyReadyToCommit(); | 2614 scheduler_->NotifyReadyToCommit(); |
| 2615 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2615 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
| 2616 client_->Reset(); | 2616 client_->Reset(); |
| 2617 } | 2617 } |
| 2618 | 2618 |
| 2619 TEST_F(SchedulerTest, AuthoritativeVSyncInterval) { | 2619 TEST_F(SchedulerTest, AuthoritativeVSyncInterval) { |
| 2620 SetUpScheduler(true); | 2620 SetUpScheduler(true); |
| 2621 base::TimeDelta initial_interval = scheduler_->BeginImplFrameInterval(); | 2621 |
| 2622 base::TimeDelta initial_interval = |
| 2623 scheduler_->begin_impl_frame_args().interval; |
| 2622 base::TimeDelta authoritative_interval = | 2624 base::TimeDelta authoritative_interval = |
| 2623 base::TimeDelta::FromMilliseconds(33); | 2625 base::TimeDelta::FromMilliseconds(33); |
| 2624 | 2626 |
| 2625 scheduler_->SetNeedsCommit(); | 2627 scheduler_->SetNeedsCommit(); |
| 2626 EXPECT_SCOPED(AdvanceFrame()); | 2628 EXPECT_SCOPED(AdvanceFrame()); |
| 2627 | 2629 |
| 2628 EXPECT_EQ(initial_interval, scheduler_->BeginImplFrameInterval()); | 2630 EXPECT_EQ(initial_interval, scheduler_->begin_impl_frame_args().interval); |
| 2629 | 2631 |
| 2630 scheduler_->NotifyBeginMainFrameStarted(); | 2632 scheduler_->NotifyBeginMainFrameStarted(); |
| 2631 scheduler_->NotifyReadyToCommit(); | 2633 scheduler_->NotifyReadyToCommit(); |
| 2632 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 2634 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
| 2633 | 2635 |
| 2634 scheduler_->SetAuthoritativeVSyncInterval(authoritative_interval); | 2636 scheduler_->SetAuthoritativeVSyncInterval(authoritative_interval); |
| 2635 | 2637 |
| 2636 EXPECT_SCOPED(AdvanceFrame()); | 2638 EXPECT_SCOPED(AdvanceFrame()); |
| 2637 | 2639 |
| 2638 // At the next BeginFrame, authoritative interval is used instead of previous | 2640 // At the next BeginFrame, authoritative interval is used instead of previous |
| 2639 // interval. | 2641 // interval. |
| 2640 EXPECT_NE(initial_interval, scheduler_->BeginImplFrameInterval()); | 2642 EXPECT_NE(initial_interval, scheduler_->begin_impl_frame_args().interval); |
| 2641 EXPECT_EQ(authoritative_interval, scheduler_->BeginImplFrameInterval()); | 2643 EXPECT_EQ(authoritative_interval, |
| 2644 scheduler_->begin_impl_frame_args().interval); |
| 2642 } | 2645 } |
| 2643 | 2646 |
| 2644 } // namespace | 2647 } // namespace |
| 2645 } // namespace cc | 2648 } // namespace cc |
| OLD | NEW |