| 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 "cc/animation/animation_delegate.h" | 7 #include "cc/animation/animation_delegate.h" |
| 8 #include "cc/animation/animation_events.h" | 8 #include "cc/animation/animation_events.h" |
| 9 #include "cc/animation/animation_host.h" | 9 #include "cc/animation/animation_host.h" |
| 10 #include "cc/animation/animation_id_provider.h" | 10 #include "cc/animation/animation_id_provider.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 EXPECT_EQ(element_animations, player2->element_animations()); | 168 EXPECT_EQ(element_animations, player2->element_animations()); |
| 169 | 169 |
| 170 PushProperties(); | 170 PushProperties(); |
| 171 GetImplTimelineAndPlayerByID(); | 171 GetImplTimelineAndPlayerByID(); |
| 172 | 172 |
| 173 scoped_refptr<ElementAnimations> element_animations_impl = | 173 scoped_refptr<ElementAnimations> element_animations_impl = |
| 174 player_impl_->element_animations(); | 174 player_impl_->element_animations(); |
| 175 EXPECT_TRUE(element_animations_impl); | 175 EXPECT_TRUE(element_animations_impl); |
| 176 | 176 |
| 177 int list_size_before = 0; | 177 int list_size_before = 0; |
| 178 ElementAnimations::PlayersList::Iterator it( | 178 for (auto& player : element_animations_impl_->players_list()) { |
| 179 &element_animations_impl_->players_list()); | 179 EXPECT_TRUE(timeline_->GetPlayerById(player.id())); |
| 180 AnimationPlayer* player; | |
| 181 while ((player = it.GetNext()) != nullptr) { | |
| 182 EXPECT_TRUE(timeline_->GetPlayerById(player->id())); | |
| 183 ++list_size_before; | 180 ++list_size_before; |
| 184 } | 181 } |
| 185 EXPECT_EQ(3, list_size_before); | 182 EXPECT_EQ(3, list_size_before); |
| 186 | 183 |
| 187 player2->DetachElement(); | 184 player2->DetachElement(); |
| 188 EXPECT_FALSE(player2->element_animations()); | 185 EXPECT_FALSE(player2->element_animations()); |
| 189 EXPECT_EQ(element_animations, player_->element_animations()); | 186 EXPECT_EQ(element_animations, player_->element_animations()); |
| 190 EXPECT_EQ(element_animations, player1->element_animations()); | 187 EXPECT_EQ(element_animations, player1->element_animations()); |
| 191 | 188 |
| 192 PushProperties(); | 189 PushProperties(); |
| 193 EXPECT_EQ(element_animations_impl, player_impl_->element_animations()); | 190 EXPECT_EQ(element_animations_impl, player_impl_->element_animations()); |
| 194 | 191 |
| 195 int list_size_after = 0; | 192 int list_size_after = 0; |
| 196 it = ElementAnimations::PlayersList::Iterator( | 193 for (auto& player : element_animations_impl_->players_list()) { |
| 197 &element_animations_impl_->players_list()); | 194 EXPECT_TRUE(timeline_->GetPlayerById(player.id())); |
| 198 while ((player = it.GetNext()) != nullptr) { | |
| 199 EXPECT_TRUE(timeline_->GetPlayerById(player->id())); | |
| 200 ++list_size_after; | 195 ++list_size_after; |
| 201 } | 196 } |
| 202 EXPECT_EQ(2, list_size_after); | 197 EXPECT_EQ(2, list_size_after); |
| 203 } | 198 } |
| 204 | 199 |
| 205 TEST_F(ElementAnimationsTest, SyncNewAnimation) { | 200 TEST_F(ElementAnimationsTest, SyncNewAnimation) { |
| 206 CreateTestLayer(true, false); | 201 CreateTestLayer(true, false); |
| 207 AttachTimelinePlayerLayer(); | 202 AttachTimelinePlayerLayer(); |
| 208 CreateImplTimelineAndPlayer(); | 203 CreateImplTimelineAndPlayer(); |
| 209 | 204 |
| (...skipping 3417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3627 EXPECT_FALSE(player_->IsPotentiallyAnimatingProperty( | 3622 EXPECT_FALSE(player_->IsPotentiallyAnimatingProperty( |
| 3628 TargetProperty::OPACITY, ElementListType::ACTIVE)); | 3623 TargetProperty::OPACITY, ElementListType::ACTIVE)); |
| 3629 EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY, | 3624 EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY, |
| 3630 ElementListType::PENDING)); | 3625 ElementListType::PENDING)); |
| 3631 EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY, | 3626 EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY, |
| 3632 ElementListType::ACTIVE)); | 3627 ElementListType::ACTIVE)); |
| 3633 } | 3628 } |
| 3634 | 3629 |
| 3635 } // namespace | 3630 } // namespace |
| 3636 } // namespace cc | 3631 } // namespace cc |
| OLD | NEW |