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

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

Issue 1201573002: cc: Remove BeginFrameSourcesConstructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove refptr changes Created 5 years, 6 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
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/surfaces/onscreen_display_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // to be > BeginFrameArgs::DefaultInterval() 251 // to be > BeginFrameArgs::DefaultInterval()
252 now_src_->Advance(base::TimeDelta::FromMilliseconds(100)); 252 now_src_->Advance(base::TimeDelta::FromMilliseconds(100));
253 // Fail if we need to run 100 tasks in a row. 253 // Fail if we need to run 100 tasks in a row.
254 task_runner_->SetRunTaskLimit(100); 254 task_runner_->SetRunTaskLimit(100);
255 } 255 }
256 256
257 ~SchedulerTest() override {} 257 ~SchedulerTest() override {}
258 258
259 protected: 259 protected:
260 TestScheduler* CreateScheduler() { 260 TestScheduler* CreateScheduler() {
261 scoped_ptr<FakeExternalBeginFrameSource> fake_external_begin_frame_source;
262 if (scheduler_settings_.use_external_begin_frame_source) { 261 if (scheduler_settings_.use_external_begin_frame_source) {
263 fake_external_begin_frame_source.reset( 262 fake_external_begin_frame_source_.reset(
264 new FakeExternalBeginFrameSource(client_.get())); 263 new FakeExternalBeginFrameSource(client_.get()));
265 fake_external_begin_frame_source_ =
266 fake_external_begin_frame_source.get();
267 } 264 }
268 scheduler_ = TestScheduler::Create(now_src_.get(), client_.get(), 265 scheduler_ = TestScheduler::Create(now_src_.get(), client_.get(),
269 scheduler_settings_, 0, task_runner_, 266 scheduler_settings_, 0, task_runner_,
270 fake_external_begin_frame_source.Pass()); 267 fake_external_begin_frame_source_.get());
271 DCHECK(scheduler_); 268 DCHECK(scheduler_);
272 client_->set_scheduler(scheduler_.get()); 269 client_->set_scheduler(scheduler_.get());
273 return scheduler_.get(); 270 return scheduler_.get();
274 } 271 }
275 272
276 void CreateSchedulerAndInitSurface() { 273 void CreateSchedulerAndInitSurface() {
277 CreateScheduler(); 274 CreateScheduler();
278 EXPECT_SCOPED(InitializeOutputSurfaceAndFirstCommit()); 275 EXPECT_SCOPED(InitializeOutputSurfaceAndFirstCommit());
279 } 276 }
280 277
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 // Creep the time forward so that any BeginFrameArgs is not equal to the 395 // Creep the time forward so that any BeginFrameArgs is not equal to the
399 // last one otherwise we violate the BeginFrameSource contract. 396 // last one otherwise we violate the BeginFrameSource contract.
400 now_src_->Advance(BeginFrameArgs::DefaultInterval()); 397 now_src_->Advance(BeginFrameArgs::DefaultInterval());
401 BeginFrameArgs args = 398 BeginFrameArgs args =
402 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src()); 399 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src());
403 fake_external_begin_frame_source_->TestOnBeginFrame(args); 400 fake_external_begin_frame_source_->TestOnBeginFrame(args);
404 return args; 401 return args;
405 } 402 }
406 403
407 FakeExternalBeginFrameSource* fake_external_begin_frame_source() const { 404 FakeExternalBeginFrameSource* fake_external_begin_frame_source() const {
408 return fake_external_begin_frame_source_; 405 return fake_external_begin_frame_source_.get();
409 } 406 }
410 407
411 void MainFrameInHighLatencyMode( 408 void MainFrameInHighLatencyMode(
412 int64 begin_main_frame_to_commit_estimate_in_ms, 409 int64 begin_main_frame_to_commit_estimate_in_ms,
413 int64 commit_to_activate_estimate_in_ms, 410 int64 commit_to_activate_estimate_in_ms,
414 bool impl_latency_takes_priority, 411 bool impl_latency_takes_priority,
415 bool should_send_begin_main_frame); 412 bool should_send_begin_main_frame);
416 void BeginFramesNotFromClient(bool use_external_begin_frame_source, 413 void BeginFramesNotFromClient(bool use_external_begin_frame_source,
417 bool throttle_frame_production); 414 bool throttle_frame_production);
418 void BeginFramesNotFromClient_SwapThrottled( 415 void BeginFramesNotFromClient_SwapThrottled(
419 bool use_external_begin_frame_source, 416 bool use_external_begin_frame_source,
420 bool throttle_frame_production); 417 bool throttle_frame_production);
421 418
422 scoped_ptr<base::SimpleTestTickClock> now_src_; 419 scoped_ptr<base::SimpleTestTickClock> now_src_;
423 scoped_refptr<OrderedSimpleTaskRunner> task_runner_; 420 scoped_refptr<OrderedSimpleTaskRunner> task_runner_;
424 FakeExternalBeginFrameSource* fake_external_begin_frame_source_; 421 scoped_ptr<FakeExternalBeginFrameSource> fake_external_begin_frame_source_;
425 SchedulerSettings scheduler_settings_; 422 SchedulerSettings scheduler_settings_;
426 scoped_ptr<FakeSchedulerClient> client_; 423 scoped_ptr<FakeSchedulerClient> client_;
427 scoped_ptr<TestScheduler> scheduler_; 424 scoped_ptr<TestScheduler> scheduler_;
428 }; 425 };
429 426
430 TEST_F(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) { 427 TEST_F(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) {
431 scheduler_settings_.use_external_begin_frame_source = true; 428 scheduler_settings_.use_external_begin_frame_source = true;
432 SetUpScheduler(false); 429 SetUpScheduler(false);
433 scheduler_->SetCanStart(); 430 scheduler_->SetCanStart();
434 scheduler_->SetVisible(true); 431 scheduler_->SetVisible(true);
(...skipping 2546 matching lines...) Expand 10 before | Expand all | Expand 10 after
2981 scheduler_->SetImplLatencyTakesPriority(true); 2978 scheduler_->SetImplLatencyTakesPriority(true);
2982 scheduler_->SetChildrenNeedBeginFrames(true); 2979 scheduler_->SetChildrenNeedBeginFrames(true);
2983 2980
2984 EXPECT_SCOPED(AdvanceFrame()); 2981 EXPECT_SCOPED(AdvanceFrame());
2985 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); 2982 EXPECT_TRUE(client_->begin_frame_is_sent_to_children());
2986 EXPECT_FALSE(client_->begin_frame_args_sent_to_children().on_critical_path); 2983 EXPECT_FALSE(client_->begin_frame_args_sent_to_children().on_critical_path);
2987 } 2984 }
2988 2985
2989 } // namespace 2986 } // namespace
2990 } // namespace cc 2987 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.cc ('k') | cc/surfaces/onscreen_display_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698