Index: cc/scheduler/scheduler_unittest.cc |
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc |
index f3bf54b89eb0b412472126725fd315fe5ac97e16..14a698c3434b5aa364696d26c591b8dbc38af334 100644 |
--- a/cc/scheduler/scheduler_unittest.cc |
+++ b/cc/scheduler/scheduler_unittest.cc |
@@ -171,6 +171,9 @@ class FakeSchedulerClient : public SchedulerClient, |
actions_.push_back("ScheduledActionInvalidateCompositorFrameSink"); |
states_.push_back(scheduler_->AsValue()); |
} |
+ void ScheduledActionPerformImplSideInvalidation() override { |
+ PushAction("ScheduledActionPerformImplSideInvalidation"); |
+ } |
void SendBeginMainFrameNotExpectedSoon() override { |
PushAction("SendBeginMainFrameNotExpectedSoon"); |
@@ -3183,6 +3186,65 @@ TEST_F(SchedulerTest, NoCompositorFrameSinkCreationWhileCommitPending) { |
client_); |
} |
+TEST_F(SchedulerTest, ImplSideInvalidationsMergedWithCommit) { |
sunnyps
2017/02/23 00:33:21
Please add a basic test for just invalidation in t
Khushal
2017/02/23 01:25:43
Done.
|
+ SetUpScheduler(EXTERNAL_BFS); |
+ |
+ // Request a main frame and invalidation, the only action run should be |
+ // sending the main frame. |
+ scheduler_->SetNeedsBeginMainFrame(); |
+ scheduler_->SetNeedsImplSideInvalidation(); |
+ client_->Reset(); |
+ EXPECT_SCOPED(AdvanceFrame()); |
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
+ EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
+ |
+ // Respond with a commit. The scheduler should only perform the commit |
+ // actions since the impl-side invalidation request will be merged with the |
+ // commit. |
+ client_->Reset(); |
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks::Now()); |
+ scheduler_->NotifyReadyToCommit(); |
+ EXPECT_SINGLE_ACTION("ScheduledActionCommit", client_); |
+ EXPECT_FALSE(scheduler_->needs_impl_side_invalidation()); |
sunnyps
2017/02/23 00:33:21
Can you run the deadline and check that no invalid
Khushal
2017/02/23 01:25:43
Done.
|
+} |
+ |
+TEST_F(SchedulerTest, AbortedCommitsTriggerImplSideInvalidations) { |
+ SetUpScheduler(EXTERNAL_BFS); |
+ |
+ // Request a main frame and invalidation. |
+ scheduler_->SetNeedsBeginMainFrame(); |
+ scheduler_->SetNeedsImplSideInvalidation(); |
+ client_->Reset(); |
+ EXPECT_SCOPED(AdvanceFrame()); |
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
+ EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
+ |
+ // Abort the main frame and request another one, the impl-side invalidations |
+ // should not be blocked on the main frame. |
+ client_->Reset(); |
+ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks::Now()); |
+ scheduler_->BeginMainFrameAborted(CommitEarlyOutReason::FINISHED_NO_UPDATES); |
+ scheduler_->SetNeedsBeginMainFrame(); |
+ task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true)); |
+ EXPECT_SINGLE_ACTION("ScheduledActionPerformImplSideInvalidation", client_); |
+ |
+ // Activate the sync tree. |
+ client_->Reset(); |
+ scheduler_->NotifyReadyToActivate(); |
+ EXPECT_SINGLE_ACTION("ScheduledActionActivateSyncTree", client_); |
+ |
+ // Second impl frame. |
+ client_->Reset(); |
+ EXPECT_SCOPED(AdvanceFrame()); |
+ EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); |
+ EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); |
+ |
+ // Deadline. |
+ client_->Reset(); |
+ task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true)); |
+ EXPECT_SINGLE_ACTION("ScheduledActionDrawIfPossible", client_); |
+} |
+ |
// The three letters appeneded to each version of this test mean the following:s |
// tree_priority: B = both trees same priority; A = active tree priority; |
// scroll_handler_state: H = affects scroll handler; N = does not affect scroll |