OLD | NEW |
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/layers/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include "cc/animation/keyframed_animation_curve.h" | 7 #include "cc/animation/keyframed_animation_curve.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
10 #include "cc/resources/layer_painter.h" | 10 #include "cc/resources/layer_painter.h" |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 scoped_refptr<Layer> child = Layer::Create(); | 1134 scoped_refptr<Layer> child = Layer::Create(); |
1135 root->AddChild(child); | 1135 root->AddChild(child); |
1136 LayerTreeHostFactory factory; | 1136 LayerTreeHostFactory factory; |
1137 scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(); | 1137 scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(); |
1138 layer_tree_host->SetRootLayer(root); | 1138 layer_tree_host->SetRootLayer(root); |
1139 } | 1139 } |
1140 | 1140 |
1141 static bool AddTestAnimation(Layer* layer) { | 1141 static bool AddTestAnimation(Layer* layer) { |
1142 scoped_ptr<KeyframedFloatAnimationCurve> curve = | 1142 scoped_ptr<KeyframedFloatAnimationCurve> curve = |
1143 KeyframedFloatAnimationCurve::Create(); | 1143 KeyframedFloatAnimationCurve::Create(); |
1144 curve->AddKeyframe(FloatKeyframe::Create(0.0, | 1144 curve->AddKeyframe(FloatKeyframe::Create(0.0, 0.3f, nullptr)); |
1145 0.3f, | 1145 curve->AddKeyframe(FloatKeyframe::Create(1.0, 0.7f, nullptr)); |
1146 scoped_ptr<TimingFunction>())); | |
1147 curve->AddKeyframe(FloatKeyframe::Create(1.0, | |
1148 0.7f, | |
1149 scoped_ptr<TimingFunction>())); | |
1150 scoped_ptr<Animation> animation = | 1146 scoped_ptr<Animation> animation = |
1151 Animation::Create(curve.Pass(), 0, 0, Animation::Opacity); | 1147 Animation::Create(curve.Pass(), 0, 0, Animation::Opacity); |
1152 | 1148 |
1153 return layer->AddAnimation(animation.Pass()); | 1149 return layer->AddAnimation(animation.Pass()); |
1154 } | 1150 } |
1155 | 1151 |
1156 TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { | 1152 TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { |
1157 scoped_refptr<Layer> layer = Layer::Create(); | 1153 scoped_refptr<Layer> layer = Layer::Create(); |
1158 | 1154 |
1159 // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the | 1155 // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 root_layer->AddChild(becomes_not_draws_content); | 1245 root_layer->AddChild(becomes_not_draws_content); |
1250 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent()); | 1246 EXPECT_EQ(0, root_layer->NumDescendantsThatDrawContent()); |
1251 | 1247 |
1252 becomes_draws_content->SetIsDrawable(true); | 1248 becomes_draws_content->SetIsDrawable(true); |
1253 root_layer->AddChild(becomes_draws_content); | 1249 root_layer->AddChild(becomes_draws_content); |
1254 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent()); | 1250 EXPECT_EQ(1, root_layer->NumDescendantsThatDrawContent()); |
1255 } | 1251 } |
1256 | 1252 |
1257 } // namespace | 1253 } // namespace |
1258 } // namespace cc | 1254 } // namespace cc |
OLD | NEW |