| Index: cc/scheduler/scheduler_unittest.cc
|
| diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
|
| index bf3b3f9a5e411d3b77fa941d9b500d8d468e7110..c16eb978eaffc19d156f94b8522662f902b60187 100644
|
| --- a/cc/scheduler/scheduler_unittest.cc
|
| +++ b/cc/scheduler/scheduler_unittest.cc
|
| @@ -32,13 +32,13 @@
|
| } \
|
| for (int i = expected_num_actions; i < client->num_actions_(); ++i) \
|
| ADD_FAILURE() << "Unexpected action: " << client->Action(i) \
|
| - << " with state:\n" << client->StateForAction(i); \
|
| + << " with state:\n" \
|
| + << client->StateForAction(i); \
|
| } while (false)
|
|
|
| #define EXPECT_NO_ACTION(client) EXPECT_ACTION("", client, -1, 0)
|
|
|
| -#define EXPECT_SINGLE_ACTION(action, client) \
|
| - EXPECT_ACTION(action, client, 0, 1)
|
| +#define EXPECT_SINGLE_ACTION(action, client) EXPECT_ACTION(action, client, 0, 1)
|
|
|
| #define EXPECT_SCOPED(statements) \
|
| { \
|
| @@ -56,7 +56,8 @@ class FakeSchedulerClient : public SchedulerClient,
|
| public FakeExternalBeginFrameSource::Client {
|
| public:
|
| FakeSchedulerClient()
|
| - : automatic_swap_ack_(true),
|
| + : inside_begin_impl_frame_(false),
|
| + automatic_swap_ack_(true),
|
| scheduler_(nullptr) {
|
| Reset();
|
| }
|
| @@ -90,9 +91,7 @@ class FakeSchedulerClient : public SchedulerClient,
|
| return -1;
|
| }
|
|
|
| - bool HasAction(const char* action) const {
|
| - return ActionIndex(action) >= 0;
|
| - }
|
| + bool HasAction(const char* action) const { return ActionIndex(action) >= 0; }
|
|
|
| void SetWillBeginImplFrameRequestsOneBeginImplFrame(bool request) {
|
| will_begin_impl_frame_requests_one_begin_impl_frame_ = request;
|
| @@ -111,13 +110,18 @@ class FakeSchedulerClient : public SchedulerClient,
|
| }
|
| // SchedulerClient implementation.
|
| void WillBeginImplFrame(const BeginFrameArgs& args) override {
|
| + EXPECT_FALSE(inside_begin_impl_frame_);
|
| + inside_begin_impl_frame_ = true;
|
| PushAction("WillBeginImplFrame");
|
| if (will_begin_impl_frame_requests_one_begin_impl_frame_)
|
| scheduler_->SetNeedsOneBeginImplFrame();
|
| if (will_begin_impl_frame_causes_redraw_)
|
| scheduler_->SetNeedsRedraw();
|
| }
|
| - void DidFinishImplFrame() override {}
|
| + void DidFinishImplFrame() override {
|
| + EXPECT_TRUE(inside_begin_impl_frame_);
|
| + inside_begin_impl_frame_ = false;
|
| + }
|
|
|
| void ScheduledActionSendBeginMainFrame(const BeginFrameArgs& args) override {
|
| PushAction("ScheduledActionSendBeginMainFrame");
|
| @@ -171,10 +175,11 @@ class FakeSchedulerClient : public SchedulerClient,
|
| PushAction("SendBeginMainFrameNotExpectedSoon");
|
| }
|
|
|
| - base::Callback<bool(void)> ImplFrameDeadlinePending(bool state) {
|
| - return base::Bind(&FakeSchedulerClient::ImplFrameDeadlinePendingCallback,
|
| - base::Unretained(this),
|
| - state);
|
| + bool IsInsideBeginImplFrame() const { return inside_begin_impl_frame_; }
|
| +
|
| + base::Callback<bool(void)> InsideBeginImplFrame(bool state) {
|
| + return base::Bind(&FakeSchedulerClient::InsideBeginImplFrameCallback,
|
| + base::Unretained(this), state);
|
| }
|
|
|
| void PushAction(const char* description) {
|
| @@ -191,10 +196,11 @@ class FakeSchedulerClient : public SchedulerClient,
|
| }
|
|
|
| protected:
|
| - bool ImplFrameDeadlinePendingCallback(bool state) {
|
| - return scheduler_->BeginImplFrameDeadlinePending() == state;
|
| + bool InsideBeginImplFrameCallback(bool state) {
|
| + return inside_begin_impl_frame_ == state;
|
| }
|
|
|
| + bool inside_begin_impl_frame_;
|
| bool will_begin_impl_frame_causes_redraw_;
|
| bool will_begin_impl_frame_requests_one_begin_impl_frame_;
|
| bool draw_will_happen_;
|
| @@ -308,7 +314,7 @@ class SchedulerTest : public testing::Test {
|
| scheduler_->DidCreateAndInitializeOutputSurface();
|
| scheduler_->SetNeedsBeginMainFrame();
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| {
|
| @@ -328,11 +334,11 @@ class SchedulerTest : public testing::Test {
|
| scheduler_->OnDrawForOutputSurface(resourceless_software_draw);
|
| } else {
|
| // Run the posted deadline task.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| + task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| }
|
|
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| }
|
|
|
| client_->Reset();
|
| @@ -344,11 +350,11 @@ class SchedulerTest : public testing::Test {
|
|
|
| if (!scheduler_settings_.using_synchronous_renderer_compositor) {
|
| // Run the posted deadline task.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| + task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| }
|
|
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| }
|
|
|
| EXPECT_FALSE(scheduler_->begin_frames_expected());
|
| @@ -362,10 +368,10 @@ class SchedulerTest : public testing::Test {
|
| 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
|
| + // pending, InsideBeginImplFrame will return false straight away and we
|
| // will run no tasks.
|
| - task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
|
|
| // Send the next BeginFrame message if using an external source, otherwise
|
| // it will be already in the task queue.
|
| @@ -377,9 +383,9 @@ class SchedulerTest : public testing::Test {
|
|
|
| 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());
|
| + EXPECT_TRUE(
|
| + task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(false)));
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| }
|
| }
|
|
|
| @@ -445,13 +451,13 @@ TEST_F(SchedulerTest, VideoNeedsBeginFrames) {
|
|
|
| client_->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| // WillBeginImplFrame is responsible for sending BeginFrames to video.
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
|
|
|
| client_->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
|
|
|
| client_->Reset();
|
| @@ -459,8 +465,8 @@ TEST_F(SchedulerTest, VideoNeedsBeginFrames) {
|
| EXPECT_NO_ACTION(client_);
|
|
|
| client_->Reset();
|
| - task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2);
|
| EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
|
| EXPECT_FALSE(scheduler_->begin_frames_expected());
|
| @@ -478,14 +484,14 @@ TEST_F(SchedulerTest, RequestCommit) {
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| 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_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| client_->Reset();
|
|
|
| @@ -505,14 +511,14 @@ TEST_F(SchedulerTest, RequestCommit) {
|
| // BeginImplFrame should prepare the draw.
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| client_->Reset();
|
|
|
| // BeginImplFrame deadline should draw.
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| client_->Reset();
|
|
|
| @@ -520,7 +526,7 @@ TEST_F(SchedulerTest, RequestCommit) {
|
| // to avoid excessive toggles.
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| @@ -553,7 +559,7 @@ TEST_F(SchedulerTest, RequestCommitAfterSetDeferCommit) {
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| }
|
|
|
| TEST_F(SchedulerTest, DeferCommitWithRedraw) {
|
| @@ -579,7 +585,7 @@ TEST_F(SchedulerTest, DeferCommitWithRedraw) {
|
| client_->Reset();
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
|
|
| client_->Reset();
|
| @@ -599,7 +605,7 @@ TEST_F(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| client_->Reset();
|
| @@ -614,18 +620,18 @@ TEST_F(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // Activate it.
|
| scheduler_->NotifyReadyToActivate();
|
| EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
|
|
| // Because we just swapped, the Scheduler should also request the next
|
| // BeginImplFrame from the OutputSurface.
|
| @@ -636,7 +642,7 @@ TEST_F(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // Finishing the commit before the deadline should post a new deadline task
|
| @@ -644,15 +650,15 @@ TEST_F(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
| scheduler_->NotifyReadyToActivate();
|
| EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| client_->Reset();
|
|
|
| @@ -950,7 +956,7 @@ TEST_F(SchedulerTest, PrepareTiles) {
|
| client->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| // On the deadline, the actions should have occured in the right order.
|
| client->Reset();
|
| @@ -962,7 +968,7 @@ TEST_F(SchedulerTest, PrepareTiles) {
|
| client->ActionIndex("ScheduledActionPrepareTiles"));
|
| EXPECT_FALSE(scheduler_->RedrawPending());
|
| EXPECT_FALSE(scheduler_->PrepareTilesPending());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
|
|
| // Request a draw. We don't need a PrepareTiles yet.
|
| client->Reset();
|
| @@ -977,7 +983,7 @@ TEST_F(SchedulerTest, PrepareTiles) {
|
| client->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| // Draw. The draw will trigger SetNeedsPrepareTiles, and
|
| // then the PrepareTiles action will be triggered after the Draw.
|
| @@ -991,18 +997,18 @@ TEST_F(SchedulerTest, PrepareTiles) {
|
| client->ActionIndex("ScheduledActionPrepareTiles"));
|
| EXPECT_FALSE(scheduler_->RedrawPending());
|
| EXPECT_FALSE(scheduler_->PrepareTilesPending());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
|
|
| // We need a BeginImplFrame where we don't swap to go idle.
|
| client->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client->Reset();
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2);
|
| EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_EQ(0, client->num_draws());
|
|
|
| // Now trigger a PrepareTiles outside of a draw. We will then need
|
| @@ -1018,13 +1024,13 @@ TEST_F(SchedulerTest, PrepareTiles) {
|
| client->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client->Reset();
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_EQ(0, client->num_draws());
|
| EXPECT_FALSE(client->HasAction("ScheduledActionDrawAndSwapIfPossible"));
|
| EXPECT_TRUE(client->HasAction("ScheduledActionPrepareTiles"));
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| }
|
|
|
| // Test that PrepareTiles only happens once per frame. If an external caller
|
| @@ -1040,7 +1046,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
|
| client_->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| EXPECT_TRUE(scheduler_->PrepareTilesPending());
|
| scheduler_->WillPrepareTiles();
|
| @@ -1054,7 +1060,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
|
| EXPECT_FALSE(client_->HasAction("ScheduledActionPrepareTiles"));
|
| EXPECT_FALSE(scheduler_->RedrawPending());
|
| EXPECT_FALSE(scheduler_->PrepareTilesPending());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
|
|
| // Next frame without DidPrepareTiles should PrepareTiles with draw.
|
| scheduler_->SetNeedsPrepareTiles();
|
| @@ -1062,7 +1068,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
|
| client_->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| @@ -1073,7 +1079,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
|
| client_->ActionIndex("ScheduledActionPrepareTiles"));
|
| EXPECT_FALSE(scheduler_->RedrawPending());
|
| EXPECT_FALSE(scheduler_->PrepareTilesPending());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
|
|
| // If we get another DidPrepareTiles within the same frame, we should
|
| // not PrepareTiles on the next frame.
|
| @@ -1084,7 +1090,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
|
| client_->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| EXPECT_TRUE(scheduler_->PrepareTilesPending());
|
|
|
| @@ -1094,7 +1100,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
|
| EXPECT_TRUE(client_->HasAction("ScheduledActionDrawAndSwapIfPossible"));
|
| EXPECT_FALSE(client_->HasAction("ScheduledActionPrepareTiles"));
|
| EXPECT_FALSE(scheduler_->RedrawPending());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
|
|
| // If we get another DidPrepareTiles, we should not PrepareTiles on the next
|
| // frame. This verifies we don't alternate calling PrepareTiles once and
|
| @@ -1108,7 +1114,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
|
| client_->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| EXPECT_TRUE(scheduler_->PrepareTilesPending());
|
|
|
| @@ -1118,7 +1124,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
|
| EXPECT_TRUE(client_->HasAction("ScheduledActionDrawAndSwapIfPossible"));
|
| EXPECT_FALSE(client_->HasAction("ScheduledActionPrepareTiles"));
|
| EXPECT_FALSE(scheduler_->RedrawPending());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
|
|
| // Next frame without DidPrepareTiles should PrepareTiles with draw.
|
| scheduler_->SetNeedsPrepareTiles();
|
| @@ -1126,7 +1132,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
|
| client_->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| @@ -1137,7 +1143,7 @@ TEST_F(SchedulerTest, PrepareTilesOncePerFrame) {
|
| client_->ActionIndex("ScheduledActionPrepareTiles"));
|
| EXPECT_FALSE(scheduler_->RedrawPending());
|
| EXPECT_FALSE(scheduler_->PrepareTilesPending());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| }
|
|
|
| TEST_F(SchedulerTest, PrepareTilesFunnelResetOnVisibilityChange) {
|
| @@ -1164,11 +1170,11 @@ TEST_F(SchedulerTest, PrepareTilesFunnelResetOnVisibilityChange) {
|
| client_->Reset();
|
| AdvanceFrame();
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2);
|
| }
|
| @@ -1262,7 +1268,7 @@ TEST_F(SchedulerTest, WaitForReadyToDrawCancelledWhenLostOutputSurface) {
|
| // Scheduler loses output surface, and stops waiting for ready to draw signal.
|
| client_->Reset();
|
| scheduler_->DidLoseOutputSurface();
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3);
|
| EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
|
| @@ -1276,7 +1282,7 @@ void SchedulerTest::CheckMainFrameSkippedAfterLateCommit(
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| @@ -1293,7 +1299,7 @@ void SchedulerTest::CheckMainFrameSkippedAfterLateCommit(
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_EQ(expect_send_begin_main_frame,
|
| scheduler_->MainThreadMissedLastDeadline());
|
| EXPECT_TRUE(client_->HasAction("WillBeginImplFrame"));
|
| @@ -1423,7 +1429,7 @@ TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateBeginMainFrameAbort) {
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3);
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| @@ -1439,7 +1445,7 @@ TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateBeginMainFrameAbort) {
|
| EXPECT_TRUE(client_->HasAction("WillBeginImplFrame"));
|
| EXPECT_TRUE(client_->HasAction("ScheduledActionSendBeginMainFrame"));
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| }
|
|
|
| @@ -1460,7 +1466,7 @@ TEST_F(SchedulerTest, MainFrameNotSkippedAfterCanDrawChanges) {
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 1, 3);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 2, 3);
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| @@ -1489,7 +1495,7 @@ TEST_F(SchedulerTest, MainFrameNotSkippedAfterCanDrawChanges) {
|
| EXPECT_TRUE(client_->HasAction("WillBeginImplFrame"));
|
| EXPECT_TRUE(client_->HasAction("ScheduledActionSendBeginMainFrame"));
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| }
|
|
|
| @@ -1513,7 +1519,7 @@ void SchedulerTest::ImplFrameSkippedAfterLateSwapAck(
|
| scheduler_->NotifyReadyToCommit();
|
| scheduler_->NotifyReadyToActivate();
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3);
|
| EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3);
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 2, 3);
|
| @@ -1530,7 +1536,7 @@ void SchedulerTest::ImplFrameSkippedAfterLateSwapAck(
|
| SendNextBeginFrame();
|
| // Verify that we skip the BeginImplFrame
|
| EXPECT_NO_ACTION(client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
|
|
| // Verify that we do not perform any actions after we are no longer
|
| @@ -1539,10 +1545,10 @@ void SchedulerTest::ImplFrameSkippedAfterLateSwapAck(
|
| if (swap_ack_before_deadline) {
|
| // It shouldn't matter if the swap ack comes back before the deadline...
|
| scheduler_->DidSwapBuffersComplete();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| } else {
|
| // ... or after the deadline.
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| scheduler_->DidSwapBuffersComplete();
|
| }
|
| EXPECT_NO_ACTION(client_);
|
| @@ -1559,7 +1565,7 @@ void SchedulerTest::ImplFrameSkippedAfterLateSwapAck(
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| scheduler_->NotifyReadyToActivate();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3);
|
| EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3);
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 2, 3);
|
| @@ -1641,7 +1647,7 @@ TEST_F(SchedulerTest,
|
|
|
| client_->Reset();
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
|
|
|
| // Verify we skip every other frame if the swap ack consistently
|
| @@ -1655,7 +1661,7 @@ TEST_F(SchedulerTest,
|
| SendNextBeginFrame();
|
| // Verify that we skip the BeginImplFrame
|
| EXPECT_NO_ACTION(client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
|
|
| // Verify that we do not perform any actions after we are no longer
|
| @@ -1673,9 +1679,9 @@ TEST_F(SchedulerTest,
|
|
|
| client_->Reset();
|
| // Deadline should be immediate.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| task_runner().RunUntilTime(now_src_->NowTicks());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
|
| }
|
| }
|
| @@ -1698,7 +1704,7 @@ void SchedulerTest::ImplFrameNotSkippedAfterLateSwapAck() {
|
| scheduler_->NotifyReadyToCommit();
|
| scheduler_->NotifyReadyToActivate();
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_ACTION("ScheduledActionCommit", client_, 0, 3);
|
| EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 3);
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 2, 3);
|
| @@ -1713,7 +1719,7 @@ void SchedulerTest::ImplFrameNotSkippedAfterLateSwapAck() {
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| SendNextBeginFrame();
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
|
|
| client_->Reset();
|
| @@ -1721,7 +1727,7 @@ void SchedulerTest::ImplFrameNotSkippedAfterLateSwapAck() {
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| scheduler_->NotifyReadyToActivate();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
|
|
| // Verify that we don't skip the actions of the BeginImplFrame
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 0, 4);
|
| @@ -1801,7 +1807,7 @@ TEST_F(SchedulerTest,
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| @@ -1820,7 +1826,7 @@ TEST_F(SchedulerTest,
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| scheduler_->NotifyReadyToActivate();
|
| @@ -1838,7 +1844,7 @@ TEST_F(SchedulerTest,
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
|
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| // Note: BeginMainFrame and swap are skipped here because of
|
| @@ -1862,7 +1868,7 @@ TEST_F(SchedulerTest,
|
| SendNextBeginFrame();
|
| EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
|
| scheduler_->DidSwapBuffersComplete();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
|
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| @@ -1874,7 +1880,7 @@ TEST_F(SchedulerTest,
|
| EXPECT_TRUE(scheduler_->NeedsBeginMainFrame());
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| SendNextBeginFrame();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| scheduler_->DidSwapBuffersComplete();
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| @@ -1891,7 +1897,7 @@ TEST_F(SchedulerTest,
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| scheduler_->NotifyReadyToActivate();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| scheduler_->DidSwapBuffersComplete();
|
| EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
|
| @@ -1925,9 +1931,9 @@ TEST_F(
|
| scheduler_->SetNeedsRedraw();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_TRUE(scheduler_->CommitPending());
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| scheduler_->NotifyReadyToActivate();
|
| @@ -1947,9 +1953,9 @@ TEST_F(
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| scheduler_->NotifyReadyToActivate();
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 3);
|
| EXPECT_ACTION("ScheduledActionCommit", client_, 2, 3);
|
| @@ -1990,9 +1996,9 @@ TEST_F(
|
| scheduler_->SetNeedsRedraw();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_TRUE(scheduler_->CommitPending());
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| scheduler_->DidSwapBuffersComplete();
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| @@ -2010,9 +2016,9 @@ TEST_F(
|
| scheduler_->SetNeedsRedraw();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_TRUE(scheduler_->CommitPending());
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| scheduler_->DidSwapBuffersComplete();
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
|
| @@ -2049,7 +2055,7 @@ TEST_F(SchedulerTest, BeginRetroFrame) {
|
| 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(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| client_->Reset();
|
|
|
| @@ -2062,7 +2068,7 @@ TEST_F(SchedulerTest, BeginRetroFrame) {
|
| // 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_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| client_->Reset();
|
|
|
| @@ -2082,14 +2088,14 @@ TEST_F(SchedulerTest, BeginRetroFrame) {
|
| // BeginImplFrame should prepare the draw.
|
| task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| 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_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| client_->Reset();
|
|
|
| @@ -2097,7 +2103,7 @@ TEST_F(SchedulerTest, BeginRetroFrame) {
|
| // to avoid excessive toggles.
|
| task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| @@ -2118,7 +2124,7 @@ TEST_F(SchedulerTest, RetroFrameDoesNotExpireTooEarly) {
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| @@ -2128,7 +2134,7 @@ TEST_F(SchedulerTest, RetroFrameDoesNotExpireTooEarly) {
|
| // This BeginFrame is queued up as a retro frame.
|
| EXPECT_NO_ACTION(client_);
|
| // The previous deadline is still pending.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| // This main frame activating should schedule the (previous) deadline to
|
| @@ -2140,8 +2146,8 @@ TEST_F(SchedulerTest, RetroFrameDoesNotExpireTooEarly) {
|
|
|
| client_->Reset();
|
| // The deadline task should trigger causing a draw.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
|
|
| // Keep animating.
|
| @@ -2154,14 +2160,14 @@ TEST_F(SchedulerTest, RetroFrameDoesNotExpireTooEarly) {
|
| now_src()->Advance(retro_frame_args.deadline - now_src()->NowTicks());
|
|
|
| // The retro frame hasn't expired yet.
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(false));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(false));
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| // This is an immediate deadline case.
|
| client_->Reset();
|
| task_runner().RunPendingTasks();
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
|
| }
|
|
|
| @@ -2177,7 +2183,7 @@ TEST_F(SchedulerTest, RetroFrameExpiresOnTime) {
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| @@ -2187,7 +2193,7 @@ TEST_F(SchedulerTest, RetroFrameExpiresOnTime) {
|
| // This BeginFrame is queued up as a retro frame.
|
| EXPECT_NO_ACTION(client_);
|
| // The previous deadline is still pending.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| // This main frame activating should schedule the (previous) deadline to
|
| @@ -2199,8 +2205,8 @@ TEST_F(SchedulerTest, RetroFrameExpiresOnTime) {
|
|
|
| client_->Reset();
|
| // The deadline task should trigger causing a draw.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
|
|
| // Keep animating.
|
| @@ -2236,10 +2242,10 @@ TEST_F(SchedulerTest, MissedFrameDoesNotExpireTooEarly) {
|
| client_->Reset();
|
| fake_external_begin_frame_source_->TestOnBeginFrame(missed_frame_args);
|
| EXPECT_TRUE(
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(false)));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(false)));
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| }
|
|
|
| TEST_F(SchedulerTest, MissedFrameExpiresOnTime) {
|
| @@ -2262,9 +2268,9 @@ TEST_F(SchedulerTest, MissedFrameExpiresOnTime) {
|
| client_->Reset();
|
| fake_external_begin_frame_source_->TestOnBeginFrame(missed_frame_args);
|
| EXPECT_FALSE(
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(false)));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(false)));
|
| EXPECT_NO_ACTION(client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| }
|
|
|
| void SchedulerTest::BeginFramesNotFromClient(
|
| @@ -2286,13 +2292,13 @@ void SchedulerTest::BeginFramesNotFromClient(
|
| task_runner().RunPendingTasks(); // Run posted BeginFrame.
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| 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_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // NotifyReadyToCommit should trigger the commit.
|
| @@ -2309,20 +2315,20 @@ void SchedulerTest::BeginFramesNotFromClient(
|
| // BeginImplFrame should prepare the draw.
|
| task_runner().RunPendingTasks(); // Run posted BeginFrame.
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // BeginImplFrame deadline should draw.
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // The following BeginImplFrame deadline should SetNeedsBeginFrame(false)
|
| // to avoid excessive toggles.
|
| task_runner().RunPendingTasks(); // Run posted BeginFrame.
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // Make sure SetNeedsBeginFrame isn't called on the client
|
| @@ -2380,7 +2386,7 @@ void SchedulerTest::BeginFramesNotFromClient_SwapThrottled(
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // NotifyReadyToCommit should trigger the pending commit.
|
| @@ -2396,9 +2402,9 @@ void SchedulerTest::BeginFramesNotFromClient_SwapThrottled(
|
|
|
| // Swapping will put us into a swap throttled state.
|
| // Run posted deadline.
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // While swap throttled, BeginFrames should trigger BeginImplFrames,
|
| @@ -2407,44 +2413,44 @@ void SchedulerTest::BeginFramesNotFromClient_SwapThrottled(
|
| scheduler_->SetNeedsRedraw();
|
| EXPECT_SCOPED(AdvanceFrame()); // Run posted BeginFrame.
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| base::TimeTicks before_deadline, after_deadline;
|
|
|
| // The deadline is set to the regular deadline.
|
| before_deadline = now_src()->NowTicks();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| after_deadline = now_src()->NowTicks();
|
| // We can't do an equality comparison here because the scheduler uses a fudge
|
| // factor that's an internal implementation detail.
|
| EXPECT_GT(after_deadline, before_deadline);
|
| EXPECT_LT(after_deadline,
|
| before_deadline + BeginFrameArgs::DefaultInterval());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| EXPECT_SCOPED(AdvanceFrame()); // Run posted BeginFrame.
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // Take us out of a swap throttled state.
|
| scheduler_->DidSwapBuffersComplete();
|
| EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // The deadline is set to the regular deadline.
|
| before_deadline = now_src()->NowTicks();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| after_deadline = now_src()->NowTicks();
|
| // We can't do an equality comparison here because the scheduler uses a fudge
|
| // factor that's an internal implementation detail.
|
| EXPECT_GT(after_deadline, before_deadline);
|
| EXPECT_LT(after_deadline,
|
| before_deadline + BeginFrameArgs::DefaultInterval());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
| }
|
|
|
| @@ -2498,7 +2504,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) {
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| scheduler_->DidLoseOutputSurface();
|
| @@ -2512,7 +2518,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginFrameStarted) {
|
| EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 1, 2);
|
|
|
| client_->Reset();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3);
|
| EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
|
| EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
|
| @@ -2531,7 +2537,7 @@ TEST_F(SchedulerTest,
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| scheduler_->DidLoseOutputSurface();
|
| @@ -2540,20 +2546,20 @@ TEST_F(SchedulerTest,
|
|
|
| client_->Reset();
|
| // Run posted deadline.
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| // OnBeginImplFrameDeadline didn't schedule output surface creation because
|
| // main frame is not yet completed.
|
| EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2);
|
| EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
|
|
| // BeginImplFrame is not started.
|
| client_->Reset();
|
| task_runner().RunUntilTime(now_src()->NowTicks() +
|
| base::TimeDelta::FromMilliseconds(10));
|
| EXPECT_NO_ACTION(client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| @@ -2575,7 +2581,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) {
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| @@ -2589,7 +2595,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterReadyToCommit) {
|
|
|
| // RemoveObserver(this) is not called until the end of the frame.
|
| client_->Reset();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3);
|
| EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
|
| EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
|
| @@ -2606,7 +2612,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsPrepareTiles) {
|
| client_->Reset();
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| scheduler_->DidLoseOutputSurface();
|
| @@ -2614,7 +2620,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterSetNeedsPrepareTiles) {
|
| EXPECT_NO_ACTION(client_);
|
|
|
| client_->Reset();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 0, 4);
|
| EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 1, 4);
|
| EXPECT_ACTION("RemoveObserver(this)", client_, 2, 4);
|
| @@ -2638,7 +2644,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) {
|
| 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(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
|
|
| // Queue BeginFrames while we are still handling the previous BeginFrame.
|
| @@ -2651,7 +2657,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceAfterBeginRetroFramePosted) {
|
| client_->Reset();
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_NO_ACTION(client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
|
|
| // NotifyReadyToCommit should trigger the commit.
|
| @@ -2698,7 +2704,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
|
| 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(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
|
|
| // Queue BeginFrames while we are still handling the previous BeginFrame.
|
| @@ -2711,7 +2717,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
|
| client_->Reset();
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_NO_ACTION(client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
|
|
| // NotifyReadyToCommit should trigger the commit.
|
| @@ -2731,7 +2737,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
|
| client_->Reset();
|
| task_runner().RunPendingTasks(); // Run posted BeginRetroFrame.
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
|
|
| client_->Reset();
|
| @@ -2742,11 +2748,11 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceDuringBeginRetroFrameRunning) {
|
|
|
| // BeginImplFrame deadline should abort drawing.
|
| client_->Reset();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(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(client_->IsInsideBeginImplFrame());
|
| EXPECT_FALSE(scheduler_->begin_frames_expected());
|
|
|
| // No more BeginRetroFrame because BeginRetroFrame queue is cleared.
|
| @@ -2767,7 +2773,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceWithDelayBasedBeginFrameSource) {
|
| AdvanceFrame();
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
|
|
| // NotifyReadyToCommit should trigger the commit.
|
| @@ -2790,7 +2796,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceWithDelayBasedBeginFrameSource) {
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
|
|
| client_->Reset();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 2);
|
| EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
|
| EXPECT_FALSE(scheduler_->begin_frames_expected());
|
| @@ -2808,7 +2814,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceWhenIdle) {
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| @@ -2820,7 +2826,7 @@ TEST_F(SchedulerTest, DidLoseOutputSurfaceWhenIdle) {
|
| EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_);
|
|
|
| client_->Reset();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
|
|
| // Idle time between BeginFrames.
|
| @@ -2843,13 +2849,13 @@ TEST_F(SchedulerTest, ScheduledActionActivateAfterBecomingInvisible) {
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| scheduler_->SetVisible(false);
|
| @@ -2873,13 +2879,13 @@ TEST_F(SchedulerTest, ScheduledActionActivateAfterBeginFrameSourcePaused) {
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
|
|
| client_->Reset();
|
| fake_external_begin_frame_source_->SetPaused(true);
|
| @@ -2901,7 +2907,7 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) {
|
|
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| client_->Reset();
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| @@ -2915,13 +2921,13 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottled) {
|
| // Unthrottled frame source will immediately begin a new frame.
|
| task_runner().RunPendingTasks(); // Run posted BeginFrame.
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // If we don't swap on the deadline, we wait for the next BeginFrame.
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
| }
|
|
|
| @@ -2943,7 +2949,7 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottledBeforeDeadline) {
|
| scheduler_->SetBeginFrameSource(unthrottled_frame_source_.get());
|
| client_->Reset();
|
|
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| client_->Reset();
|
|
|
| @@ -2956,7 +2962,7 @@ TEST_F(SchedulerTest, SwitchFrameSourceToUnthrottledBeforeDeadline) {
|
|
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
| }
|
|
|
| @@ -2973,12 +2979,12 @@ TEST_F(SchedulerTest, SwitchFrameSourceToThrottled) {
|
|
|
| task_runner().RunPendingTasks(); // Run posted BeginFrame.
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // Switch to a throttled frame source.
|
| @@ -2993,7 +2999,7 @@ TEST_F(SchedulerTest, SwitchFrameSourceToThrottled) {
|
|
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| EXPECT_TRUE(scheduler_->begin_frames_expected());
|
| client_->Reset();
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| @@ -3017,34 +3023,34 @@ TEST_F(SchedulerTest, SwitchFrameSourceToNullInsideDeadline) {
|
| EXPECT_SINGLE_ACTION("RemoveObserver(this)", client_);
|
| client_->Reset();
|
|
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
| EXPECT_FALSE(scheduler_->begin_frames_expected());
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // AdvanceFrame helper can't be used here because there's no deadline posted.
|
| scheduler_->SetNeedsRedraw();
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_NO_ACTION(client_);
|
| client_->Reset();
|
|
|
| scheduler_->SetNeedsBeginMainFrame();
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_NO_ACTION(client_);
|
| client_->Reset();
|
|
|
| // Switch back to the same source, make sure frames continue to be produced.
|
| scheduler_->SetBeginFrameSource(fake_external_begin_frame_source_.get());
|
| EXPECT_SINGLE_ACTION("AddObserver(this)", client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| task_runner().RunPendingTasks();
|
| @@ -3079,7 +3085,7 @@ TEST_F(SchedulerTest, SwitchFrameSourceWhenNotObserving) {
|
| // Scheduler loses output surface, and stops waiting for ready to draw signal.
|
| client_->Reset();
|
| scheduler_->DidLoseOutputSurface();
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| task_runner().RunPendingTasks();
|
| EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 3);
|
| EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
|
| @@ -3132,7 +3138,7 @@ TEST_F(SchedulerTest, SendBeginMainFrameNotExpectedSoon) {
|
| // and send a SendBeginMainFrameNotExpectedSoon.
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| task_runner().RunPendingTasks(); // Run posted deadline.
|
| @@ -3159,7 +3165,7 @@ TEST_F(SchedulerTest, SynchronousCompositorAnimation) {
|
| AdvanceFrame();
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionInvalidateOutputSurface", client_, 1, 2);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // Android onDraw. This doesn't consume the single begin frame request.
|
| @@ -3167,7 +3173,7 @@ TEST_F(SchedulerTest, SynchronousCompositorAnimation) {
|
| bool resourceless_software_draw = false;
|
| scheduler_->OnDrawForOutputSurface(resourceless_software_draw);
|
| EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // The animation inside of WillBeginImplFrame changes stuff on the screen, but
|
| @@ -3178,14 +3184,14 @@ TEST_F(SchedulerTest, SynchronousCompositorAnimation) {
|
| AdvanceFrame();
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionInvalidateOutputSurface", client_, 1, 2);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // Android onDraw.
|
| scheduler_->SetNeedsRedraw();
|
| scheduler_->OnDrawForOutputSurface(resourceless_software_draw);
|
| EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // Idle on next vsync, as the animation has completed.
|
| @@ -3193,7 +3199,7 @@ TEST_F(SchedulerTest, SynchronousCompositorAnimation) {
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
|
| EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
|
| EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
| }
|
|
|
| @@ -3207,7 +3213,7 @@ TEST_F(SchedulerTest, SynchronousCompositorOnDrawDuringIdle) {
|
| scheduler_->OnDrawForOutputSurface(resourceless_software_draw);
|
| EXPECT_ACTION("AddObserver(this)", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 1, 2);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // Idle on next vsync.
|
| @@ -3215,7 +3221,7 @@ TEST_F(SchedulerTest, SynchronousCompositorOnDrawDuringIdle) {
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
|
| EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
|
| EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
| }
|
|
|
| @@ -3236,7 +3242,7 @@ TEST_F(SchedulerTest, SetNeedsOneBeginImplFrame) {
|
| // Next vsync, the first requested frame happens.
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // We don't request another frame here.
|
| @@ -3245,12 +3251,12 @@ TEST_F(SchedulerTest, SetNeedsOneBeginImplFrame) {
|
| // the previous frame's begin impl frame step).
|
| EXPECT_SCOPED(AdvanceFrame());
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 1);
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // End that frame's deadline.
|
| - task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
|
|
| // Scheduler shuts down the source now that no begin frame is requested.
|
| EXPECT_ACTION("RemoveObserver(this)", client_, 0, 2);
|
| @@ -3270,7 +3276,7 @@ TEST_F(SchedulerTest, SynchronousCompositorCommit) {
|
| AdvanceFrame();
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| @@ -3279,7 +3285,7 @@ TEST_F(SchedulerTest, SynchronousCompositorCommit) {
|
| // Next vsync.
|
| AdvanceFrame();
|
| EXPECT_SINGLE_ACTION("WillBeginImplFrame", client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| scheduler_->NotifyReadyToCommit();
|
| @@ -3294,7 +3300,7 @@ TEST_F(SchedulerTest, SynchronousCompositorCommit) {
|
| AdvanceFrame();
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionInvalidateOutputSurface", client_, 1, 2);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // Android onDraw.
|
| @@ -3302,7 +3308,7 @@ TEST_F(SchedulerTest, SynchronousCompositorCommit) {
|
| bool resourceless_software_draw = false;
|
| scheduler_->OnDrawForOutputSurface(resourceless_software_draw);
|
| EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| // Idle on next vsync.
|
| @@ -3310,7 +3316,7 @@ TEST_F(SchedulerTest, SynchronousCompositorCommit) {
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
|
| EXPECT_ACTION("RemoveObserver(this)", client_, 1, 3);
|
| EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
| }
|
|
|
| @@ -3327,7 +3333,7 @@ TEST_F(SchedulerTest, SynchronousCompositorDoubleCommitWithoutDraw) {
|
| AdvanceFrame();
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| @@ -3348,7 +3354,7 @@ TEST_F(SchedulerTest, SynchronousCompositorDoubleCommitWithoutDraw) {
|
| EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
|
| EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 3);
|
| EXPECT_ACTION("ScheduledActionInvalidateOutputSurface", client_, 2, 3);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
|
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| @@ -3395,7 +3401,7 @@ TEST_F(SchedulerTest, SynchronousCompositorPrepareTilesOnDraw) {
|
| scheduler_->OnDrawForOutputSurface(resourceless_software_draw);
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_FALSE(scheduler_->PrepareTilesPending());
|
| client_->Reset();
|
|
|
| @@ -3404,7 +3410,7 @@ TEST_F(SchedulerTest, SynchronousCompositorPrepareTilesOnDraw) {
|
| scheduler_->OnDrawForOutputSurface(resourceless_software_draw);
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 2);
|
| EXPECT_ACTION("ScheduledActionPrepareTiles", client_, 1, 2);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_FALSE(scheduler_->PrepareTilesPending());
|
| client_->Reset();
|
|
|
| @@ -3439,7 +3445,7 @@ TEST_F(SchedulerTest, SynchronousCompositorSendBeginMainFrameWhileIdle) {
|
| bool resourceless_software_draw = false;
|
| scheduler_->OnDrawForOutputSurface(resourceless_software_draw);
|
| EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_FALSE(scheduler_->PrepareTilesPending());
|
| client_->Reset();
|
|
|
| @@ -3467,7 +3473,7 @@ TEST_F(SchedulerTest, SynchronousCompositorSendBeginMainFrameWhileIdle) {
|
| scheduler_->SetNeedsRedraw();
|
| scheduler_->OnDrawForOutputSurface(resourceless_software_draw);
|
| EXPECT_SINGLE_ACTION("ScheduledActionDrawAndSwapIfPossible", client_);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_FALSE(scheduler_->PrepareTilesPending());
|
| client_->Reset();
|
|
|
| @@ -3489,7 +3495,7 @@ TEST_F(SchedulerTest, SynchronousCompositorResourcelessOnDrawWhenInvisible) {
|
| scheduler_->OnDrawForOutputSurface(resourceless_software_draw);
|
| // SynchronousCompositor has to draw regardless of visibility.
|
| EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client_, 0, 1);
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| client_->Reset();
|
| }
|
|
|
| @@ -3507,7 +3513,7 @@ TEST_F(SchedulerTest, AuthoritativeVSyncInterval) {
|
| scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks());
|
| scheduler_->NotifyReadyToCommit();
|
| scheduler_->NotifyReadyToActivate();
|
| - task_runner().RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| + task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
|
|
|
| // Test changing the interval on the frame source external to the scheduler.
|
| synthetic_frame_source_->OnUpdateVSyncParameters(now_src_->NowTicks(),
|
| @@ -3570,13 +3576,13 @@ TEST_F(SchedulerTest, NoOutputSurfaceCreationWhileCommitPending) {
|
| // Lose the output surface and trigger the deadline.
|
| client_->Reset();
|
| scheduler_->DidLoseOutputSurface();
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| EXPECT_NO_ACTION(client_);
|
|
|
| // The scheduler should not trigger the output surface creation till the
|
| // commit is aborted.
|
| - task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_SINGLE_ACTION("SendBeginMainFrameNotExpectedSoon", client_);
|
|
|
| // Abort the commit.
|
| @@ -3601,13 +3607,13 @@ TEST_F(SchedulerTest, OutputSurfaceCreationWhileCommitPending) {
|
| // Lose the output surface and trigger the deadline.
|
| client_->Reset();
|
| scheduler_->DidLoseOutputSurface();
|
| - EXPECT_TRUE(scheduler_->BeginImplFrameDeadlinePending());
|
| + EXPECT_TRUE(client_->IsInsideBeginImplFrame());
|
| EXPECT_NO_ACTION(client_);
|
|
|
| // The scheduler should trigger the output surface creation immediately after
|
| // the begin_impl_frame_state_ is cleared.
|
| - task_runner_->RunTasksWhile(client_->ImplFrameDeadlinePending(true));
|
| - EXPECT_FALSE(scheduler_->BeginImplFrameDeadlinePending());
|
| + task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true));
|
| + EXPECT_FALSE(client_->IsInsideBeginImplFrame());
|
| EXPECT_ACTION("ScheduledActionBeginOutputSurfaceCreation", client_, 0, 2);
|
| EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2);
|
| }
|
|
|