| Index: cc/scheduler/scheduler_unittest.cc
|
| diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
|
| index 256acd5bd8f6a211637b8d72b24e295485d0db86..7ab65aa657825832dfbf0d60a29a8bbd89a82fd4 100644
|
| --- a/cc/scheduler/scheduler_unittest.cc
|
| +++ b/cc/scheduler/scheduler_unittest.cc
|
| @@ -45,12 +45,31 @@ void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler,
|
|
|
| class FakeSchedulerClient : public SchedulerClient {
|
| public:
|
| + struct FakeBeginFrameSourceForFakeSchedulerClient
|
| + : public FakeBeginFrameSource {
|
| + FakeSchedulerClient* client_;
|
| +
|
| + explicit FakeBeginFrameSourceForFakeSchedulerClient(
|
| + FakeSchedulerClient* client)
|
| + : client_(client) {}
|
| +
|
| + virtual void SetNeedsBeginFrames(bool needs_begin_frames) OVERRIDE {
|
| + FakeBeginFrameSource::SetNeedsBeginFrames(needs_begin_frames);
|
| + if (needs_begin_frames) {
|
| + client_->actions_.push_back("SetNeedsBeginFrames(true)");
|
| + } else {
|
| + client_->actions_.push_back("SetNeedsBeginFrames(false)");
|
| + }
|
| + client_->states_.push_back(client_->scheduler_->AsValue());
|
| + }
|
| + };
|
| +
|
| FakeSchedulerClient()
|
| - : needs_begin_frame_(false),
|
| - automatic_swap_ack_(true),
|
| + : automatic_swap_ack_(true),
|
| swap_contains_incomplete_tile_(false),
|
| redraw_will_happen_if_update_visible_tiles_happens_(false),
|
| - now_src_(TestNowSource::Create()) {
|
| + now_src_(TestNowSource::Create()),
|
| + fake_frame_source_(this) {
|
| Reset();
|
| }
|
|
|
| @@ -65,6 +84,7 @@ class FakeSchedulerClient : public SchedulerClient {
|
|
|
| TestScheduler* CreateScheduler(const SchedulerSettings& settings) {
|
| scheduler_ = TestScheduler::Create(now_src_, this, settings, 0);
|
| + DCHECK(scheduler_);
|
| // Fail if we need to run 100 tasks in a row.
|
| task_runner().SetRunTaskLimit(100);
|
| return scheduler_.get();
|
| @@ -75,7 +95,7 @@ class FakeSchedulerClient : public SchedulerClient {
|
| void set_log_anticipated_draw_time_change(bool log) {
|
| log_anticipated_draw_time_change_ = log;
|
| }
|
| - bool needs_begin_frame() { return needs_begin_frame_; }
|
| + bool needs_begin_frames() { return fake_frame_source_.NeedsBeginFrames(); }
|
| int num_draws() const { return num_draws_; }
|
| int num_actions_() const { return static_cast<int>(actions_.size()); }
|
| const char* Action(int i) const { return actions_[i]; }
|
| @@ -84,13 +104,18 @@ class FakeSchedulerClient : public SchedulerClient {
|
| return posted_begin_impl_frame_deadline_;
|
| }
|
|
|
| - void AdvanceFrame() {
|
| - bool external_begin_frame =
|
| - scheduler_->settings().begin_frame_scheduling_enabled &&
|
| - scheduler_->settings().throttle_frame_production;
|
| + bool ExternalBeginFrame() {
|
| + return scheduler_->settings().begin_frame_scheduling_enabled &&
|
| + scheduler_->settings().throttle_frame_production;
|
| + }
|
| + virtual FakeBeginFrameSource* GetExternalBeginFrameSource() OVERRIDE {
|
| + return &fake_frame_source_;
|
| + }
|
|
|
| - if (external_begin_frame) {
|
| - scheduler_->BeginFrame(CreateBeginFrameArgsForTesting(now_src_));
|
| + void AdvanceFrame() {
|
| + if (ExternalBeginFrame()) {
|
| + fake_frame_source_.TestSendBeginFrame(
|
| + CreateBeginFrameArgsForTesting(now_src_));
|
| }
|
|
|
| EXPECT_TRUE(task_runner().RunTasksWhile(ImplFrameDeadlinePending(false)));
|
| @@ -128,11 +153,6 @@ class FakeSchedulerClient : public SchedulerClient {
|
| redraw_will_happen_if_update_visible_tiles_happens_ = redraw;
|
| }
|
| // SchedulerClient implementation.
|
| - virtual void SetNeedsBeginFrame(bool enable) OVERRIDE {
|
| - actions_.push_back("SetNeedsBeginFrame");
|
| - states_.push_back(scheduler_->AsValue());
|
| - needs_begin_frame_ = enable;
|
| - }
|
| virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE {
|
| actions_.push_back("WillBeginImplFrame");
|
| states_.push_back(scheduler_->AsValue());
|
| @@ -221,7 +241,6 @@ class FakeSchedulerClient : public SchedulerClient {
|
| return scheduler_->BeginImplFrameDeadlinePending() == state;
|
| }
|
|
|
| - bool needs_begin_frame_;
|
| bool draw_will_happen_;
|
| bool swap_will_happen_if_draw_happens_;
|
| bool automatic_swap_ack_;
|
| @@ -234,6 +253,7 @@ class FakeSchedulerClient : public SchedulerClient {
|
| std::vector<scoped_refptr<base::debug::ConvertableToTraceFormat> > states_;
|
| scoped_ptr<TestScheduler> scheduler_;
|
| scoped_refptr<TestNowSource> now_src_;
|
| + FakeBeginFrameSourceForFakeSchedulerClient fake_frame_source_;
|
| };
|
|
|
| void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler,
|
| @@ -294,29 +314,28 @@ TEST(SchedulerTest, RequestCommit) {
|
| // SetNeedsCommit should begin the frame on the next BeginImplFrame.
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
|
| client.Reset();
|
|
|
| client.AdvanceFrame();
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // If we don't swap on the deadline, we wait for the next BeginFrame.
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_NO_ACTION(client);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // NotifyReadyToCommit should trigger the commit.
|
| scheduler->NotifyBeginMainFrameStarted();
|
| scheduler->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame should prepare the draw.
|
| @@ -324,14 +343,14 @@ TEST(SchedulerTest, RequestCommit) {
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame deadline should draw.
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
|
| @@ -342,8 +361,7 @@ TEST(SchedulerTest, RequestCommit) {
|
| client.Reset();
|
|
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
|
| client.Reset();
|
| }
|
|
|
| @@ -361,7 +379,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
|
|
|
| // SetNeedsCommit should begin the frame.
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
|
|
|
| client.Reset();
|
| client.AdvanceFrame();
|
| @@ -369,7 +387,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
|
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // Now SetNeedsCommit again. Calling here means we need a second commit.
|
| @@ -390,7 +408,7 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
|
|
|
| // Because we just swapped, the Scheduler should also request the next
|
| // BeginImplFrame from the OutputSurface.
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
| // Since another commit is needed, the next BeginImplFrame should initiate
|
| // the second commit.
|
| @@ -411,14 +429,14 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // On the next BeginImplFrame, verify we go back to a quiescent state and
|
| // no longer request BeginImplFrames.
|
| client.AdvanceFrame();
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
| }
|
|
|
| @@ -459,20 +477,20 @@ TEST(SchedulerTest, RequestRedrawInsideDraw) {
|
|
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| EXPECT_EQ(0, client.num_draws());
|
|
|
| client.AdvanceFrame();
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(1, client.num_draws());
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| client.AdvanceFrame();
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(2, client.num_draws());
|
| EXPECT_FALSE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| // We stop requesting BeginImplFrames after a BeginImplFrame where we don't
|
| // swap.
|
| @@ -480,7 +498,7 @@ TEST(SchedulerTest, RequestRedrawInsideDraw) {
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(2, client.num_draws());
|
| EXPECT_FALSE(scheduler->RedrawPending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| }
|
|
|
| // Test that requesting redraw inside a failed draw doesn't lose the request.
|
| @@ -498,7 +516,7 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) {
|
|
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| EXPECT_EQ(0, client.num_draws());
|
|
|
| // Fail the draw.
|
| @@ -510,7 +528,7 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) {
|
| // request.
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| // Fail the draw again.
|
| client.AdvanceFrame();
|
| @@ -518,7 +536,7 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) {
|
| EXPECT_EQ(2, client.num_draws());
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| // Draw successfully.
|
| client.SetDrawWillHappen(true);
|
| @@ -527,7 +545,7 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) {
|
| EXPECT_EQ(3, client.num_draws());
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| EXPECT_FALSE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| }
|
|
|
| class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient {
|
| @@ -573,11 +591,11 @@ TEST(SchedulerTest, RequestCommitInsideDraw) {
|
| InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
|
| client.Reset();
|
|
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| EXPECT_EQ(0, client.num_draws());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| client.SetNeedsCommitOnNextDraw();
|
| client.AdvanceFrame();
|
| @@ -585,7 +603,7 @@ TEST(SchedulerTest, RequestCommitInsideDraw) {
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(1, client.num_draws());
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| scheduler->NotifyBeginMainFrameStarted();
|
| scheduler->NotifyReadyToCommit();
|
|
|
| @@ -595,7 +613,7 @@ TEST(SchedulerTest, RequestCommitInsideDraw) {
|
|
|
| EXPECT_FALSE(scheduler->RedrawPending());
|
| EXPECT_FALSE(scheduler->CommitPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| // We stop requesting BeginImplFrames after a BeginImplFrame where we don't
|
| // swap.
|
| @@ -604,7 +622,7 @@ TEST(SchedulerTest, RequestCommitInsideDraw) {
|
| EXPECT_EQ(2, client.num_draws());
|
| EXPECT_FALSE(scheduler->RedrawPending());
|
| EXPECT_FALSE(scheduler->CommitPending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| }
|
|
|
| // Tests that when a draw fails then the pending commit should not be dropped.
|
| @@ -622,7 +640,7 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) {
|
|
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| EXPECT_EQ(0, client.num_draws());
|
|
|
| // Fail the draw.
|
| @@ -634,7 +652,7 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) {
|
| // request.
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| // Fail the draw again.
|
| client.AdvanceFrame();
|
| @@ -643,7 +661,7 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) {
|
| EXPECT_EQ(2, client.num_draws());
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| // Draw successfully.
|
| client.SetDrawWillHappen(true);
|
| @@ -652,7 +670,7 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) {
|
| EXPECT_EQ(3, client.num_draws());
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| EXPECT_FALSE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| }
|
|
|
| TEST(SchedulerTest, NoSwapWhenDrawFails) {
|
| @@ -667,7 +685,7 @@ TEST(SchedulerTest, NoSwapWhenDrawFails) {
|
|
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| EXPECT_EQ(0, client.num_draws());
|
|
|
| // Draw successfully, this starts a new frame.
|
| @@ -678,7 +696,7 @@ TEST(SchedulerTest, NoSwapWhenDrawFails) {
|
|
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| // Fail to draw, this should not start a frame.
|
| client.SetDrawWillHappen(false);
|
| @@ -714,7 +732,7 @@ TEST(SchedulerTest, ManageTiles) {
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| EXPECT_TRUE(scheduler->ManageTilesPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| EXPECT_EQ(0, client.num_draws());
|
| EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles"));
|
| EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
|
| @@ -744,7 +762,7 @@ TEST(SchedulerTest, ManageTiles) {
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| EXPECT_FALSE(scheduler->ManageTilesPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| EXPECT_EQ(0, client.num_draws());
|
|
|
| // We have no immediate actions to perform, so the BeginImplFrame should post
|
| @@ -776,17 +794,16 @@ TEST(SchedulerTest, ManageTiles) {
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client.Reset();
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| EXPECT_EQ(0, client.num_draws());
|
|
|
| // Now trigger a ManageTiles outside of a draw. We will then need
|
| // a begin-frame for the ManageTiles, but we don't need a draw.
|
| client.Reset();
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| scheduler->SetNeedsManageTiles();
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| EXPECT_TRUE(scheduler->ManageTilesPending());
|
| EXPECT_FALSE(scheduler->RedrawPending());
|
|
|
| @@ -938,7 +955,7 @@ TEST(SchedulerTest, ShouldUpdateVisibleTiles) {
|
| // SetNeedsCommit should begin the frame.
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
|
|
|
| client.Reset();
|
| client.AdvanceFrame();
|
| @@ -981,8 +998,7 @@ TEST(SchedulerTest, ShouldUpdateVisibleTiles) {
|
| // No more UpdateVisibleTiles().
|
| client.Reset();
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
|
| }
|
|
|
| TEST(SchedulerTest, TriggerBeginFrameDeadlineEarly) {
|
| @@ -1123,7 +1139,7 @@ TEST(SchedulerTest, PollForCommitCompletion) {
|
|
|
| BeginFrameArgs frame_args = CreateBeginFrameArgsForTesting(client.now_src());
|
| frame_args.interval = base::TimeDelta::FromMilliseconds(1000);
|
| - scheduler->BeginFrame(frame_args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(frame_args);
|
|
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| @@ -1136,7 +1152,7 @@ TEST(SchedulerTest, PollForCommitCompletion) {
|
| // the NotifyReadyToCommit for now.
|
| EXPECT_FALSE(scheduler->CommitPending());
|
| scheduler->SetNeedsCommit();
|
| - scheduler->BeginFrame(frame_args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(frame_args);
|
| EXPECT_TRUE(scheduler->CommitPending());
|
|
|
| // Draw and swap the frame, but don't ack the swap to simulate the Browser
|
| @@ -1188,39 +1204,38 @@ TEST(SchedulerTest, BeginRetroFrame) {
|
| // SetNeedsCommit should begin the frame on the next BeginImplFrame.
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", 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(client.now_src());
|
| args.deadline += base::TimeDelta::FromHours(1);
|
| - scheduler->BeginFrame(args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(args);
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // Queue BeginFrames while we are still handling the previous BeginFrame.
|
| args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - scheduler->BeginFrame(args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(args);
|
| args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - scheduler->BeginFrame(args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(args);
|
|
|
| // If we don't swap on the deadline, we wait for the next BeginImplFrame.
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_NO_ACTION(client);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // NotifyReadyToCommit should trigger the commit.
|
| scheduler->NotifyBeginMainFrameStarted();
|
| scheduler->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame should prepare the draw.
|
| @@ -1228,14 +1243,14 @@ TEST(SchedulerTest, BeginRetroFrame) {
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame deadline should draw.
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
|
| @@ -1246,8 +1261,7 @@ TEST(SchedulerTest, BeginRetroFrame) {
|
| client.Reset();
|
|
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
|
| client.Reset();
|
| }
|
|
|
| @@ -1267,25 +1281,24 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) {
|
| // SetNeedsCommit should begin the frame on the next BeginImplFrame.
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", 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(client.now_src());
|
| args.deadline += base::TimeDelta::FromHours(1);
|
| - scheduler->BeginFrame(args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(args);
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // Queue BeginFrame while we are still handling the previous BeginFrame.
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - scheduler->BeginFrame(args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(args);
|
| EXPECT_NO_ACTION(client);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client.Reset();
|
| @@ -1294,7 +1307,7 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) {
|
| scheduler->NotifyBeginMainFrameStarted();
|
| scheduler->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // Swapping will put us into a swap throttled state.
|
| @@ -1302,7 +1315,7 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) {
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // While swap throttled, BeginRetroFrames should trigger BeginImplFrames
|
| @@ -1311,22 +1324,22 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) {
|
| client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 1);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // Queue BeginFrame while we are still handling the previous BeginFrame.
|
| args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - scheduler->BeginFrame(args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(args);
|
| EXPECT_NO_ACTION(client);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // Take us out of a swap throttled state.
|
| scheduler->DidSwapBuffersComplete();
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame deadline should draw.
|
| @@ -1338,7 +1351,7 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) {
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
| client.Reset();
|
| }
|
|
|
| @@ -1359,7 +1372,7 @@ void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled,
|
| // without calling SetNeedsBeginFrame.
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| EXPECT_NO_ACTION(client);
|
| client.Reset();
|
|
|
| @@ -1369,21 +1382,21 @@ void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled,
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // If we don't swap on the deadline, we wait for the next BeginFrame.
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_NO_ACTION(client);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // NotifyReadyToCommit should trigger the commit.
|
| scheduler->NotifyBeginMainFrameStarted();
|
| scheduler->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame should prepare the draw.
|
| @@ -1391,14 +1404,14 @@ void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled,
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame deadline should draw.
|
| client.task_runner().RunTasksWhile(client.ImplFrameDeadlinePending(true));
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 1);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
|
| @@ -1412,7 +1425,7 @@ void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled,
|
| // when the BeginFrame is no longer needed.
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_NO_ACTION(client);
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
| }
|
|
|
| @@ -1457,7 +1470,7 @@ void BeginFramesNotFromClient_SwapThrottled(bool begin_frame_scheduling_enabled,
|
| // SetNeedsCommit should begin the frame on the next BeginImplFrame.
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| EXPECT_NO_ACTION(client);
|
| client.Reset();
|
|
|
| @@ -1466,14 +1479,14 @@ void BeginFramesNotFromClient_SwapThrottled(bool begin_frame_scheduling_enabled,
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // NotifyReadyToCommit should trigger the pending commit and draw.
|
| scheduler->NotifyBeginMainFrameStarted();
|
| scheduler->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // Swapping will put us into a swap throttled state.
|
| @@ -1481,7 +1494,7 @@ void BeginFramesNotFromClient_SwapThrottled(bool begin_frame_scheduling_enabled,
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // While swap throttled, BeginFrames should trigger BeginImplFrames,
|
| @@ -1490,14 +1503,14 @@ void BeginFramesNotFromClient_SwapThrottled(bool begin_frame_scheduling_enabled,
|
| client.task_runner().RunPendingTasks(); // Run posted BeginFrame.
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 1);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // Take us out of a swap throttled state.
|
| scheduler->DidSwapBuffersComplete();
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame deadline should draw.
|
| @@ -1506,7 +1519,7 @@ void BeginFramesNotFromClient_SwapThrottled(bool begin_frame_scheduling_enabled,
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 2);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
| client.Reset();
|
| }
|
|
|
| @@ -1562,7 +1575,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) {
|
| // SetNeedsCommit should begin the frame.
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
|
|
|
| client.Reset();
|
| client.AdvanceFrame();
|
| @@ -1573,7 +1586,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) {
|
| client.Reset();
|
| scheduler->DidLoseOutputSurface();
|
| // Do nothing when impl frame is in deadine pending state.
|
| - EXPECT_NO_ACTION(client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
|
|
|
| client.Reset();
|
| scheduler->NotifyBeginMainFrameStarted();
|
| @@ -1601,7 +1614,7 @@ void DidLoseOutputSurfaceAfterBeginFrameStartedWithHighLatency(
|
| // SetNeedsCommit should begin the frame.
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
|
|
|
| client.Reset();
|
| client.AdvanceFrame();
|
| @@ -1612,7 +1625,7 @@ void DidLoseOutputSurfaceAfterBeginFrameStartedWithHighLatency(
|
| client.Reset();
|
| scheduler->DidLoseOutputSurface();
|
| // Do nothing when impl frame is in deadine pending state.
|
| - EXPECT_NO_ACTION(client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
|
|
|
| client.Reset();
|
| // Run posted deadline.
|
| @@ -1668,7 +1681,7 @@ void DidLoseOutputSurfaceAfterReadyToCommit(bool impl_side_painting) {
|
| // SetNeedsCommit should begin the frame.
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
|
|
|
| client.Reset();
|
| client.AdvanceFrame();
|
| @@ -1685,10 +1698,10 @@ void DidLoseOutputSurfaceAfterReadyToCommit(bool impl_side_painting) {
|
| scheduler->DidLoseOutputSurface();
|
| if (impl_side_painting) {
|
| // Sync tree should be forced to activate.
|
| - EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client);
|
| + EXPECT_ACTION("SetNeedsBeginFrames(false)", client, 0, 2);
|
| + EXPECT_ACTION("ScheduledActionActivateSyncTree", client, 1, 2);
|
| } else {
|
| - // Do nothing when impl frame is in deadine pending state.
|
| - EXPECT_NO_ACTION(client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
|
| }
|
|
|
| client.Reset();
|
| @@ -1716,8 +1729,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsManageTiles) {
|
| client.Reset();
|
| scheduler->SetNeedsManageTiles();
|
| scheduler->SetNeedsRedraw();
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", client);
|
|
|
| client.Reset();
|
| client.AdvanceFrame();
|
| @@ -1727,7 +1739,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsManageTiles) {
|
|
|
| client.Reset();
|
| scheduler->DidLoseOutputSurface();
|
| - EXPECT_NO_ACTION(client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
|
|
|
| client.Reset();
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| @@ -1747,45 +1759,44 @@ TEST(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) {
|
| // SetNeedsCommit should begin the frame on the next BeginImplFrame.
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", 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(client.now_src());
|
| args.deadline += base::TimeDelta::FromHours(1);
|
| - scheduler->BeginFrame(args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(args);
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| // Queue BeginFrames while we are still handling the previous BeginFrame.
|
| args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - scheduler->BeginFrame(args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(args);
|
| args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - scheduler->BeginFrame(args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(args);
|
|
|
| // If we don't swap on the deadline, we wait for the next BeginImplFrame.
|
| client.Reset();
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_NO_ACTION(client);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| // NotifyReadyToCommit should trigger the commit.
|
| client.Reset();
|
| scheduler->NotifyBeginMainFrameStarted();
|
| scheduler->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| client.Reset();
|
| EXPECT_FALSE(scheduler->IsBeginRetroFrameArgsEmpty());
|
| scheduler->DidLoseOutputSurface();
|
| - EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_ACTION("SetNeedsBeginFrames(false)", client, 0, 2);
|
| + EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client, 1, 2);
|
| EXPECT_TRUE(scheduler->IsBeginRetroFrameArgsEmpty());
|
|
|
| // Posted BeginRetroFrame is aborted.
|
| @@ -1806,39 +1817,38 @@ TEST(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
|
| // SetNeedsCommit should begin the frame on the next BeginImplFrame.
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(true)", 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(client.now_src());
|
| args.deadline += base::TimeDelta::FromHours(1);
|
| - scheduler->BeginFrame(args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(args);
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| // Queue BeginFrames while we are still handling the previous BeginFrame.
|
| args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - scheduler->BeginFrame(args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(args);
|
| args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - scheduler->BeginFrame(args);
|
| + client.GetExternalBeginFrameSource()->TestSendBeginFrame(args);
|
|
|
| // If we don't swap on the deadline, we wait for the next BeginImplFrame.
|
| client.Reset();
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_NO_ACTION(client);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| // NotifyReadyToCommit should trigger the commit.
|
| client.Reset();
|
| scheduler->NotifyBeginMainFrameStarted();
|
| scheduler->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| // BeginImplFrame should prepare the draw.
|
| client.Reset();
|
| @@ -1846,12 +1856,12 @@ TEST(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.needs_begin_frames());
|
|
|
| client.Reset();
|
| EXPECT_FALSE(scheduler->IsBeginRetroFrameArgsEmpty());
|
| scheduler->DidLoseOutputSurface();
|
| - EXPECT_NO_ACTION(client);
|
| + EXPECT_SINGLE_ACTION("SetNeedsBeginFrames(false)", client);
|
| EXPECT_TRUE(scheduler->IsBeginRetroFrameArgsEmpty());
|
|
|
| // BeginImplFrame deadline should abort drawing.
|
| @@ -1859,7 +1869,7 @@ TEST(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.needs_begin_frames());
|
|
|
| // No more BeginRetroFrame because BeginRetroFrame queue is cleared.
|
| client.Reset();
|
| @@ -1880,33 +1890,33 @@ TEST(SchedulerTest,
|
|
|
| // SetNeedsCommit should begin the frame on the next BeginImplFrame.
|
| client.Reset();
|
| - EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive());
|
| + EXPECT_FALSE(scheduler->frame_source().NeedsBeginFrames());
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_TRUE(scheduler->IsSyntheticBeginFrameSourceActive());
|
| + EXPECT_TRUE(scheduler->frame_source().NeedsBeginFrames());
|
|
|
| client.Reset();
|
| client.task_runner().RunPendingTasks(); // Run posted Tick.
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(scheduler->IsSyntheticBeginFrameSourceActive());
|
| + EXPECT_TRUE(scheduler->frame_source().NeedsBeginFrames());
|
|
|
| // NotifyReadyToCommit should trigger the commit.
|
| client.Reset();
|
| scheduler->NotifyBeginMainFrameStarted();
|
| scheduler->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
|
| - EXPECT_TRUE(scheduler->IsSyntheticBeginFrameSourceActive());
|
| + EXPECT_TRUE(scheduler->frame_source().NeedsBeginFrames());
|
|
|
| client.Reset();
|
| scheduler->DidLoseOutputSurface();
|
| - EXPECT_EQ(0, client.num_actions_());
|
| - EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive());
|
| + EXPECT_NO_ACTION(client);
|
| + EXPECT_FALSE(scheduler->frame_source().NeedsBeginFrames());
|
|
|
| client.Reset();
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_SINGLE_ACTION("ScheduledActionBeginOutputSurfaceCreation", client);
|
| - EXPECT_FALSE(scheduler->IsSyntheticBeginFrameSourceActive());
|
| + EXPECT_FALSE(scheduler->frame_source().NeedsBeginFrames());
|
| }
|
|
|
| } // namespace
|
|
|