Chromium Code Reviews| Index: cc/trees/layer_tree_host_common_unittest.cc |
| diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc |
| index b70cff3a3885cede1b795552ea7b9d3b3ce94780..c8533ef2da7da0e7b6388c5b1a397d2a91003f5a 100644 |
| --- a/cc/trees/layer_tree_host_common_unittest.cc |
| +++ b/cc/trees/layer_tree_host_common_unittest.cc |
| @@ -9814,6 +9814,48 @@ TEST_F(LayerTreeHostCommonTest, LargeTransformTest) { |
| EXPECT_TRUE(root_in_rsll); |
| } |
| +TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) { |
| + const gfx::Transform identity_matrix; |
| + scoped_refptr<Layer> root = Layer::Create(); |
| + scoped_refptr<LayerWithForcedDrawsContent> animated = |
| + make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| + root->AddChild(animated); |
| + |
| + host()->SetRootLayer(root); |
| + |
| + SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| + gfx::PointF(), gfx::Size(100, 100), true, false); |
| + SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| + gfx::PointF(), gfx::Size(20, 20), true, false); |
| + |
| + root->SetForceRenderSurfaceForTesting(true); |
| + animated->SetOpacity(0.f); |
| + |
| + scoped_refptr<AnimationPlayer> player = |
| + AnimationPlayer::Create(AnimationIdProvider::NextPlayerId()); |
| + timeline()->AttachPlayer(player); |
| + player->AttachElement(animated->id()); |
| + |
| + AddOpacityTransitionToPlayer(player.get(), 10.0, 0.f, 1.f, false); |
| + ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| + |
| + EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree; |
| + EffectNode* node = tree.Node(animated->effect_tree_index()); |
| + EXPECT_TRUE(node->data.is_currently_animating_opacity); |
| + EXPECT_TRUE(node->data.has_potential_opacity_animation); |
| + |
| + root->layer_tree_host()->AnimateLayers( |
| + base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); |
| + node = tree.Node(animated->effect_tree_index()); |
| + EXPECT_TRUE(node->data.is_currently_animating_opacity); |
| + EXPECT_TRUE(node->data.has_potential_opacity_animation); |
| + |
| + player->AbortAnimations(TargetProperty::OPACITY, false /*needs_completion*/); |
| + node = tree.Node(animated->effect_tree_index()); |
| + EXPECT_FALSE(node->data.is_currently_animating_opacity); |
| + EXPECT_FALSE(node->data.has_potential_opacity_animation); |
|
ajuma
2016/05/09 16:56:55
Please also test the case where currently-animatin
jaydasika
2016/05/10 20:22:29
Done.
|
| +} |
| + |
| TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) { |
| LayerTreeHostCommon::ScrollUpdateInfo scroll; |
| scroll.layer_id = 2; |