diff options
author | danakj <danakj@chromium.org> | 2015-06-25 08:34:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-25 15:35:26 +0000 |
commit | 427e89158c6e7d3b4a122599c392e75bb45298ce (patch) | |
tree | ab45b8e3c0ce7a640e09ede332a79677cc529706 /cc | |
parent | 3822f3b81e3f0b20cdffc417b8147f9d9ef3b012 (diff) | |
download | chromium_src-427e89158c6e7d3b4a122599c392e75bb45298ce.zip chromium_src-427e89158c6e7d3b4a122599c392e75bb45298ce.tar.gz chromium_src-427e89158c6e7d3b4a122599c392e75bb45298ce.tar.bz2 |
cc: Fix flaky LayerTreeHostAnimationTestAddAnimationAfterAnimating
This test assumes that a draw and swap doesn't happen while there's
a pending tree, but that isn't the case.
R=ajuma, enne, vmpstr
BUG=502102
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1209743003
Cr-Commit-Position: refs/heads/master@{#336161}
Diffstat (limited to 'cc')
-rw-r--r-- | cc/trees/layer_tree_host_unittest_animation.cc | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc index 45e3456..9b16e39 100644 --- a/cc/trees/layer_tree_host_unittest_animation.cc +++ b/cc/trees/layer_tree_host_unittest_animation.cc @@ -976,9 +976,6 @@ SINGLE_AND_MULTI_THREAD_TEST_F( class LayerTreeHostAnimationTestAddAnimationAfterAnimating : public LayerTreeHostAnimationTest { public: - LayerTreeHostAnimationTestAddAnimationAfterAnimating() - : num_swap_buffers_(0) {} - void SetupTree() override { LayerTreeHostAnimationTest::SetupTree(); layer_ = Layer::Create(layer_settings()); @@ -1005,23 +1002,22 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override { // After both animations have started, verify that they have valid // start times. - num_swap_buffers_++; + if (host_impl->active_tree()->source_frame_number() < 2) + return; AnimationRegistrar::AnimationControllerMap controllers_copy = host_impl->animation_registrar() ->active_animation_controllers_for_testing(); - if (controllers_copy.size() == 2u) { - EndTest(); - EXPECT_GE(num_swap_buffers_, 3); - for (auto& it : controllers_copy) { - int id = it.first; - if (id == host_impl->RootLayer()->id()) { - Animation* anim = it.second->GetAnimation(Animation::TRANSFORM); - EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); - } else if (id == host_impl->RootLayer()->children()[0]->id()) { - Animation* anim = it.second->GetAnimation(Animation::OPACITY); - EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); - } + EXPECT_EQ(2u, controllers_copy.size()); + for (auto& it : controllers_copy) { + int id = it.first; + if (id == host_impl->RootLayer()->id()) { + Animation* anim = it.second->GetAnimation(Animation::TRANSFORM); + EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); + } else if (id == host_impl->RootLayer()->children()[0]->id()) { + Animation* anim = it.second->GetAnimation(Animation::OPACITY); + EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); } + EndTest(); } } @@ -1029,7 +1025,6 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating private: scoped_refptr<Layer> layer_; - int num_swap_buffers_; }; SINGLE_AND_MULTI_THREAD_TEST_F( |