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

Unified Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 2090793002: cc: Fix property tree animation sync bug (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "s/EQ/NE" Created 4 years, 6 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/trees/layer_tree_host.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 aee22c80f33b0cdd303fc4f393aa49031fb61530..bed03fc202c1ee406bc450832a39f69496bb7c0e 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -1645,6 +1645,64 @@ class LayerTreeHostAnimationTestNotifyAnimationFinished
SINGLE_AND_MULTI_THREAD_TEST_F(
LayerTreeHostAnimationTestNotifyAnimationFinished);
+// Check that transform sync happens correctly at commit when we remove and add
+// a different animation player to an element.
+class LayerTreeHostAnimationTestChangeAnimationPlayer
+ : public LayerTreeHostAnimationTest {
+ public:
+ void SetupTree() override {
+ LayerTreeHostAnimationTest::SetupTree();
+ AttachPlayersToTimeline();
+ timeline_->DetachPlayer(player_child_.get());
+ player_->AttachElement(layer_tree_host()->root_layer()->id());
+ AddAnimatedTransformToPlayer(player_.get(), 1.0, 5, 5);
ajuma 2016/06/24 21:02:34 If you use the version of AddAnimatedTransformToPl
jaydasika 2016/06/24 21:54:44 Done.
+ }
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
+ PropertyTrees* property_trees = host_impl->pending_tree()->property_trees();
+ TransformNode* node = property_trees->transform_tree.Node(
+ host_impl->pending_tree()->root_layer()->transform_tree_index());
+ gfx::Transform rotate10;
+ rotate10.Rotate(10);
+ switch (host_impl->pending_tree()->source_frame_number()) {
+ case 2:
+ EXPECT_NE(node->data.local, rotate10);
+ EndTest();
+ break;
+ default:
+ break;
+ }
+ }
+
+ void DidCommit() override { PostSetNeedsCommitToMainThread(); }
+
+ void UpdateLayerTreeHost() override {
ajuma 2016/06/24 21:02:34 How about doing this in WillBeginMainFrame? Then t
jaydasika 2016/06/24 21:54:44 Done.
+ if (layer_tree_host()->source_frame_number() == 2) {
+ // Destroy player.
+ timeline_->DetachPlayer(player_.get());
+ player_ = nullptr;
+ timeline_->AttachPlayer(player_child_.get());
+ player_child_->AttachElement(layer_tree_host()->root_layer()->id());
+ AddAnimatedTransformToPlayer(player_child_.get(), 1.0, 5, 5);
+ Animation* animation = player_child_->element_animations()->GetAnimation(
+ TargetProperty::TRANSFORM);
+ animation->set_start_time(base::TimeTicks::Now() +
+ base::TimeDelta::FromSecondsD(1000));
+ animation->set_fill_mode(Animation::FillMode::NONE);
+ animation->InEffect(base::TimeTicks::Now());
jaydasika 2016/06/24 20:47:43 Will remove this.
+ gfx::Transform rotate10;
+ rotate10.Rotate(10);
+ layer_tree_host()->root_layer()->SetTransform(rotate10);
+ }
+ }
+
+ void AfterTest() override {}
+};
+
+MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestChangeAnimationPlayer);
ajuma 2016/06/24 21:02:34 Can this be a single thread test too? (using sync_
jaydasika 2016/06/24 21:54:44 Done.
+
// Check that SetTransformIsPotentiallyAnimatingChanged is called
// if we destroy ElementAnimations.
class LayerTreeHostAnimationTestSetPotentiallyAnimatingOnLacDestruction
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698