Index: cc/scheduler/scheduler_unittest.cc |
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc |
index f3bf54b89eb0b412472126725fd315fe5ac97e16..e164c7334bbf0e3244f8ab9c1b2af49314550f33 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,47 @@ TEST_F(SchedulerTest, NoCompositorFrameSinkCreationWhileCommitPending) { |
client_); |
} |
+TEST_F(SchedulerTest, ImplSideInvalidationsMergedWithCommit) { |
sunnyps
2017/02/20 23:19:22
I don't understand what this is testing. If SetNee
Khushal
2017/02/21 09:43:45
Its testing that if there is a main frame request,
|
+ 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_); |
+} |
+ |
+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(); |
+ EXPECT_SINGLE_ACTION("ScheduledActionPerformImplSideInvalidation", 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 |