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

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

Issue 1039533002: cc: Add support for sending BeginFrames for video. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@misc_video_refactoring
Patch Set: Fix comment. Created 5 years, 8 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_state_machine.cc ('k') | cc/scheduler/video_frame_controller.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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 EXPECT_FALSE(client_->needs_begin_frames()); 447 EXPECT_FALSE(client_->needs_begin_frames());
448 scheduler_->SetChildrenNeedBeginFrames(true); 448 scheduler_->SetChildrenNeedBeginFrames(true);
449 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); 449 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_);
450 EXPECT_TRUE(client_->needs_begin_frames()); 450 EXPECT_TRUE(client_->needs_begin_frames());
451 451
452 client_->Reset(); 452 client_->Reset();
453 EXPECT_SCOPED(AdvanceFrame()); 453 EXPECT_SCOPED(AdvanceFrame());
454 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); 454 EXPECT_TRUE(client_->begin_frame_is_sent_to_children());
455 } 455 }
456 456
457 TEST_F(SchedulerTest, VideoNeedsBeginFrames) {
458 scheduler_settings_.use_external_begin_frame_source = true;
459 SetUpScheduler(true);
460
461 scheduler_->SetVideoNeedsBeginFrames(true);
462 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_);
463 EXPECT_TRUE(client_->needs_begin_frames());
464
465 client_->Reset();
466 EXPECT_SCOPED(AdvanceFrame());
467 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
468 // WillBeginImplFrame is responsible for sending BeginFrames to video.
469 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
470
471 client_->Reset();
472 EXPECT_SCOPED(AdvanceFrame());
473 EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
474 EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
475
476 client_->Reset();
477 scheduler_->SetVideoNeedsBeginFrames(false);
478 EXPECT_NO_ACTION(client_);
479
480 client_->Reset();
481 task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true));
482 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
483 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 0, 2);
484 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
485 EXPECT_FALSE(client_->needs_begin_frames());
486 }
487
457 TEST_F(SchedulerTest, RequestCommit) { 488 TEST_F(SchedulerTest, RequestCommit) {
458 scheduler_settings_.use_external_begin_frame_source = true; 489 scheduler_settings_.use_external_begin_frame_source = true;
459 SetUpScheduler(true); 490 SetUpScheduler(true);
460 491
461 // SetNeedsCommit should begin the frame on the next BeginImplFrame. 492 // SetNeedsCommit should begin the frame on the next BeginImplFrame.
462 scheduler_->SetNeedsCommit(); 493 scheduler_->SetNeedsCommit();
463 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_); 494 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_);
464 client_->Reset(); 495 client_->Reset();
465 496
466 EXPECT_SCOPED(AdvanceFrame()); 497 EXPECT_SCOPED(AdvanceFrame());
(...skipping 2056 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 2554
2524 // At the next BeginFrame, authoritative interval is used instead of previous 2555 // At the next BeginFrame, authoritative interval is used instead of previous
2525 // interval. 2556 // interval.
2526 EXPECT_NE(initial_interval, scheduler_->begin_impl_frame_args().interval); 2557 EXPECT_NE(initial_interval, scheduler_->begin_impl_frame_args().interval);
2527 EXPECT_EQ(authoritative_interval, 2558 EXPECT_EQ(authoritative_interval,
2528 scheduler_->begin_impl_frame_args().interval); 2559 scheduler_->begin_impl_frame_args().interval);
2529 } 2560 }
2530 2561
2531 } // namespace 2562 } // namespace
2532 } // namespace cc 2563 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | cc/scheduler/video_frame_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698