diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-27 19:20:08 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-27 19:20:08 +0000 |
commit | b60610611d182f452267e1a2fa5928f3f8dc78e8 (patch) | |
tree | 52c2452de97adbccd7052184edf913d6ec1cfc60 | |
parent | cbb79e16a8a4e926d765cd119381a260e0c6e3a9 (diff) | |
download | chromium_src-b60610611d182f452267e1a2fa5928f3f8dc78e8.zip chromium_src-b60610611d182f452267e1a2fa5928f3f8dc78e8.tar.gz chromium_src-b60610611d182f452267e1a2fa5928f3f8dc78e8.tar.bz2 |
cc: Fixed unittests that counted the number of tree activations.
Some of the configurations were not even hitting any EXPECT statements.
BUG=383157
Review URL: https://codereview.chromium.org/345413005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280378 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/layers/texture_layer_unittest.cc | 13 | ||||
-rw-r--r-- | cc/test/layer_tree_test.cc | 7 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_delegated.cc | 13 |
3 files changed, 28 insertions, 5 deletions
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index 0a52968..2be7527 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc @@ -856,16 +856,25 @@ class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest { virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { switch (host_impl->active_tree()->source_frame_number()) { - case 2: { + case 0: { + // The activate for the 1st mailbox should have happened before now. + EXPECT_EQ(1, activate_count_); + break; + } + case 1: { // The activate for the 2nd mailbox should have happened before now. EXPECT_EQ(2, activate_count_); break; } - case 3: { + case 2: { // The activate to remove the layer should have happened before now. EXPECT_EQ(3, activate_count_); break; } + case 3: { + NOTREACHED(); + break; + } } } diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index 8383126..3437f8c 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -159,12 +159,17 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { virtual void CommitComplete() OVERRIDE { LayerTreeHostImpl::CommitComplete(); - test_hooks_->CommitCompleteOnThread(this); + // A few tests count the number of times pending tree is activated. + // When not using impl-side painting, ActivatePendingTree is not called, + // so call these test hooks functions explicitly so that they do need + // to handle non-impl-side path explicitly. if (!settings().impl_side_painting) { test_hooks_->WillActivateTreeOnThread(this); test_hooks_->DidActivateTreeOnThread(this); } + + test_hooks_->CommitCompleteOnThread(this); } virtual DrawResult PrepareToDraw(FrameData* frame) OVERRIDE { diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc index 37c928b..a181b09 100644 --- a/cc/trees/layer_tree_host_unittest_delegated.cc +++ b/cc/trees/layer_tree_host_unittest_delegated.cc @@ -1760,16 +1760,25 @@ class DelegatedFrameIsActivatedDuringCommit virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { switch (host_impl->active_tree()->source_frame_number()) { - case 2: { + case 0: { + // The activate for the 1st frame should have happened before now. + EXPECT_EQ(1, activate_count_); + break; + } + case 1: { // The activate for the 2nd frame should have happened before now. EXPECT_EQ(2, activate_count_); break; } - case 3: { + case 2: { // The activate to remove the layer should have happened before now. EXPECT_EQ(3, activate_count_); break; } + case 3: { + NOTREACHED(); + break; + } } } |