| Index: cc/trees/layer_tree_host_unittest_proxy.cc
|
| diff --git a/cc/trees/layer_tree_host_unittest_proxy.cc b/cc/trees/layer_tree_host_unittest_proxy.cc
|
| index d4057cfa10a2a17ba9f8f246f4be0e4a3bda724a..481353535c157e25ba1f3da42dc2a77ff30efe4e 100644
|
| --- a/cc/trees/layer_tree_host_unittest_proxy.cc
|
| +++ b/cc/trees/layer_tree_host_unittest_proxy.cc
|
| @@ -287,4 +287,68 @@ class ThreadProxyTestSetNeedsCommitWhileAnimating : public ThreadProxyTest {
|
|
|
| THREAD_PROXY_TEST_F(ThreadProxyTestSetNeedsCommitWhileAnimating);
|
|
|
| +class ThreadProxyTestCommitWaitsForActivation : public ThreadProxyTest {
|
| + protected:
|
| + ThreadProxyTestCommitWaitsForActivation() : commits_completed_(0) {}
|
| + ~ThreadProxyTestCommitWaitsForActivation() override {}
|
| +
|
| + void BeginTest() override { proxy()->SetNeedsCommit(); }
|
| +
|
| + void ScheduledActionCommit() override {
|
| + switch (commits_completed_) {
|
| + case 0:
|
| + // The first commit does not wait for activation. Verify that the
|
| + // completion event is cleared.
|
| + EXPECT_EQ(nullptr, ThreadProxyImplOnly().commit_completion_event);
|
| + EXPECT_EQ(false,
|
| + ThreadProxyImplOnly().next_commit_waits_for_activation);
|
| + break;
|
| + case 1:
|
| + // The second commit should be held until activation.
|
| + EXPECT_NE(nullptr, ThreadProxyImplOnly().commit_completion_event);
|
| + EXPECT_EQ(true, ThreadProxyImplOnly().next_commit_waits_for_activation);
|
| + break;
|
| + case 2:
|
| + // The third commit should not wait for activation.
|
| + EXPECT_EQ(nullptr, ThreadProxyImplOnly().commit_completion_event);
|
| + EXPECT_EQ(false,
|
| + ThreadProxyImplOnly().next_commit_waits_for_activation);
|
| + }
|
| + }
|
| +
|
| + void DidActivateSyncTree() override {
|
| + // The next_commit_waits_for_activation should have been cleared after the
|
| + // sync tree is activated.
|
| + EXPECT_EQ(false, ThreadProxyImplOnly().next_commit_waits_for_activation);
|
| + }
|
| +
|
| + void DidCommit() override {
|
| + switch (commits_completed_) {
|
| + case 0:
|
| + // The first commit has been completed. Set next commit waits for
|
| + // activation and start another commit.
|
| + commits_completed_++;
|
| + proxy()->SetNextCommitWaitsForActivation();
|
| + proxy()->SetNeedsCommit();
|
| + case 1:
|
| + // Start another commit to verify that this is not held until
|
| + // activation.
|
| + commits_completed_++;
|
| + proxy()->SetNeedsCommit();
|
| + case 2:
|
| + commits_completed_++;
|
| + EndTest();
|
| + }
|
| + }
|
| +
|
| + void AfterTest() override { EXPECT_EQ(3, commits_completed_); }
|
| +
|
| + private:
|
| + int commits_completed_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ThreadProxyTestCommitWaitsForActivation);
|
| +};
|
| +
|
| +THREAD_PROXY_TEST_F(ThreadProxyTestCommitWaitsForActivation);
|
| +
|
| } // namespace cc
|
|
|