Chromium Code Reviews| 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..41cb6c0e608c8dad92bd354f2210b937be834c5f 100644 |
| --- a/cc/trees/layer_tree_host_unittest_proxy.cc |
| +++ b/cc/trees/layer_tree_host_unittest_proxy.cc |
| @@ -287,4 +287,66 @@ 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); |
|
vmpstr
2015/11/03 19:50:55
nit: We usually use EXPECT_TRUE/EXPECT_FALSE for n
Khushal
2015/11/03 20:03:05
Done.
|
| + EXPECT_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); |
|
vmpstr
2015/11/03 19:50:55
Here as well.
Khushal
2015/11/03 20:03:05
Done.
|
| + EXPECT_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); |
|
vmpstr
2015/11/03 19:50:55
Here as well.
Khushal
2015/11/03 20:03:05
Done.
|
| + EXPECT_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_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_++; |
|
David Trainor- moved to gerrit
2015/11/02 16:19:44
Pull this out of the switch? Otherwise if you som
Khushal
2015/11/02 17:02:54
The AfterTest should catch that right? It makes su
|
| + 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 |