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 2898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2909 EXPECT_NO_ACTION(client_); | 2909 EXPECT_NO_ACTION(client_); |
2910 | 2910 |
2911 // Allow new commit even though previous commit hasn't been drawn. | 2911 // Allow new commit even though previous commit hasn't been drawn. |
2912 scheduler_->NotifyReadyToCommit(); | 2912 scheduler_->NotifyReadyToCommit(); |
2913 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); | 2913 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
2914 client_->Reset(); | 2914 client_->Reset(); |
2915 } | 2915 } |
2916 | 2916 |
2917 TEST_F(SchedulerTest, AuthoritativeVSyncInterval) { | 2917 TEST_F(SchedulerTest, AuthoritativeVSyncInterval) { |
2918 SetUpScheduler(true); | 2918 SetUpScheduler(true); |
2919 | 2919 base::TimeDelta initial_interval = scheduler_->BeginImplFrameInterval(); |
2920 base::TimeDelta initial_interval = | |
2921 scheduler_->begin_impl_frame_args().interval; | |
2922 base::TimeDelta authoritative_interval = | 2920 base::TimeDelta authoritative_interval = |
2923 base::TimeDelta::FromMilliseconds(33); | 2921 base::TimeDelta::FromMilliseconds(33); |
2924 | 2922 |
2925 scheduler_->SetNeedsCommit(); | 2923 scheduler_->SetNeedsCommit(); |
2926 EXPECT_SCOPED(AdvanceFrame()); | 2924 EXPECT_SCOPED(AdvanceFrame()); |
2927 | 2925 |
2928 EXPECT_EQ(initial_interval, scheduler_->begin_impl_frame_args().interval); | 2926 EXPECT_EQ(initial_interval, scheduler_->BeginImplFrameInterval()); |
2929 | 2927 |
2930 scheduler_->NotifyBeginMainFrameStarted(); | 2928 scheduler_->NotifyBeginMainFrameStarted(); |
2931 scheduler_->NotifyReadyToCommit(); | 2929 scheduler_->NotifyReadyToCommit(); |
2932 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); | 2930 task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true)); |
2933 | 2931 |
2934 scheduler_->SetAuthoritativeVSyncInterval(authoritative_interval); | 2932 scheduler_->SetAuthoritativeVSyncInterval(authoritative_interval); |
2935 | 2933 |
2936 EXPECT_SCOPED(AdvanceFrame()); | 2934 EXPECT_SCOPED(AdvanceFrame()); |
2937 | 2935 |
2938 // At the next BeginFrame, authoritative interval is used instead of previous | 2936 // At the next BeginFrame, authoritative interval is used instead of previous |
2939 // interval. | 2937 // interval. |
2940 EXPECT_NE(initial_interval, scheduler_->begin_impl_frame_args().interval); | 2938 EXPECT_NE(initial_interval, scheduler_->BeginImplFrameInterval()); |
2941 EXPECT_EQ(authoritative_interval, | 2939 EXPECT_EQ(authoritative_interval, scheduler_->BeginImplFrameInterval()); |
2942 scheduler_->begin_impl_frame_args().interval); | |
2943 } | 2940 } |
2944 | 2941 |
2945 } // namespace | 2942 } // namespace |
2946 } // namespace cc | 2943 } // namespace cc |
OLD | NEW |