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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 9796 matching lines...) Expand 10 before | Expand all | Expand 10 after
9807 is_inf_or_nan = std::isinf(child->DrawTransform().matrix().get(1, 1)) || 9807 is_inf_or_nan = std::isinf(child->DrawTransform().matrix().get(1, 1)) ||
9808 std::isnan(child->DrawTransform().matrix().get(1, 1)); 9808 std::isnan(child->DrawTransform().matrix().get(1, 1));
9809 EXPECT_TRUE(is_inf_or_nan); 9809 EXPECT_TRUE(is_inf_or_nan);
9810 9810
9811 std::vector<LayerImpl*>* rsll = render_surface_layer_list_impl(); 9811 std::vector<LayerImpl*>* rsll = render_surface_layer_list_impl();
9812 bool root_in_rsll = 9812 bool root_in_rsll =
9813 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); 9813 std::find(rsll->begin(), rsll->end(), root) != rsll->end();
9814 EXPECT_TRUE(root_in_rsll); 9814 EXPECT_TRUE(root_in_rsll);
9815 } 9815 }
9816 9816
9817 TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) {
9818 const gfx::Transform identity_matrix;
9819 scoped_refptr<Layer> root = Layer::Create();
9820 scoped_refptr<LayerWithForcedDrawsContent> animated =
9821 make_scoped_refptr(new LayerWithForcedDrawsContent());
9822 root->AddChild(animated);
9823
9824 host()->SetRootLayer(root);
9825
9826 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
9827 gfx::PointF(), gfx::Size(100, 100), true, false);
9828 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(),
9829 gfx::PointF(), gfx::Size(20, 20), true, false);
9830
9831 root->SetForceRenderSurfaceForTesting(true);
9832 animated->SetOpacity(0.f);
9833
9834 scoped_refptr<AnimationPlayer> player =
9835 AnimationPlayer::Create(AnimationIdProvider::NextPlayerId());
9836 timeline()->AttachPlayer(player);
9837 player->AttachElement(animated->id());
9838
9839 AddOpacityTransitionToPlayer(player.get(), 10.0, 0.f, 1.f, false);
9840 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
9841
9842 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree;
9843 EffectNode* node = tree.Node(animated->effect_tree_index());
9844 EXPECT_TRUE(node->data.is_currently_animating_opacity);
9845 EXPECT_TRUE(node->data.has_potential_opacity_animation);
9846
9847 root->layer_tree_host()->AnimateLayers(
9848 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max()));
9849 node = tree.Node(animated->effect_tree_index());
9850 EXPECT_TRUE(node->data.is_currently_animating_opacity);
9851 EXPECT_TRUE(node->data.has_potential_opacity_animation);
9852
9853 player->AbortAnimations(TargetProperty::OPACITY, false /*needs_completion*/);
9854 node = tree.Node(animated->effect_tree_index());
9855 EXPECT_FALSE(node->data.is_currently_animating_opacity);
9856 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.
9857 }
9858
9817 TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) { 9859 TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) {
9818 LayerTreeHostCommon::ScrollUpdateInfo scroll; 9860 LayerTreeHostCommon::ScrollUpdateInfo scroll;
9819 scroll.layer_id = 2; 9861 scroll.layer_id = 2;
9820 scroll.scroll_delta = gfx::Vector2d(5, 10); 9862 scroll.scroll_delta = gfx::Vector2d(5, 10);
9821 9863
9822 proto::ScrollUpdateInfo proto; 9864 proto::ScrollUpdateInfo proto;
9823 scroll.ToProtobuf(&proto); 9865 scroll.ToProtobuf(&proto);
9824 LayerTreeHostCommon::ScrollUpdateInfo new_scroll; 9866 LayerTreeHostCommon::ScrollUpdateInfo new_scroll;
9825 new_scroll.FromProtobuf(proto); 9867 new_scroll.FromProtobuf(proto);
9826 9868
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
10039 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10081 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10040 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10082 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10041 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10083 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10042 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10084 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10043 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10085 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10044 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10086 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10045 } 10087 }
10046 10088
10047 } // namespace 10089 } // namespace
10048 } // namespace cc 10090 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698