| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/animation/element_animations.h" | 5 #include "cc/animation/element_animations.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "cc/animation/animation_delegate.h" | 8 #include "cc/animation/animation_delegate.h" |
| 9 #include "cc/animation/animation_events.h" | 9 #include "cc/animation/animation_events.h" |
| 10 #include "cc/animation/animation_host.h" | 10 #include "cc/animation/animation_host.h" |
| (...skipping 3570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3581 EXPECT_EQ(1u, host_->ticking_players_for_testing().size()); | 3581 EXPECT_EQ(1u, host_->ticking_players_for_testing().size()); |
| 3582 | 3582 |
| 3583 DestroyTestMainLayer(); | 3583 DestroyTestMainLayer(); |
| 3584 EXPECT_EQ(0u, host_->ticking_players_for_testing().size()); | 3584 EXPECT_EQ(0u, host_->ticking_players_for_testing().size()); |
| 3585 | 3585 |
| 3586 PushProperties(); | 3586 PushProperties(); |
| 3587 EXPECT_EQ(0u, host_->ticking_players_for_testing().size()); | 3587 EXPECT_EQ(0u, host_->ticking_players_for_testing().size()); |
| 3588 EXPECT_EQ(0u, host_impl_->ticking_players_for_testing().size()); | 3588 EXPECT_EQ(0u, host_impl_->ticking_players_for_testing().size()); |
| 3589 } | 3589 } |
| 3590 | 3590 |
| 3591 TEST_F(ElementAnimationsTest, RemoveAndReAddPlayerToTicking) { |
| 3592 CreateTestLayer(false, false); |
| 3593 AttachTimelinePlayerLayer(); |
| 3594 EXPECT_EQ(0u, host_->ticking_players_for_testing().size()); |
| 3595 |
| 3596 // Add an animation and ensure the player is in the host's ticking players. |
| 3597 // Remove the player using RemoveFromTicking(). |
| 3598 player_->AddAnimation(CreateAnimation( |
| 3599 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f)), |
| 3600 2, TargetProperty::OPACITY)); |
| 3601 ASSERT_EQ(1u, host_->ticking_players_for_testing().size()); |
| 3602 player_->RemoveFromTicking(); |
| 3603 ASSERT_EQ(0u, host_->ticking_players_for_testing().size()); |
| 3604 |
| 3605 // Ensure that adding a new animation will correctly update the ticking |
| 3606 // players list. |
| 3607 player_->AddAnimation(CreateAnimation( |
| 3608 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f)), |
| 3609 2, TargetProperty::OPACITY)); |
| 3610 EXPECT_EQ(1u, host_->ticking_players_for_testing().size()); |
| 3611 } |
| 3612 |
| 3591 } // namespace | 3613 } // namespace |
| 3592 } // namespace cc | 3614 } // namespace cc |
| OLD | NEW |