| Index: cc/scheduler/scheduler_unittest.cc
|
| diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
|
| index 4b12a5d8b14b3c8754f2adde73bd84f38192fb20..cbc617b6e609add54ae3f4f3eefee4fd293393d8 100644
|
| --- a/cc/scheduler/scheduler_unittest.cc
|
| +++ b/cc/scheduler/scheduler_unittest.cc
|
| @@ -229,14 +229,28 @@ class FakeExternalBeginFrameSource : public BeginFrameSourceBase {
|
| BeginFrameSourceBase::RemoveObserver(obs);
|
| }
|
|
|
| + void DidFinishFrame(BeginFrameObserver* obs) override {
|
| + // Send a MISSED begin frame if necessary.
|
| + if (missed_begin_frame_args_.IsValid()) {
|
| + BeginFrameArgs last_args = obs->LastUsedBeginFrameArgs();
|
| + if (!last_args.IsValid() ||
|
| + (missed_begin_frame_args_.frame_time > last_args.frame_time)) {
|
| + obs->OnBeginFrame(missed_begin_frame_args_);
|
| + }
|
| + }
|
| + }
|
| +
|
| // TODO(sunnyps): Use using CallOnBeginFrame, SetBeginFrameSourcePaused.
|
| void TestOnBeginFrame(const BeginFrameArgs& args) {
|
| + missed_begin_frame_args_ = args;
|
| + missed_begin_frame_args_.type = BeginFrameArgs::MISSED;
|
| return CallOnBeginFrame(args);
|
| }
|
|
|
| void SetPaused(bool paused) { SetBeginFrameSourcePaused(paused); }
|
|
|
| private:
|
| + BeginFrameArgs missed_begin_frame_args_;
|
| FakeSchedulerClient* client_;
|
| };
|
|
|
| @@ -329,19 +343,16 @@ class SchedulerTest : public testing::Test {
|
| scheduler_->SetVisible(true);
|
| scheduler_->SetCanDraw(true);
|
| EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_);
|
| -
|
| client_->Reset();
|
|
|
| // We don't see anything happening until the first impl frame.
|
| scheduler_->DidCreateAndInitializeOutputSurface();
|
| scheduler_->SetNeedsBeginMainFrame();
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| - client_->Reset();
|
|
|
| {
|
| SCOPED_TRACE("Do first frame to commit after initialize.");
|
| - AdvanceFrame();
|
| + EXPECT_SCOPED(AdvanceFrame());
|
|
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| @@ -354,13 +365,7 @@ class SchedulerTest : public testing::Test {
|
| scheduler_->SetNeedsRedraw();
|
| bool resourceless_software_draw = false;
|
| scheduler_->OnDrawForOutputSurface(resourceless_software_draw);
|
| - } else {
|
| - // Run the posted deadline task.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| }
|
| -
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| }
|
|
|
| client_->Reset();
|
| @@ -368,46 +373,40 @@ class SchedulerTest : public testing::Test {
|
| {
|
| SCOPED_TRACE(
|
| "Run second frame so Scheduler calls SetNeedsBeginFrame(false).");
|
| - AdvanceFrame();
|
| -
|
| - if (!scheduler_settings_.using_synchronous_renderer_compositor) {
|
| - // Run the posted deadline task.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - }
|
| + EXPECT_SCOPED(AdvanceFrame());
|
|
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + // Run the deadline or begin frame tasks if any.
|
| + task_runner_->RunPendingTasks();
|
| }
|
|
|
| EXPECT_FALSE(scheduler_->begin_frames_expected());
|
| client_->Reset();
|
| }
|
|
|
| + bool NoNewFrame() {
|
| + return !client_->HasAction("WillBeginImplFrame");
|
| + }
|
| +
|
| // As this function contains EXPECT macros, to allow debugging it should be
|
| // called inside EXPECT_SCOPED like so;
|
| // EXPECT_SCOPED(client.AdvanceFrame());
|
| void AdvanceFrame() {
|
| TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"),
|
| "FakeSchedulerClient::AdvanceFrame");
|
| - // Consume any previous deadline first, if no deadline is currently
|
| - // pending, ImplFrameDeadlinePending will return false straight away and we
|
| - // will run no tasks.
|
| - task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| +
|
| + EXPECT_TRUE(scheduler_->begin_frames_expected());
|
|
|
| // Send the next BeginFrame message if using an external source, otherwise
|
| - // it will be already in the task queue.
|
| + // it is sent automatically.
|
| if (scheduler_->begin_frame_source() ==
|
| fake_external_begin_frame_source_.get()) {
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| + // Consume deadline first.
|
| + task_runner_->RunPendingTasks();
|
| SendNextBeginFrame();
|
| - }
|
| -
|
| - if (!scheduler_->settings().using_synchronous_renderer_compositor) {
|
| - // Then run tasks until new deadline is scheduled.
|
| - EXPECT_TRUE(task_runner_->RunTasksWhile(
|
| - client_->ImplFrameDeadlinePending(false)));
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + } else {
|
| + // Run until a new begin frame is posted.
|
| + task_runner_->RunTasksWhile(
|
| + base::Bind(&SchedulerTest::NoNewFrame, base::Unretained(this)));
|
| }
|
| }
|
|
|
| @@ -2201,239 +2200,42 @@ TEST_F(
|
| EXPECT_ACTION("ScheduledActionCommit", client_, 1, 2);
|
| }
|
|
|
| -TEST_F(SchedulerTest, BeginRetroFrame) {
|
| - scheduler_settings_.use_external_begin_frame_source = true;
|
| - SetUpScheduler(true);
|
| -
|
| - // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
|
| - scheduler_->SetNeedsBeginMainFrame();
|
| - EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
|
| - client_->Reset();
|
| -
|
| - // Create a BeginFrame with a long deadline to avoid race conditions.
|
| - // This is the first BeginFrame, which will be handled immediately.
|
| - BeginFrameArgs args =
|
| - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src());
|
| - args.deadline += base::TimeDelta::FromHours(1);
|
| - fake_external_begin_frame_source()->TestOnBeginFrame(args);
|
| - EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| - EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| - client_->Reset();
|
| -
|
| - // Queue BeginFrames while we are still handling the previous BeginFrame.
|
| - args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - fake_external_begin_frame_source()->TestOnBeginFrame(args);
|
| - args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - fake_external_begin_frame_source()->TestOnBeginFrame(args);
|
| -
|
| - // If we don't swap on the deadline, we wait for the next BeginImplFrame.
|
| - task_runner().RunPendingTasks(); // Run posted deadline.
|
| - EXPECT_NO_ACTION(client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| - client_->Reset();
|
| -
|
| - // NotifyReadyToCommit should trigger the commit.
|
| - scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| - scheduler_->NotifyReadyToCommit();
|
| - EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| - client_->Reset();
|
| -
|
| - // NotifyReadyToActivate should trigger the activation.
|
| - scheduler_->NotifyReadyToActivate();
|
| - EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| - client_->Reset();
|
| -
|
| - // BeginImplFrame should prepare the draw.
|
| - task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
|
| - EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| - client_->Reset();
|
| -
|
| - // BeginImplFrame deadline should draw.
|
| - task_runner().RunPendingTasks(); // Run posted deadline.
|
| - EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| - client_->Reset();
|
| -
|
| - // The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
|
| - // to avoid excessive toggles.
|
| - task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
|
| - EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - client_->Reset();
|
| -
|
| - task_runner().RunPendingTasks(); // Run posted deadline.
|
| - EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2);
|
| - EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
|
| - client_->Reset();
|
| -}
|
| -
|
| -TEST_F(SchedulerTest, RetroFrameDoesNotExpireTooEarly) {
|
| +TEST_F(SchedulerTest, BeginFrameWhileDeadlinePending) {
|
| scheduler_settings_.use_external_begin_frame_source = true;
|
| SetUpScheduler(true);
|
|
|
| scheduler_->SetNeedsBeginMainFrame();
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| - EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
|
| -
|
| - client_->Reset();
|
| - EXPECT_SCOPED(AdvanceFrame());
|
| - EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| - EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| -
|
| - client_->Reset();
|
| - scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| -
|
| - client_->Reset();
|
| - BeginFrameArgs retro_frame_args = SendNextBeginFrame();
|
| - // This BeginFrame is queued up as a retro frame.
|
| - EXPECT_NO_ACTION(client_);
|
| - // The previous deadline is still pending.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| -
|
| - client_->Reset();
|
| - // This main frame activating should schedule the (previous) deadline to
|
| - // trigger immediately.
|
| - scheduler_->NotifyReadyToCommit();
|
| - scheduler_->NotifyReadyToActivate();
|
| - EXPECT_ACTION("ScheduledActionCommit", client_, 0, 2);
|
| - EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 2);
|
| -
|
| - client_->Reset();
|
| - // The deadline task should trigger causing a draw.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
| -
|
| - // Keep animating.
|
| - client_->Reset();
|
| - scheduler_->SetNeedsOneBeginImplFrame();
|
| scheduler_->SetNeedsRedraw();
|
| - EXPECT_NO_ACTION(client_);
|
| -
|
| - // Let's advance to the retro frame's deadline.
|
| - now_src()->Advance(retro_frame_args.deadline - now_src()->NowTicks());
|
| -
|
| - // The retro frame hasn't expired yet.
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(false));
|
| - EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| -
|
| - // This is an immediate deadline case.
|
| - client_->Reset();
|
| - task_runner().RunPendingTasks();
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| - EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
|
| -}
|
| -
|
| -TEST_F(SchedulerTest, RetroFrameExpiresOnTime) {
|
| - scheduler_settings_.use_external_begin_frame_source = true;
|
| - SetUpScheduler(true);
|
| -
|
| - scheduler_->SetNeedsBeginMainFrame();
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
|
| -
|
| client_->Reset();
|
| +
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| -
|
| client_->Reset();
|
| - scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
|
|
| - client_->Reset();
|
| - BeginFrameArgs retro_frame_args = SendNextBeginFrame();
|
| - // This BeginFrame is queued up as a retro frame.
|
| + // Begin frame is skipped while deadline is pending.
|
| + EXPECT_SCOPED(SendNextBeginFrame());
|
| EXPECT_NO_ACTION(client_);
|
| - // The previous deadline is still pending.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| -
|
| client_->Reset();
|
| - // This main frame activating should schedule the (previous) deadline to
|
| - // trigger immediately.
|
| - scheduler_->NotifyReadyToCommit();
|
| - scheduler_->NotifyReadyToActivate();
|
| - EXPECT_ACTION("ScheduledActionCommit", client_, 0, 2);
|
| - EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 2);
|
|
|
| - client_->Reset();
|
| - // The deadline task should trigger causing a draw.
|
| + // Finishing the previous frame causes BFS to send the begin frame again.
|
| + task_runner_->RunPendingTasks();
|
| + EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 2);
|
| + EXPECT_ACTION("WillBeginImplFrame", client_, 1, 2);
|
| EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
| -
|
| - // Keep animating.
|
| client_->Reset();
|
| - scheduler_->SetNeedsOneBeginImplFrame();
|
| - scheduler_->SetNeedsRedraw();
|
| - EXPECT_NO_ACTION(client_);
|
|
|
| - // Let's advance sufficiently past the retro frame's deadline.
|
| - now_src()->Advance(retro_frame_args.deadline - now_src()->NowTicks() +
|
| - base::TimeDelta::FromMicroseconds(1));
|
| -
|
| - // The retro frame should've expired.
|
| + EXPECT_SCOPED(SendNextBeginFrame());
|
| EXPECT_NO_ACTION(client_);
|
| -}
|
| -
|
| -TEST_F(SchedulerTest, MissedFrameDoesNotExpireTooEarly) {
|
| - scheduler_settings_.use_external_begin_frame_source = true;
|
| - SetUpScheduler(true);
|
| -
|
| - scheduler_->SetNeedsBeginMainFrame();
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| - EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
|
| -
|
| - BeginFrameArgs missed_frame_args =
|
| - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src());
|
| - missed_frame_args.type = BeginFrameArgs::MISSED;
|
| -
|
| - // Advance to the deadline.
|
| - now_src()->Advance(missed_frame_args.deadline - now_src()->NowTicks());
|
| -
|
| - // Missed frame is handled because it's on time.
|
| client_->Reset();
|
| - fake_external_begin_frame_source_->TestOnBeginFrame(missed_frame_args);
|
| - EXPECT_TRUE(
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(false)));
|
| - EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| - EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| -}
|
| -
|
| -TEST_F(SchedulerTest, MissedFrameExpiresOnTime) {
|
| - scheduler_settings_.use_external_begin_frame_source = true;
|
| - SetUpScheduler(true);
|
| -
|
| - scheduler_->SetNeedsBeginMainFrame();
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| - EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
|
| -
|
| - BeginFrameArgs missed_frame_args =
|
| - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src());
|
| - missed_frame_args.type = BeginFrameArgs::MISSED;
|
|
|
| - // Advance sufficiently past the deadline.
|
| - now_src()->Advance(missed_frame_args.deadline - now_src()->NowTicks() +
|
| - base::TimeDelta::FromMicroseconds(1));
|
| -
|
| - // Missed frame is dropped because it's too late.
|
| - client_->Reset();
|
| - fake_external_begin_frame_source_->TestOnBeginFrame(missed_frame_args);
|
| - EXPECT_FALSE(
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(false)));
|
| - EXPECT_NO_ACTION(client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + // No redraw this frame.
|
| + task_runner_->RunPendingTasks();
|
| + EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
|
| + EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| }
|
|
|
| void SchedulerTest::BeginFramesNotFromClient(
|
| @@ -2444,24 +2246,21 @@ void SchedulerTest::BeginFramesNotFromClient(
|
| scheduler_settings_.throttle_frame_production = throttle_frame_production;
|
| SetUpScheduler(true);
|
|
|
| - // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame
|
| - // without calling SetNeedsBeginFrame.
|
| - scheduler_->SetNeedsBeginMainFrame();
|
| - EXPECT_NO_ACTION(client_);
|
| - client_->Reset();
|
| -
|
| // When the client-driven BeginFrame are disabled, the scheduler posts it's
|
| // own BeginFrame tasks.
|
| - task_runner().RunPendingTasks(); // Run posted BeginFrame.
|
| + scheduler_->SetNeedsBeginMainFrame();
|
| +
|
| + // SyntheticBFS would have already sent a begin frame.
|
| + EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| client_->Reset();
|
|
|
| // If we don't swap on the deadline, we wait for the next BeginFrame.
|
| - task_runner().RunPendingTasks(); // Run posted deadline.
|
| - EXPECT_NO_ACTION(client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_SCOPED(AdvanceFrame());
|
| + EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
|
| + EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| client_->Reset();
|
|
|
| // NotifyReadyToCommit should trigger the commit.
|
| @@ -2475,12 +2274,6 @@ void SchedulerTest::BeginFramesNotFromClient(
|
| EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
|
| client_->Reset();
|
|
|
| - // BeginImplFrame should prepare the draw.
|
| - task_runner().RunPendingTasks(); // Run posted BeginFrame.
|
| - EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - client_->Reset();
|
| -
|
| // BeginImplFrame deadline should draw.
|
| task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
| @@ -2489,14 +2282,14 @@ void SchedulerTest::BeginFramesNotFromClient(
|
|
|
| // The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
|
| // to avoid excessive toggles.
|
| - task_runner().RunPendingTasks(); // Run posted BeginFrame.
|
| + EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
|
| EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| client_->Reset();
|
|
|
| // Make sure SetNeedsBeginFrame isn't called on the client
|
| // when the BeginFrame is no longer needed.
|
| - task_runner().RunPendingTasks(); // Run posted deadline.
|
| + task_runner_->RunPendingTasks();
|
| EXPECT_SINGLE_ACTION("SendBeginMainFrameNotExpectedSoon", client_);
|
| client_->Reset();
|
| }
|
| @@ -2540,10 +2333,7 @@ void SchedulerTest::BeginFramesNotFromClient_SwapThrottled(
|
| client_->SetAutomaticSwapAck(false);
|
|
|
| // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
|
| - client_->Reset();
|
| scheduler_->SetNeedsBeginMainFrame();
|
| - EXPECT_NO_ACTION(client_);
|
| - client_->Reset();
|
|
|
| // Trigger the first BeginImplFrame and BeginMainFrame
|
| EXPECT_SCOPED(AdvanceFrame());
|
| @@ -2790,140 +2580,6 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsPrepareTiles) {
|
| EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 3, 4);
|
| }
|
|
|
| -TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) {
|
| - scheduler_settings_.use_external_begin_frame_source = true;
|
| - SetUpScheduler(true);
|
| -
|
| - // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
|
| - scheduler_->SetNeedsBeginMainFrame();
|
| - EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
|
| -
|
| - // Create a BeginFrame with a long deadline to avoid race conditions.
|
| - // This is the first BeginFrame, which will be handled immediately.
|
| - client_->Reset();
|
| - BeginFrameArgs args =
|
| - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src());
|
| - args.deadline += base::TimeDelta::FromHours(1);
|
| - fake_external_begin_frame_source()->TestOnBeginFrame(args);
|
| - EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| - EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| -
|
| - // Queue BeginFrames while we are still handling the previous BeginFrame.
|
| - args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - fake_external_begin_frame_source()->TestOnBeginFrame(args);
|
| - args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - fake_external_begin_frame_source()->TestOnBeginFrame(args);
|
| -
|
| - // If we don't swap on the deadline, we wait for the next BeginImplFrame.
|
| - client_->Reset();
|
| - task_runner().RunPendingTasks(); // Run posted deadline.
|
| - EXPECT_NO_ACTION(client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| -
|
| - // NotifyReadyToCommit should trigger the commit.
|
| - client_->Reset();
|
| - scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| - scheduler_->NotifyReadyToCommit();
|
| - EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| -
|
| - // NotifyReadyToActivate should trigger the activation.
|
| - client_->Reset();
|
| - scheduler_->NotifyReadyToActivate();
|
| - EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| -
|
| - client_->Reset();
|
| - EXPECT_FALSE(scheduler_->IsBeginRetroFrameArgsEmpty());
|
| - scheduler_->DidLoseOutputSurface();
|
| - EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3);
|
| - EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
|
| - EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
|
| - EXPECT_TRUE(scheduler_->IsBeginRetroFrameArgsEmpty());
|
| -
|
| - // Posted BeginRetroFrame is aborted.
|
| - client_->Reset();
|
| - task_runner().RunPendingTasks();
|
| - EXPECT_NO_ACTION(client_);
|
| -}
|
| -
|
| -TEST_F(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
|
| - scheduler_settings_.use_external_begin_frame_source = true;
|
| - SetUpScheduler(true);
|
| -
|
| - // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.
|
| - scheduler_->SetNeedsBeginMainFrame();
|
| - EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
|
| -
|
| - // Create a BeginFrame with a long deadline to avoid race conditions.
|
| - // This is the first BeginFrame, which will be handled immediately.
|
| - client_->Reset();
|
| - BeginFrameArgs args =
|
| - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src());
|
| - args.deadline += base::TimeDelta::FromHours(1);
|
| - fake_external_begin_frame_source()->TestOnBeginFrame(args);
|
| - EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| - EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| -
|
| - // Queue BeginFrames while we are still handling the previous BeginFrame.
|
| - args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - fake_external_begin_frame_source()->TestOnBeginFrame(args);
|
| - args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - fake_external_begin_frame_source()->TestOnBeginFrame(args);
|
| -
|
| - // If we don't swap on the deadline, we wait for the next BeginImplFrame.
|
| - client_->Reset();
|
| - task_runner().RunPendingTasks(); // Run posted deadline.
|
| - EXPECT_NO_ACTION(client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| -
|
| - // NotifyReadyToCommit should trigger the commit.
|
| - client_->Reset();
|
| - scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| - scheduler_->NotifyReadyToCommit();
|
| - EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| -
|
| - // NotifyReadyToActivate should trigger the activation.
|
| - client_->Reset();
|
| - scheduler_->NotifyReadyToActivate();
|
| - EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| -
|
| - // BeginImplFrame should prepare the draw.
|
| - client_->Reset();
|
| - task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
|
| - EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| -
|
| - client_->Reset();
|
| - EXPECT_FALSE(scheduler_->IsBeginRetroFrameArgsEmpty());
|
| - scheduler_->DidLoseOutputSurface();
|
| - EXPECT_NO_ACTION(client_);
|
| - EXPECT_TRUE(scheduler_->IsBeginRetroFrameArgsEmpty());
|
| -
|
| - // BeginImplFrame deadline should abort drawing.
|
| - client_->Reset();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3);
|
| - EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
|
| - EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| - EXPECT_FALSE(scheduler_->begin_frames_expected());
|
| -
|
| - // No more BeginRetroFrame because BeginRetroFrame queue is cleared.
|
| - client_->Reset();
|
| - task_runner().RunPendingTasks();
|
| - EXPECT_NO_ACTION(client_);
|
| -}
|
| -
|
| TEST_F(SchedulerTest, DidLoseOutputSurfaceWithSyntheticBeginFrameSource) {
|
| SetUpScheduler(true);
|
|
|
| @@ -2932,7 +2588,6 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceWithSyntheticBeginFrameSource) {
|
| scheduler_->SetNeedsBeginMainFrame();
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
|
|
| - client_->Reset();
|
| AdvanceFrame();
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| @@ -3685,6 +3340,7 @@ TEST_F(SchedulerTest, AuthoritativeVSyncInterval) {
|
| synthetic_frame_source_->OnUpdateVSyncParameters(now_src_->NowTicks(),
|
| authoritative_interval);
|
|
|
| + client_->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
|
|
| // At the next BeginFrame, authoritative interval is used instead of previous
|
| @@ -3734,7 +3390,6 @@ TEST_F(SchedulerTest, NoOutputSurfaceCreationWhileCommitPending) {
|
|
|
| // SetNeedsBeginMainFrame should begin the frame.
|
| scheduler_->SetNeedsBeginMainFrame();
|
| - client_->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| @@ -3765,7 +3420,6 @@ TEST_F(SchedulerTest, OutputSurfaceCreationWhileCommitPending) {
|
|
|
| // SetNeedsBeginMainFrame should begin the frame.
|
| scheduler_->SetNeedsBeginMainFrame();
|
| - client_->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
|
|