| Index: cc/scheduler/scheduler_unittest.cc
|
| diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
|
| index f4027bf4a112fdea5eee4b2138fc928d1ea5b38f..41dc7d8a84d82869bad6333ef40ad6d6be51b08e 100644
|
| --- a/cc/scheduler/scheduler_unittest.cc
|
| +++ b/cc/scheduler/scheduler_unittest.cc
|
| @@ -109,6 +109,10 @@ class FakeSchedulerClient : public SchedulerClient {
|
| actions_.push_back("ScheduledActionSendBeginMainFrame");
|
| states_.push_back(scheduler_->StateAsValue().release());
|
| }
|
| + virtual void ScheduledActionAnimate() OVERRIDE {
|
| + actions_.push_back("ScheduledActionAnimate");
|
| + states_.push_back(scheduler_->StateAsValue().release());
|
| + }
|
| virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible()
|
| OVERRIDE {
|
| actions_.push_back("ScheduledActionDrawAndSwapIfPossible");
|
| @@ -247,7 +251,7 @@ TEST(SchedulerTest, RequestCommit) {
|
|
|
| // BeginImplFrame should prepare the draw.
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_EQ(client.num_actions_(), 0);
|
| + EXPECT_SINGLE_ACTION("ScheduledActionAnimate", client);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| EXPECT_TRUE(client.needs_begin_impl_frame());
|
| client.Reset();
|
| @@ -309,8 +313,9 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client.Reset();
|
| scheduler->OnBeginImplFrameDeadline();
|
| - EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
|
| - EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2);
|
| + EXPECT_ACTION("ScheduledActionAnimate", client, 0, 3);
|
| + EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 3);
|
| + EXPECT_ACTION("SetNeedsBeginImplFrame", client, 2, 3);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
|
|
| // Because we just swapped, the Scheduler should also request the next
|
| @@ -333,8 +338,9 @@ TEST(SchedulerTest, RequestCommitAfterBeginMainFrameSent) {
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client.Reset();
|
| scheduler->OnBeginImplFrameDeadline();
|
| - EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
|
| - EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2);
|
| + EXPECT_ACTION("ScheduledActionAnimate", client, 0, 3);
|
| + EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 3);
|
| + EXPECT_ACTION("SetNeedsBeginImplFrame", client, 2, 3);
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| EXPECT_TRUE(client.needs_begin_impl_frame());
|
| client.Reset();
|
| @@ -365,7 +371,7 @@ TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
|
|
|
| client.Reset();
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_EQ(client.num_actions_(), 0);
|
| + EXPECT_SINGLE_ACTION("ScheduledActionAnimate", client);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client.Reset();
|
| scheduler->OnBeginImplFrameDeadline();
|
| @@ -401,7 +407,7 @@ TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
|
| // No draw happens since the textures are acquired by the main thread.
|
| client.Reset();
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_EQ(client.num_actions_(), 0);
|
| + EXPECT_SINGLE_ACTION("ScheduledActionAnimate", client);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client.Reset();
|
| scheduler->OnBeginImplFrameDeadline();
|
| @@ -416,7 +422,8 @@ TEST(SchedulerTest, TextureAcquisitionCausesCommitInsteadOfDraw) {
|
|
|
| client.Reset();
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_SINGLE_ACTION("ScheduledActionSendBeginMainFrame", client);
|
| + EXPECT_ACTION("ScheduledActionAnimate", client, 0, 2);
|
| + EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
|
|
| // Commit will release the texture.
|
| @@ -495,7 +502,7 @@ TEST(SchedulerTest, TextureAcquisitionCollision) {
|
| // No implicit commit is expected.
|
| client.Reset();
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_EQ(client.num_actions_(), 0);
|
| + EXPECT_SINGLE_ACTION("ScheduledActionAnimate", client);
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
|
|
| client.Reset();
|
| @@ -542,8 +549,9 @@ TEST(SchedulerTest, TextureAcquisitionCollision) {
|
|
|
| // Verify we draw on the next BeginImplFrame deadline
|
| scheduler->OnBeginImplFrameDeadline();
|
| - EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 0, 2);
|
| - EXPECT_ACTION("SetNeedsBeginImplFrame", client, 1, 2);
|
| + EXPECT_ACTION("ScheduledActionAnimate", client, 0, 3);
|
| + EXPECT_ACTION("ScheduledActionDrawAndSwapIfPossible", client, 1, 3);
|
| + EXPECT_ACTION("SetNeedsBeginImplFrame", client, 2, 3);
|
| EXPECT_TRUE(client.needs_begin_impl_frame());
|
| EXPECT_FALSE(scheduler->BeginImplFrameDeadlinePending());
|
| client.Reset();
|
| @@ -938,11 +946,11 @@ TEST(SchedulerTest, ManageTiles) {
|
| EXPECT_FALSE(client.HasAction("ScheduledActionManageTiles"));
|
| EXPECT_FALSE(client.HasAction("ScheduledActionDrawAndSwapIfPossible"));
|
|
|
| - // We have no immediate actions to perform, so the BeginImplFrame should post
|
| - // the deadline task.
|
| + // We have no immediate actions to perform beyond animating, so the
|
| + // BeginImplFrame should post the deadline task.
|
| client.Reset();
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_EQ(client.num_actions_(), 0);
|
| + EXPECT_TRUE(client.HasAction("ScheduledActionAnimate"));
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
|
|
| // On the deadline, he actions should have occured in the right order.
|
| @@ -965,11 +973,11 @@ TEST(SchedulerTest, ManageTiles) {
|
| EXPECT_TRUE(client.needs_begin_impl_frame());
|
| EXPECT_EQ(0, client.num_draws());
|
|
|
| - // We have no immediate actions to perform, so the BeginImplFrame should post
|
| - // the deadline task.
|
| + // We have no immediate actions to perform beyond animating, so the
|
| + // BeginImplFrame should post the deadline task.
|
| client.Reset();
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_EQ(client.num_actions_(), 0);
|
| + EXPECT_TRUE(client.HasAction("ScheduledActionAnimate"));
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
|
|
| // Draw. The draw will trigger SetNeedsManageTiles, and
|
| @@ -989,7 +997,7 @@ TEST(SchedulerTest, ManageTiles) {
|
| // We need a BeginImplFrame where we don't swap to go idle.
|
| client.Reset();
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_EQ(client.num_actions_(), 0);
|
| + EXPECT_EQ(0, client.num_draws());
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
| client.Reset();
|
| scheduler->OnBeginImplFrameDeadline();
|
| @@ -1035,7 +1043,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) {
|
| scheduler->SetNeedsRedraw();
|
| client.Reset();
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_EQ(client.num_actions_(), 0);
|
| + EXPECT_TRUE(client.HasAction("ScheduledActionAnimate"));
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
|
|
| EXPECT_TRUE(scheduler->ManageTilesPending());
|
| @@ -1056,7 +1064,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) {
|
| scheduler->SetNeedsRedraw();
|
| client.Reset();
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_EQ(client.num_actions_(), 0);
|
| + EXPECT_TRUE(client.HasAction("ScheduledActionAnimate"));
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
|
|
| client.Reset();
|
| @@ -1078,7 +1086,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) {
|
| scheduler->SetNeedsRedraw();
|
| client.Reset();
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_EQ(client.num_actions_(), 0);
|
| + EXPECT_TRUE(client.HasAction("ScheduledActionAnimate"));
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
|
|
| EXPECT_TRUE(scheduler->ManageTilesPending());
|
| @@ -1100,7 +1108,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) {
|
| scheduler->SetNeedsRedraw();
|
| client.Reset();
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_EQ(client.num_actions_(), 0);
|
| + EXPECT_TRUE(client.HasAction("ScheduledActionAnimate"));
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
|
|
| EXPECT_TRUE(scheduler->ManageTilesPending());
|
| @@ -1118,7 +1126,7 @@ TEST(SchedulerTest, ManageTilesOncePerFrame) {
|
| scheduler->SetNeedsRedraw();
|
| client.Reset();
|
| scheduler->BeginImplFrame(BeginFrameArgs::CreateForTesting());
|
| - EXPECT_EQ(client.num_actions_(), 0);
|
| + EXPECT_TRUE(client.HasAction("ScheduledActionAnimate"));
|
| EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending());
|
|
|
| client.Reset();
|
|
|