Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: cc/scheduler/scheduler_unittest.cc

Issue 2150533004: cc: Send all begin frames using a PostTask. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scheduler_unittest_no_deadline
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 std::vector<std::unique_ptr<base::trace_event::ConvertableToTraceFormat>> 213 std::vector<std::unique_ptr<base::trace_event::ConvertableToTraceFormat>>
214 states_; 214 states_;
215 TestScheduler* scheduler_; 215 TestScheduler* scheduler_;
216 }; 216 };
217 217
218 class SchedulerTest : public testing::Test { 218 class SchedulerTest : public testing::Test {
219 public: 219 public:
220 SchedulerTest() 220 SchedulerTest()
221 : now_src_(new base::SimpleTestTickClock()), 221 : now_src_(new base::SimpleTestTickClock()),
222 task_runner_(new OrderedSimpleTaskRunner(now_src_.get(), true)), 222 task_runner_(new OrderedSimpleTaskRunner(now_src_.get(), true)),
223 fake_external_begin_frame_source_(nullptr) { 223 fake_compositor_timing_history_(nullptr) {
224 now_src_->Advance(base::TimeDelta::FromMicroseconds(10000)); 224 now_src_->Advance(base::TimeDelta::FromMicroseconds(10000));
225 // A bunch of tests require NowTicks() 225 // A bunch of tests require NowTicks()
226 // to be > BeginFrameArgs::DefaultInterval() 226 // to be > BeginFrameArgs::DefaultInterval()
227 now_src_->Advance(base::TimeDelta::FromMilliseconds(100)); 227 now_src_->Advance(base::TimeDelta::FromMilliseconds(100));
228 // Fail if we need to run 100 tasks in a row. 228 // Fail if we need to run 100 tasks in a row.
229 task_runner_->SetRunTaskLimit(100); 229 task_runner_->SetRunTaskLimit(100);
230 } 230 }
231 231
232 ~SchedulerTest() override {} 232 ~SchedulerTest() override {}
233 233
234 protected: 234 protected:
235 TestScheduler* CreateScheduler() { 235 TestScheduler* CreateScheduler() {
236 BeginFrameSource* frame_source; 236 BeginFrameSource* frame_source;
237 unthrottled_frame_source_.reset(new BackToBackBeginFrameSource( 237 unthrottled_frame_source_.reset(
238 base::MakeUnique<TestDelayBasedTimeSource>(now_src_.get(), 238 new BackToBackBeginFrameSource(task_runner_.get(), now_src_.get()));
239 task_runner_.get())));
240 fake_external_begin_frame_source_.reset( 239 fake_external_begin_frame_source_.reset(
241 new FakeExternalBeginFrameSource(0.f, false)); 240 new FakeExternalBeginFrameSource(0.f, false));
242 fake_external_begin_frame_source_->SetClient(client_.get()); 241 fake_external_begin_frame_source_->SetClient(client_.get());
243 synthetic_frame_source_.reset(new DelayBasedBeginFrameSource( 242 synthetic_frame_source_.reset(
244 base::MakeUnique<TestDelayBasedTimeSource>(now_src_.get(), 243 new DelayBasedBeginFrameSource(task_runner_.get(), now_src_.get()));
245 task_runner_.get())));
246 if (!scheduler_settings_.throttle_frame_production) { 244 if (!scheduler_settings_.throttle_frame_production) {
247 frame_source = unthrottled_frame_source_.get(); 245 frame_source = unthrottled_frame_source_.get();
248 } else if (scheduler_settings_.use_external_begin_frame_source) { 246 } else if (scheduler_settings_.use_external_begin_frame_source) {
249 frame_source = fake_external_begin_frame_source_.get(); 247 frame_source = fake_external_begin_frame_source_.get();
250 } else { 248 } else {
251 frame_source = synthetic_frame_source_.get(); 249 frame_source = synthetic_frame_source_.get();
252 } 250 }
253 251
254 std::unique_ptr<FakeCompositorTimingHistory> 252 std::unique_ptr<FakeCompositorTimingHistory>
255 fake_compositor_timing_history = FakeCompositorTimingHistory::Create( 253 fake_compositor_timing_history = FakeCompositorTimingHistory::Create(
(...skipping 3431 matching lines...) Expand 10 before | Expand all | Expand 10 after
3687 } 3685 }
3688 3686
3689 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) { 3687 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) {
3690 EXPECT_FALSE(BeginMainFrameOnCriticalPath( 3688 EXPECT_FALSE(BeginMainFrameOnCriticalPath(
3691 SMOOTHNESS_TAKES_PRIORITY, 3689 SMOOTHNESS_TAKES_PRIORITY,
3692 ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); 3690 ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration));
3693 } 3691 }
3694 3692
3695 } // namespace 3693 } // namespace
3696 } // namespace cc 3694 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698