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 "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "cc/animation/keyframed_animation_curve.h" | 8 #include "cc/animation/keyframed_animation_curve.h" |
9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 } | 1166 } |
1167 | 1167 |
1168 TEST_F(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { | 1168 TEST_F(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { |
1169 scoped_refptr<Layer> layer = Layer::Create(layer_settings_); | 1169 scoped_refptr<Layer> layer = Layer::Create(layer_settings_); |
1170 | 1170 |
1171 // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the | 1171 // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the |
1172 // animation should not be accepted. | 1172 // animation should not be accepted. |
1173 EXPECT_FALSE(AddTestAnimation(layer.get())); | 1173 EXPECT_FALSE(AddTestAnimation(layer.get())); |
1174 | 1174 |
1175 scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::Create(); | 1175 scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::Create(); |
1176 layer->layer_animation_controller()->SetAnimationRegistrar(registrar.get()); | 1176 layer->RegisterForAnimations(registrar.get()); |
1177 | 1177 |
1178 // Case 2: with an AnimationRegistrar, the animation should be accepted. | 1178 // Case 2: with an AnimationRegistrar, the animation should be accepted. |
1179 EXPECT_TRUE(AddTestAnimation(layer.get())); | 1179 EXPECT_TRUE(AddTestAnimation(layer.get())); |
1180 | 1180 |
1181 LayerTreeSettings settings; | 1181 LayerTreeSettings settings; |
1182 settings.accelerated_animation_enabled = false; | 1182 settings.accelerated_animation_enabled = false; |
1183 LayerTreeHostFactory factory; | 1183 LayerTreeHostFactory factory; |
1184 scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(settings); | 1184 scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(settings); |
1185 layer_tree_host->SetRootLayer(layer); | 1185 layer_tree_host->SetRootLayer(layer); |
1186 AssertLayerTreeHostMatchesForSubtree(layer.get(), layer_tree_host.get()); | 1186 AssertLayerTreeHostMatchesForSubtree(layer.get(), layer_tree_host.get()); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 // When the layer is destroyed, the other three requests should be aborted. | 1331 // When the layer is destroyed, the other three requests should be aborted. |
1332 layer = nullptr; | 1332 layer = nullptr; |
1333 EXPECT_EQ(1, did_receive_first_result_from_this_source); | 1333 EXPECT_EQ(1, did_receive_first_result_from_this_source); |
1334 EXPECT_EQ(1, did_receive_result_from_different_source); | 1334 EXPECT_EQ(1, did_receive_result_from_different_source); |
1335 EXPECT_EQ(1, did_receive_result_from_anonymous_source); | 1335 EXPECT_EQ(1, did_receive_result_from_anonymous_source); |
1336 EXPECT_EQ(1, did_receive_second_result_from_this_source); | 1336 EXPECT_EQ(1, did_receive_second_result_from_this_source); |
1337 } | 1337 } |
1338 | 1338 |
1339 } // namespace | 1339 } // namespace |
1340 } // namespace cc | 1340 } // namespace cc |
OLD | NEW |