OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "cc/animation/animation_curve.h" | 9 #include "cc/animation/animation_curve.h" |
10 #include "cc/animation/animation_host.h" | 10 #include "cc/animation/animation_host.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 : started_animating_(false) {} | 243 : started_animating_(false) {} |
244 | 244 |
245 void BeginTest() override { | 245 void BeginTest() override { |
246 AttachPlayersToTimeline(); | 246 AttachPlayersToTimeline(); |
247 player_->AttachElement(layer_tree()->root_layer()->element_id()); | 247 player_->AttachElement(layer_tree()->root_layer()->element_id()); |
248 PostAddAnimationToMainThreadPlayer(player_.get()); | 248 PostAddAnimationToMainThreadPlayer(player_.get()); |
249 } | 249 } |
250 | 250 |
251 void AnimateLayers(LayerTreeHostImpl* host_impl, | 251 void AnimateLayers(LayerTreeHostImpl* host_impl, |
252 base::TimeTicks monotonic_time) override { | 252 base::TimeTicks monotonic_time) override { |
253 bool have_animations = !GetImplAnimationHost(host_impl) | 253 bool have_animations = |
254 ->active_element_animations_for_testing() | 254 !GetImplAnimationHost(host_impl)->active_players_for_testing().empty(); |
255 .empty(); | |
256 if (!started_animating_ && have_animations) { | 255 if (!started_animating_ && have_animations) { |
257 started_animating_ = true; | 256 started_animating_ = true; |
258 return; | 257 return; |
259 } | 258 } |
260 | 259 |
261 if (started_animating_ && !have_animations) | 260 if (started_animating_ && !have_animations) |
262 EndTest(); | 261 EndTest(); |
263 } | 262 } |
264 | 263 |
265 void NotifyAnimationFinished(base::TimeTicks monotonic_time, | 264 void NotifyAnimationFinished(base::TimeTicks monotonic_time, |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 FROM_HERE, | 1358 FROM_HERE, |
1360 base::Bind(&LayerTreeHostAnimationTestAddAnimationAfterAnimating:: | 1359 base::Bind(&LayerTreeHostAnimationTestAddAnimationAfterAnimating:: |
1361 CheckAnimations, | 1360 CheckAnimations, |
1362 base::Unretained(this), host_impl)); | 1361 base::Unretained(this), host_impl)); |
1363 } | 1362 } |
1364 } | 1363 } |
1365 | 1364 |
1366 void CheckAnimations(LayerTreeHostImpl* host_impl) { | 1365 void CheckAnimations(LayerTreeHostImpl* host_impl) { |
1367 GetImplTimelineAndPlayerByID(*host_impl); | 1366 GetImplTimelineAndPlayerByID(*host_impl); |
1368 | 1367 |
1369 EXPECT_EQ(2u, GetImplAnimationHost(host_impl) | 1368 EXPECT_EQ( |
1370 ->active_element_animations_for_testing() | 1369 2u, |
1371 .size()); | 1370 GetImplAnimationHost(host_impl)->active_players_for_testing().size()); |
1372 | 1371 |
1373 Animation* root_anim = | 1372 Animation* root_anim = |
1374 player_impl_->GetAnimation(TargetProperty::TRANSFORM); | 1373 player_impl_->GetAnimation(TargetProperty::TRANSFORM); |
1375 EXPECT_GT((root_anim->start_time() - base::TimeTicks()).InSecondsF(), 0); | 1374 EXPECT_GT((root_anim->start_time() - base::TimeTicks()).InSecondsF(), 0); |
1376 | 1375 |
1377 Animation* anim = player_child_impl_->GetAnimation(TargetProperty::OPACITY); | 1376 Animation* anim = player_child_impl_->GetAnimation(TargetProperty::OPACITY); |
1378 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); | 1377 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); |
1379 | 1378 |
1380 EndTest(); | 1379 EndTest(); |
1381 } | 1380 } |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1863 private: | 1862 private: |
1864 scoped_refptr<Layer> layer_; | 1863 scoped_refptr<Layer> layer_; |
1865 FakeContentLayerClient client_; | 1864 FakeContentLayerClient client_; |
1866 }; | 1865 }; |
1867 | 1866 |
1868 MULTI_THREAD_TEST_F( | 1867 MULTI_THREAD_TEST_F( |
1869 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); | 1868 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); |
1870 | 1869 |
1871 } // namespace | 1870 } // namespace |
1872 } // namespace cc | 1871 } // namespace cc |
OLD | NEW |