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

Unified Diff: cc/animation/animation_player_unittest.cc

Issue 1539233002: CC Animations: Fix the case when main-thread player changes layer_id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/animation_player.cc ('k') | cc/test/animation_timelines_test_common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/animation_player_unittest.cc
diff --git a/cc/animation/animation_player_unittest.cc b/cc/animation/animation_player_unittest.cc
index 466964f6d7741bf898e8133b07254e6a1373d495..d8030b3ec804a5da9239f5bc2de660ce8c5fcf15 100644
--- a/cc/animation/animation_player_unittest.cc
+++ b/cc/animation/animation_player_unittest.cc
@@ -332,5 +332,39 @@ TEST_F(AnimationPlayerTest, AddRemoveAnimationCausesSetNeedsCommit) {
client_.set_mutators_need_commit(false);
}
+// If main-thread player switches to another layer within one frame then
+// impl-thread player must be switched as well.
+TEST_F(AnimationPlayerTest, SwitchToLayer) {
+ host_->AddAnimationTimeline(timeline_);
+ timeline_->AttachPlayer(player_);
+ player_->AttachLayer(layer_id_);
+
+ host_->PushPropertiesTo(host_impl_);
+
+ GetImplTimelineAndPlayerByID();
+
+ EXPECT_EQ(player_, GetPlayerForLayerId(layer_id_));
+ EXPECT_TRUE(player_->element_animations());
+ EXPECT_EQ(player_->layer_id(), layer_id_);
+
+ EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(layer_id_));
+ EXPECT_TRUE(player_impl_->element_animations());
+ EXPECT_EQ(player_impl_->layer_id(), layer_id_);
+
+ const int new_layer_id = NextTestLayerId();
+ player_->DetachLayer();
+ player_->AttachLayer(new_layer_id);
+
+ EXPECT_EQ(player_, GetPlayerForLayerId(new_layer_id));
+ EXPECT_TRUE(player_->element_animations());
+ EXPECT_EQ(player_->layer_id(), new_layer_id);
+
+ host_->PushPropertiesTo(host_impl_);
+
+ EXPECT_EQ(player_impl_, GetImplPlayerForLayerId(new_layer_id));
+ EXPECT_TRUE(player_impl_->element_animations());
+ EXPECT_EQ(player_impl_->layer_id(), new_layer_id);
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/animation/animation_player.cc ('k') | cc/test/animation_timelines_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698