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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1957533002: cc : Track opacity animation changes on effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 ea9defbe83d668f9d89205ce829be8b9be757c10..1e83d6981a83ea15f538e3f3e8eb519ec8acc4c8 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -9845,6 +9845,45 @@ TEST_F(LayerTreeHostCommonTest, LargeTransformTest) {
EXPECT_TRUE(root_in_rsll);
}
+TEST_F(LayerTreeHostCommonTest, CurrentlyRunningOpacityAnimationsTrackingTest) {
+ 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);
+
+ 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);
+
+ player->AbortAnimations(TargetProperty::OPACITY, false /*needs_completion*/);
+ node = tree.Node(animated->effect_tree_index());
+ EXPECT_FALSE(node->data.is_currently_animating_opacity);
+}
+
TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) {
LayerTreeHostCommon::ScrollUpdateInfo scroll;
scroll.layer_id = 2;

Powered by Google App Engine
This is Rietveld 408576698