Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Unified Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 1148333002: cc: Make re-added animations get pushed to the compositor thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/animation/layer_animation_controller_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest_animation.cc
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index ed27a03a2f8b12bce15b9cc2814157729c267ce8..ddab640b528198dfde9ee7a34d8a253174103514 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -928,6 +928,58 @@ class LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers
SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(
LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers);
+// When a layer with an animation is removed from the tree and later re-added,
+// the animation should resume.
+class LayerTreeHostAnimationTestAnimatedLayerRemovedAndAdded
+ : public LayerTreeHostAnimationTest {
+ public:
+ LayerTreeHostAnimationTestAnimatedLayerRemovedAndAdded() {}
+
+ void SetupTree() override {
+ LayerTreeHostAnimationTest::SetupTree();
+ content_ = Layer::Create();
+ content_->SetBounds(gfx::Size(4, 4));
+ layer_tree_host()->root_layer()->AddChild(content_);
+ AddOpacityTransitionToLayer(content_.get(), 10000.0, 0.1f, 0.9f, true);
+ }
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void DidCommit() override {
+ switch (layer_tree_host()->source_frame_number()) {
+ case 1:
+ content_->RemoveFromParent();
+ break;
+ case 2:
+ layer_tree_host()->root_layer()->AddChild(content_);
+ break;
+ }
+ }
+
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
+ switch (host_impl->active_tree()->source_frame_number()) {
+ case 0:
+ EXPECT_TRUE(host_impl->animation_registrar()->needs_animate_layers());
+ break;
+ case 1:
+ EXPECT_FALSE(host_impl->animation_registrar()->needs_animate_layers());
+ break;
+ case 2:
+ EXPECT_TRUE(host_impl->animation_registrar()->needs_animate_layers());
+ EndTest();
+ break;
+ }
+ }
+
+ void AfterTest() override {}
+
+ private:
+ scoped_refptr<Layer> content_;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(
+ LayerTreeHostAnimationTestAnimatedLayerRemovedAndAdded);
+
class LayerTreeHostAnimationTestAddAnimationAfterAnimating
: public LayerTreeHostAnimationTest {
public:
« no previous file with comments | « cc/animation/layer_animation_controller_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698