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

Unified Diff: cc/animation/element_animations_unittest.cc

Issue 2807753002: Add test for removing and adding ticking AnimationPlayer (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/element_animations_unittest.cc
diff --git a/cc/animation/element_animations_unittest.cc b/cc/animation/element_animations_unittest.cc
index c6cb2d27db408e64a77b2b091e2339cb76a0f9e0..75e69c9b25abfeca6380c5cbb42c1eb9beae5a97 100644
--- a/cc/animation/element_animations_unittest.cc
+++ b/cc/animation/element_animations_unittest.cc
@@ -3588,5 +3588,27 @@ TEST_F(ElementAnimationsTest, DestroyTestMainLayerBeforePushProperties) {
EXPECT_EQ(0u, host_impl_->ticking_players_for_testing().size());
}
+TEST_F(ElementAnimationsTest, RemoveAndReAddPlayerToTicking) {
+ CreateTestLayer(false, false);
+ AttachTimelinePlayerLayer();
+ EXPECT_EQ(0u, host_->ticking_players_for_testing().size());
+
+ // Add an animation and ensure the player is in the host's ticking players.
+ // Remove the player using RemoveFromTicking().
+ player_->AddAnimation(CreateAnimation(
+ std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f)),
+ 2, TargetProperty::OPACITY));
+ ASSERT_EQ(1u, host_->ticking_players_for_testing().size());
+ player_->RemoveFromTicking();
+ ASSERT_EQ(0u, host_->ticking_players_for_testing().size());
+
+ // Ensure that adding a new animation will correctly update the ticking
+ // players list.
+ player_->AddAnimation(CreateAnimation(
+ std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f)),
+ 2, TargetProperty::OPACITY));
+ EXPECT_EQ(1u, host_->ticking_players_for_testing().size());
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698