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

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

Issue 1218663007: cc: Allow SendBeginMainFrame in idle state for synchronous compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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
« no previous file with comments | « cc/scheduler/scheduler_state_machine_unittest.cc ('k') | no next file » | 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 3361 matching lines...) Expand 10 before | Expand all | Expand 10 after
3372 // Next vsync. 3372 // Next vsync.
3373 EXPECT_SCOPED(AdvanceFrame()); 3373 EXPECT_SCOPED(AdvanceFrame());
3374 EXPECT_FALSE(scheduler_->PrepareTilesPending()); 3374 EXPECT_FALSE(scheduler_->PrepareTilesPending());
3375 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3); 3375 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
3376 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 1, 3); 3376 EXPECT_ACTION("SetNeedsBeginFrames(false)", client_, 1, 3);
3377 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3); 3377 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
3378 EXPECT_FALSE(client_->needs_begin_frames()); 3378 EXPECT_FALSE(client_->needs_begin_frames());
3379 client_->Reset(); 3379 client_->Reset();
3380 } 3380 }
3381 3381
3382 TEST_F(SchedulerTest, SynchronousCompositorSendBeginMainFrameWhileIdle) {
3383 scheduler_settings_.using_synchronous_renderer_compositor = true;
3384 scheduler_settings_.use_external_begin_frame_source = true;
3385
3386 SetUpScheduler(true);
3387
3388 scheduler_->SetNeedsRedraw();
3389 EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client_);
3390 client_->Reset();
3391
3392 // Next vsync.
3393 EXPECT_SCOPED(AdvanceFrame());
3394 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
3395 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 3);
3396 EXPECT_ACTION("ScheduledActionInvalidateOutputSurface", client_, 2, 3);
3397 client_->Reset();
3398
3399 // Android onDraw.
3400 scheduler_->SetNeedsRedraw();
3401 scheduler_->OnDrawForOutputSurface();
3402 EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
3403 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
3404 EXPECT_FALSE(scheduler_->PrepareTilesPending());
3405 client_->Reset();
3406
3407 // Simulate SetNeedsCommit due to input event.
3408 scheduler_->SetNeedsCommit();
3409 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_);
3410 client_->Reset();
3411
3412 scheduler_->NotifyBeginMainFrameStarted();
3413 scheduler_->NotifyReadyToCommit();
3414 EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
3415 client_->Reset();
3416
3417 scheduler_->NotifyReadyToActivate();
3418 EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
3419 client_->Reset();
3420
3421 // Next vsync.
3422 EXPECT_SCOPED(AdvanceFrame());
3423 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
3424 EXPECT_ACTION("ScheduledActionAnimate", client_, 1, 3);
3425 EXPECT_ACTION("ScheduledActionInvalidateOutputSurface", client_, 2, 3);
3426 client_->Reset();
3427
3428 // Android onDraw.
3429 scheduler_->SetNeedsRedraw();
3430 scheduler_->OnDrawForOutputSurface();
3431 EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
3432 EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
3433 EXPECT_FALSE(scheduler_->PrepareTilesPending());
3434 client_->Reset();
3435
3436 // Simulate SetNeedsCommit due to input event.
3437 scheduler_->SetNeedsCommit();
3438 EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_);
3439 client_->Reset();
3440 }
3441
3382 TEST_F(SchedulerTest, AuthoritativeVSyncInterval) { 3442 TEST_F(SchedulerTest, AuthoritativeVSyncInterval) {
3383 SetUpScheduler(true); 3443 SetUpScheduler(true);
3384 base::TimeDelta initial_interval = scheduler_->BeginImplFrameInterval(); 3444 base::TimeDelta initial_interval = scheduler_->BeginImplFrameInterval();
3385 base::TimeDelta authoritative_interval = 3445 base::TimeDelta authoritative_interval =
3386 base::TimeDelta::FromMilliseconds(33); 3446 base::TimeDelta::FromMilliseconds(33);
3387 3447
3388 scheduler_->SetNeedsCommit(); 3448 scheduler_->SetNeedsCommit();
3389 EXPECT_SCOPED(AdvanceFrame()); 3449 EXPECT_SCOPED(AdvanceFrame());
3390 3450
3391 EXPECT_EQ(initial_interval, scheduler_->BeginImplFrameInterval()); 3451 EXPECT_EQ(initial_interval, scheduler_->BeginImplFrameInterval());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3433 scheduler_->SetImplLatencyTakesPriority(true); 3493 scheduler_->SetImplLatencyTakesPriority(true);
3434 scheduler_->SetChildrenNeedBeginFrames(true); 3494 scheduler_->SetChildrenNeedBeginFrames(true);
3435 3495
3436 EXPECT_SCOPED(AdvanceFrame()); 3496 EXPECT_SCOPED(AdvanceFrame());
3437 EXPECT_TRUE(client_->begin_frame_is_sent_to_children()); 3497 EXPECT_TRUE(client_->begin_frame_is_sent_to_children());
3438 EXPECT_FALSE(client_->begin_frame_args_sent_to_children().on_critical_path); 3498 EXPECT_FALSE(client_->begin_frame_args_sent_to_children().on_critical_path);
3439 } 3499 }
3440 3500
3441 } // namespace 3501 } // namespace
3442 } // namespace cc 3502 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698