| Index: cc/scheduler/scheduler_unittest.cc
|
| diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
|
| index 071fa58a066aea14ff4c3158d3ab47dac747b187..bbf1065d2850e872ee672c41090fb4d34b9a7602 100644
|
| --- a/cc/scheduler/scheduler_unittest.cc
|
| +++ b/cc/scheduler/scheduler_unittest.cc
|
| @@ -19,12 +19,13 @@
|
|
|
| #define EXPECT_ACTION(action, client, action_index, expected_num_actions) \
|
| EXPECT_EQ(expected_num_actions, client.num_actions_()); \
|
| - ASSERT_LT(action_index, client.num_actions_()); \
|
| + ASSERT_LT(action_index, client.num_actions_()) << scheduler; \
|
| do { \
|
| EXPECT_STREQ(action, client.Action(action_index)); \
|
| for (int i = expected_num_actions; i < client.num_actions_(); ++i) \
|
| - ADD_FAILURE() << "Unexpected action: " << client.Action(i) << \
|
| - " with state:\n" << client.StateForAction(action_index); \
|
| + ADD_FAILURE() << "Unexpected action: " << client.Action(i) \
|
| + << " with state:\n" \
|
| + << client.StateForAction(action_index); \
|
| } while (false)
|
|
|
| #define EXPECT_SINGLE_ACTION(action, client) \
|
| @@ -35,12 +36,28 @@ namespace {
|
|
|
| class FakeSchedulerClient;
|
|
|
| -void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler,
|
| - FakeSchedulerClient* client);
|
| +class FakeBeginFrameSource : public BaseBeginFrameSource {
|
| + public:
|
| + FakeSchedulerClient* fake_client_;
|
| +
|
| + explicit FakeBeginFrameSource(FakeSchedulerClient* fake_client)
|
| + : BaseBeginFrameSource(0), fake_client_(fake_client) {}
|
| +
|
| + virtual void OnGenerateChange(bool generate_frames) OVERRIDE;
|
| +
|
| + virtual inline std::string TypeString() const OVERRIDE {
|
| + return "FakeBeginFrameSource";
|
| + }
|
| +
|
| + void TestBeginFrame(BeginFrameArgs args) { frame_sink_->BeginFrame(args); }
|
| +};
|
|
|
| class FakeSchedulerClient : public SchedulerClient {
|
| public:
|
| - FakeSchedulerClient() : needs_begin_frame_(false), automatic_swap_ack_(true) {
|
| + FakeSchedulerClient()
|
| + : generate_frames_(false),
|
| + automatic_swap_ack_(true),
|
| + frame_source_(this) {
|
| Reset();
|
| }
|
|
|
| @@ -55,7 +72,13 @@ class FakeSchedulerClient : public SchedulerClient {
|
|
|
| Scheduler* CreateScheduler(const SchedulerSettings& settings) {
|
| task_runner_ = new base::TestSimpleTaskRunner;
|
| - scheduler_ = Scheduler::Create(this, settings, 0, task_runner_);
|
| +
|
| + scheduler_ =
|
| + Scheduler::Create(this,
|
| + settings,
|
| + 0,
|
| + static_cast<BeginFrameSource*>(&frame_source_),
|
| + task_runner_);
|
| return scheduler_.get();
|
| }
|
|
|
| @@ -64,7 +87,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 generate_frames() { return generate_frames_; }
|
| 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]; }
|
| @@ -97,11 +120,6 @@ class FakeSchedulerClient : public SchedulerClient {
|
| }
|
|
|
| // SchedulerClient implementation.
|
| - virtual void SetNeedsBeginFrame(bool enable) OVERRIDE {
|
| - actions_.push_back("SetNeedsBeginFrame");
|
| - states_.push_back(scheduler_->AsValue().release());
|
| - needs_begin_frame_ = enable;
|
| - }
|
| virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE {
|
| actions_.push_back("WillBeginImplFrame");
|
| states_.push_back(scheduler_->AsValue().release());
|
| @@ -170,8 +188,10 @@ class FakeSchedulerClient : public SchedulerClient {
|
|
|
| virtual void DidBeginImplFrameDeadline() OVERRIDE {}
|
|
|
| + FakeBeginFrameSource& frame_source() { return frame_source_; }
|
| +
|
| protected:
|
| - bool needs_begin_frame_;
|
| + bool generate_frames_;
|
| bool draw_will_happen_;
|
| bool swap_will_happen_if_draw_happens_;
|
| bool automatic_swap_ack_;
|
| @@ -182,8 +202,18 @@ class FakeSchedulerClient : public SchedulerClient {
|
| ScopedVector<base::Value> states_;
|
| scoped_ptr<Scheduler> scheduler_;
|
| scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
|
| +
|
| + friend class FakeBeginFrameSource;
|
| + FakeBeginFrameSource frame_source_;
|
| };
|
|
|
| +void FakeBeginFrameSource::OnGenerateChange(bool generate_frames) {
|
| + fake_client_->actions_.push_back("SetGenerateFrames");
|
| + fake_client_->states_.push_back(
|
| + fake_client_->scheduler_->AsValue().release());
|
| + fake_client_->generate_frames_ = generate_frames;
|
| +}
|
| +
|
| void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler,
|
| FakeSchedulerClient* client) {
|
| bool client_initiates_begin_frame =
|
| @@ -196,7 +226,7 @@ void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler,
|
| scheduler->NotifyReadyToCommit();
|
| // Go through the motions to draw the commit.
|
| if (client_initiates_begin_frame)
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client->frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| else
|
| client->task_runner().RunPendingTasks(); // Run posted BeginFrame.
|
|
|
| @@ -205,13 +235,17 @@ void InitializeOutputSurfaceAndFirstCommit(Scheduler* scheduler,
|
| client->task_runner().RunPendingTasks();
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
|
|
| + // EXPECT_TRUE(client->generate_frames());
|
| +
|
| // We need another BeginImplFrame so Scheduler calls
|
| - // SetNeedsBeginFrame(false).
|
| + // SetGenerateFrames(false).
|
| if (client_initiates_begin_frame)
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client->frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| else
|
| client->task_runner().RunPendingTasks(); // Run posted BeginFrame.
|
|
|
| + // EXPECT_FALSE(client->generate_frames());
|
| +
|
| // Run the posted deadline task.
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client->task_runner().RunPendingTasks();
|
| @@ -246,56 +280,56 @@ 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_TRUE(client.generate_frames());
|
| + EXPECT_SINGLE_ACTION("SetGenerateFrames", client);
|
| client.Reset();
|
|
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| 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.generate_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_EQ(0, client.num_actions_());
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_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.generate_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame should prepare the draw.
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| 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.generate_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.generate_frames());
|
| client.Reset();
|
|
|
| - // The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
|
| + // The following BeginImplFrame deadline should SetGenerateFrames(false)
|
| // to avoid excessive toggles.
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
|
| 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("SetGenerateFrames", client);
|
| + EXPECT_FALSE(client.generate_frames());
|
| client.Reset();
|
| }
|
|
|
| @@ -313,15 +347,15 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
|
|
|
| // SetNeedsCommit should begin the frame.
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_SINGLE_ACTION("SetNeedsBeginFrame", client);
|
| + EXPECT_SINGLE_ACTION("SetGenerateFrames", client);
|
|
|
| client.Reset();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| 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.generate_frames());
|
| client.Reset();
|
|
|
| // Now SetNeedsCommit again. Calling here means we need a second commit.
|
| @@ -342,11 +376,11 @@ 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.generate_frames());
|
| client.Reset();
|
| // Since another commit is needed, the next BeginImplFrame should initiate
|
| // the second commit.
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| @@ -363,14 +397,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.generate_frames());
|
| client.Reset();
|
|
|
| // On the next BeginImplFrame, verify we go back to a quiescent state and
|
| // no longer request BeginImplFrames.
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.generate_frames());
|
| client.Reset();
|
| }
|
|
|
| @@ -411,28 +445,28 @@ TEST(SchedulerTest, RequestRedrawInsideDraw) {
|
|
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
| EXPECT_EQ(0, client.num_draws());
|
|
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| 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.generate_frames());
|
|
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| 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.generate_frames());
|
|
|
| // We stop requesting BeginImplFrames after a BeginImplFrame where we don't
|
| // swap.
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| 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.generate_frames());
|
| }
|
|
|
| // Test that requesting redraw inside a failed draw doesn't lose the request.
|
| @@ -450,11 +484,11 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) {
|
|
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
| EXPECT_EQ(0, client.num_draws());
|
|
|
| // Fail the draw.
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(1, client.num_draws());
|
|
|
| @@ -462,24 +496,24 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) {
|
| // request.
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
|
|
| // Fail the draw again.
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(2, client.num_draws());
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
|
|
| // Draw successfully.
|
| client.SetDrawWillHappen(true);
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(3, client.num_draws());
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| EXPECT_FALSE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
| }
|
|
|
| class SchedulerClientThatSetNeedsCommitInsideDraw : public FakeSchedulerClient {
|
| @@ -525,38 +559,38 @@ TEST(SchedulerTest, RequestCommitInsideDraw) {
|
| InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
|
| client.Reset();
|
|
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.generate_frames());
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| EXPECT_EQ(0, client.num_draws());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
|
|
| client.SetNeedsCommitOnNextDraw();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| client.SetNeedsCommitOnNextDraw();
|
| 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.generate_frames());
|
| scheduler->NotifyBeginMainFrameStarted();
|
| scheduler->NotifyReadyToCommit();
|
|
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(2, client.num_draws());
|
|
|
| EXPECT_FALSE(scheduler->RedrawPending());
|
| EXPECT_FALSE(scheduler->CommitPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
|
|
| // We stop requesting BeginImplFrames after a BeginImplFrame where we don't
|
| // swap.
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(2, client.num_draws());
|
| EXPECT_FALSE(scheduler->RedrawPending());
|
| EXPECT_FALSE(scheduler->CommitPending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.generate_frames());
|
| }
|
|
|
| // Tests that when a draw fails then the pending commit should not be dropped.
|
| @@ -574,11 +608,11 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) {
|
|
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
| EXPECT_EQ(0, client.num_draws());
|
|
|
| // Fail the draw.
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(1, client.num_draws());
|
|
|
| @@ -586,25 +620,25 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) {
|
| // request.
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
|
|
| // Fail the draw again.
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
|
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(2, client.num_draws());
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
|
|
| // Draw successfully.
|
| client.SetDrawWillHappen(true);
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(3, client.num_draws());
|
| EXPECT_TRUE(scheduler->CommitPending());
|
| EXPECT_FALSE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
| }
|
|
|
| TEST(SchedulerTest, NoSwapWhenDrawFails) {
|
| @@ -619,23 +653,23 @@ TEST(SchedulerTest, NoSwapWhenDrawFails) {
|
|
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
| EXPECT_EQ(0, client.num_draws());
|
|
|
| // Draw successfully, this starts a new frame.
|
| client.SetNeedsCommitOnNextDraw();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(1, client.num_draws());
|
|
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
|
|
| // Fail to draw, this should not start a frame.
|
| client.SetDrawWillHappen(false);
|
| client.SetNeedsCommitOnNextDraw();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(2, client.num_draws());
|
| }
|
| @@ -666,7 +700,7 @@ TEST(SchedulerTest, ManageTiles) {
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| EXPECT_TRUE(scheduler->ManageTilesPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
| EXPECT_EQ(0, client.num_draws());
|
| EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles"));
|
| EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
|
| @@ -674,7 +708,7 @@ TEST(SchedulerTest, ManageTiles) {
|
| // We have no immediate actions to perform, so the BeginImplFrame should post
|
| // the deadline task.
|
| client.Reset();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| @@ -696,13 +730,13 @@ TEST(SchedulerTest, ManageTiles) {
|
| scheduler->SetNeedsRedraw();
|
| EXPECT_TRUE(scheduler->RedrawPending());
|
| EXPECT_FALSE(scheduler->ManageTilesPending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
| EXPECT_EQ(0, client.num_draws());
|
|
|
| // We have no immediate actions to perform, so the BeginImplFrame should post
|
| // the deadline task.
|
| client.Reset();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| @@ -723,28 +757,28 @@ TEST(SchedulerTest, ManageTiles) {
|
|
|
| // We need a BeginImplFrame where we don't swap to go idle.
|
| client.Reset();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
|
| 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("SetGenerateFrames", client);
|
| + EXPECT_FALSE(client.generate_frames());
|
| 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.generate_frames());
|
| scheduler->SetNeedsManageTiles();
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
| EXPECT_TRUE(scheduler->ManageTilesPending());
|
| EXPECT_FALSE(scheduler->RedrawPending());
|
|
|
| // BeginImplFrame. There will be no draw, only ManageTiles.
|
| client.Reset();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client.Reset();
|
| @@ -770,7 +804,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) {
|
| scheduler->SetNeedsManageTiles();
|
| scheduler->SetNeedsRedraw();
|
| client.Reset();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| @@ -792,7 +826,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) {
|
| scheduler->SetNeedsManageTiles();
|
| scheduler->SetNeedsRedraw();
|
| client.Reset();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| @@ -815,7 +849,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) {
|
| scheduler->SetNeedsManageTiles();
|
| scheduler->SetNeedsRedraw();
|
| client.Reset();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| @@ -838,7 +872,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) {
|
| scheduler->SetNeedsManageTiles();
|
| scheduler->SetNeedsRedraw();
|
| client.Reset();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| @@ -857,7 +891,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) {
|
| scheduler->SetNeedsManageTiles();
|
| scheduler->SetNeedsRedraw();
|
| client.Reset();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 2);
|
| EXPECT_ACTION("ScheduledActionAnimate", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| @@ -886,7 +920,7 @@ TEST(SchedulerTest, TriggerBeginFrameDeadlineEarly) {
|
|
|
| client.Reset();
|
| scheduler->SetNeedsRedraw();
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
|
|
| // The deadline should be zero since there is no work other than drawing
|
| // pending.
|
| @@ -942,7 +976,7 @@ void MainFrameInHighLatencyMode(int64 begin_main_frame_to_commit_estimate_in_ms,
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode());
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_FALSE(scheduler->MainThreadIsInHighLatencyMode());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode());
|
| @@ -954,7 +988,7 @@ void MainFrameInHighLatencyMode(int64 begin_main_frame_to_commit_estimate_in_ms,
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode());
|
| - scheduler->BeginFrame(CreateBeginFrameArgsForTesting());
|
| + client.frame_source().TestBeginFrame(CreateBeginFrameArgsForTesting());
|
| EXPECT_TRUE(scheduler->MainThreadIsInHighLatencyMode());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(scheduler->MainThreadIsInHighLatencyMode(),
|
| @@ -1013,7 +1047,7 @@ TEST(SchedulerTest, PollForCommitCompletion) {
|
|
|
| BeginFrameArgs frame_args = CreateBeginFrameArgsForTesting();
|
| frame_args.interval = base::TimeDelta::FromMilliseconds(1000);
|
| - scheduler->BeginFrame(frame_args);
|
| + client.frame_source().TestBeginFrame(frame_args);
|
|
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| @@ -1026,7 +1060,7 @@ TEST(SchedulerTest, PollForCommitCompletion) {
|
| // the NotifyReadyToCommit for now.
|
| EXPECT_FALSE(scheduler->CommitPending());
|
| scheduler->SetNeedsCommit();
|
| - scheduler->BeginFrame(frame_args);
|
| + client.frame_source().TestBeginFrame(frame_args);
|
| EXPECT_TRUE(scheduler->CommitPending());
|
|
|
| // Draw and swap the frame, but don't ack the swap to simulate the Browser
|
| @@ -1078,39 +1112,39 @@ 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_TRUE(client.generate_frames());
|
| + EXPECT_SINGLE_ACTION("SetGenerateFrames", 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();
|
| args.deadline += base::TimeDelta::FromHours(1);
|
| - scheduler->BeginFrame(args);
|
| + client.frame_source().TestBeginFrame(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.generate_frames());
|
| client.Reset();
|
|
|
| // Queue BeginFrames while we are still handling the previous BeginFrame.
|
| args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - scheduler->BeginFrame(args);
|
| + client.frame_source().TestBeginFrame(args);
|
| args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - scheduler->BeginFrame(args);
|
| + client.frame_source().TestBeginFrame(args);
|
|
|
| // If we don't swap on the deadline, we wait for the next BeginImplFrame.
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(0, client.num_actions_());
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_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.generate_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame should prepare the draw.
|
| @@ -1118,17 +1152,17 @@ 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.generate_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.generate_frames());
|
| client.Reset();
|
|
|
| - // The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
|
| + // The following BeginImplFrame deadline should SetGenerateFrames(false)
|
| // to avoid excessive toggles.
|
| client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
|
| @@ -1136,8 +1170,8 @@ 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("SetGenerateFrames", client);
|
| + EXPECT_FALSE(client.generate_frames());
|
| client.Reset();
|
| }
|
|
|
| @@ -1157,25 +1191,25 @@ 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_TRUE(client.generate_frames());
|
| + EXPECT_SINGLE_ACTION("SetGenerateFrames", 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();
|
| args.deadline += base::TimeDelta::FromHours(1);
|
| - scheduler->BeginFrame(args);
|
| + client.frame_source().TestBeginFrame(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.generate_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.frame_source().TestBeginFrame(args);
|
| EXPECT_EQ(0, client.num_actions_());
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client.Reset();
|
| @@ -1184,7 +1218,7 @@ TEST(SchedulerTest, BeginRetroFrame_SwapThrottled) {
|
| scheduler->NotifyBeginMainFrameStarted();
|
| scheduler->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client);
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_frames());
|
| client.Reset();
|
|
|
| // Swapping will put us into a swap throttled state.
|
| @@ -1192,7 +1226,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.generate_frames());
|
| client.Reset();
|
|
|
| // While swap throttled, BeginRetroFrames should trigger BeginImplFrames
|
| @@ -1201,22 +1235,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.generate_frames());
|
| client.Reset();
|
|
|
| // Queue BeginFrame while we are still handling the previous BeginFrame.
|
| args.frame_time += base::TimeDelta::FromSeconds(1);
|
| - scheduler->BeginFrame(args);
|
| + client.frame_source().TestBeginFrame(args);
|
| EXPECT_EQ(0, client.num_actions_());
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_TRUE(client.needs_begin_frame());
|
| + EXPECT_TRUE(client.generate_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.generate_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame deadline should draw.
|
| @@ -1225,7 +1259,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.generate_frames());
|
| client.Reset();
|
| }
|
|
|
| @@ -1243,10 +1277,10 @@ void BeginFramesNotFromClient(bool begin_frame_scheduling_enabled,
|
| InitializeOutputSurfaceAndFirstCommit(scheduler, &client);
|
|
|
| // SetNeedsCommit should begin the frame on the next BeginImplFrame
|
| - // without calling SetNeedsBeginFrame.
|
| + // without calling SetGenerateFrames.
|
| client.Reset();
|
| scheduler->SetNeedsCommit();
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.generate_frames());
|
| EXPECT_EQ(0, client.num_actions_());
|
| client.Reset();
|
|
|
| @@ -1256,21 +1290,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.generate_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_EQ(0, client.num_actions_());
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.generate_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.generate_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame should prepare the draw.
|
| @@ -1278,28 +1312,28 @@ 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.generate_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_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.generate_frames());
|
| client.Reset();
|
|
|
| - // The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
|
| + // The following BeginImplFrame deadline should SetGenerateFrames(false)
|
| // to avoid excessive toggles.
|
| client.task_runner().RunPendingTasks(); // Run posted BeginFrame.
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client.Reset();
|
|
|
| - // Make sure SetNeedsBeginFrame isn't called on the client
|
| + // Make sure SetGenerateFrames isn't called on the client
|
| // when the BeginFrame is no longer needed.
|
| client.task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(0, client.num_actions_());
|
| - EXPECT_FALSE(client.needs_begin_frame());
|
| + EXPECT_FALSE(client.generate_frames());
|
| client.Reset();
|
| }
|
|
|
| @@ -1344,7 +1378,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.generate_frames());
|
| EXPECT_EQ(0, client.num_actions_());
|
| client.Reset();
|
|
|
| @@ -1353,14 +1387,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.generate_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.generate_frames());
|
| client.Reset();
|
|
|
| // Swapping will put us into a swap throttled state.
|
| @@ -1368,7 +1402,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.generate_frames());
|
| client.Reset();
|
|
|
| // While swap throttled, BeginFrames should trigger BeginImplFrames,
|
| @@ -1377,14 +1411,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.generate_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.generate_frames());
|
| client.Reset();
|
|
|
| // BeginImplFrame deadline should draw.
|
| @@ -1393,7 +1427,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.generate_frames());
|
| client.Reset();
|
| }
|
|
|
|
|