| Index: cc/animation/element_animations_unittest.cc
|
| diff --git a/cc/animation/element_animations_unittest.cc b/cc/animation/element_animations_unittest.cc
|
| index fee5a9438a674065ab9e8c2135b09e3d26d1605b..012743a4beb4aaf0e3abe9637f2651ea51ef89de 100644
|
| --- a/cc/animation/element_animations_unittest.cc
|
| +++ b/cc/animation/element_animations_unittest.cc
|
| @@ -5,6 +5,7 @@
|
| #include "cc/animation/element_animations.h"
|
|
|
| #include "cc/animation/animation_delegate.h"
|
| +#include "cc/animation/animation_events.h"
|
| #include "cc/animation/animation_host.h"
|
| #include "cc/animation/animation_id_provider.h"
|
| #include "cc/animation/animation_player.h"
|
| @@ -49,33 +50,22 @@ TEST_F(ElementAnimationsTest, AttachToLayerInActiveTree) {
|
| EXPECT_TRUE(client_.IsElementInList(element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_.IsElementInList(element_id_, ElementListType::PENDING));
|
|
|
| - host_->AddAnimationTimeline(timeline_);
|
| -
|
| - timeline_->AttachPlayer(player_);
|
| - player_->AttachElement(element_id_);
|
| -
|
| - scoped_refptr<ElementAnimations> element_animations =
|
| - player_->element_animations();
|
| - EXPECT_TRUE(element_animations);
|
| + AttachTimelinePlayerLayer();
|
|
|
| - EXPECT_TRUE(element_animations->has_element_in_active_list());
|
| - EXPECT_FALSE(element_animations->has_element_in_pending_list());
|
| + EXPECT_TRUE(element_animations_->has_element_in_active_list());
|
| + EXPECT_FALSE(element_animations_->has_element_in_pending_list());
|
|
|
| PushProperties();
|
|
|
| GetImplTimelineAndPlayerByID();
|
|
|
| - scoped_refptr<ElementAnimations> element_animations_impl =
|
| - player_impl_->element_animations();
|
| - EXPECT_TRUE(element_animations_impl);
|
| -
|
| - EXPECT_FALSE(element_animations_impl->has_element_in_active_list());
|
| - EXPECT_TRUE(element_animations_impl->has_element_in_pending_list());
|
| + EXPECT_FALSE(element_animations_impl_->has_element_in_active_list());
|
| + EXPECT_TRUE(element_animations_impl_->has_element_in_pending_list());
|
|
|
| // Create the layer in the impl active tree.
|
| client_impl_.RegisterElement(element_id_, ElementListType::ACTIVE);
|
| - EXPECT_TRUE(element_animations_impl->has_element_in_active_list());
|
| - EXPECT_TRUE(element_animations_impl->has_element_in_pending_list());
|
| + EXPECT_TRUE(element_animations_impl_->has_element_in_active_list());
|
| + EXPECT_TRUE(element_animations_impl_->has_element_in_pending_list());
|
|
|
| EXPECT_TRUE(
|
| client_impl_.IsElementInList(element_id_, ElementListType::ACTIVE));
|
| @@ -84,33 +74,33 @@ TEST_F(ElementAnimationsTest, AttachToLayerInActiveTree) {
|
|
|
| // kill layer on main thread.
|
| client_.UnregisterElement(element_id_, ElementListType::ACTIVE);
|
| - EXPECT_EQ(element_animations, player_->element_animations());
|
| - EXPECT_FALSE(element_animations->has_element_in_active_list());
|
| - EXPECT_FALSE(element_animations->has_element_in_pending_list());
|
| + EXPECT_EQ(element_animations_, player_->element_animations());
|
| + EXPECT_FALSE(element_animations_->has_element_in_active_list());
|
| + EXPECT_FALSE(element_animations_->has_element_in_pending_list());
|
|
|
| // Sync doesn't detach LayerImpl.
|
| PushProperties();
|
| - EXPECT_EQ(element_animations_impl, player_impl_->element_animations());
|
| - EXPECT_TRUE(element_animations_impl->has_element_in_active_list());
|
| - EXPECT_TRUE(element_animations_impl->has_element_in_pending_list());
|
| + EXPECT_EQ(element_animations_impl_, player_impl_->element_animations());
|
| + EXPECT_TRUE(element_animations_impl_->has_element_in_active_list());
|
| + EXPECT_TRUE(element_animations_impl_->has_element_in_pending_list());
|
|
|
| // Kill layer on impl thread in pending tree.
|
| client_impl_.UnregisterElement(element_id_, ElementListType::PENDING);
|
| - EXPECT_EQ(element_animations_impl, player_impl_->element_animations());
|
| - EXPECT_TRUE(element_animations_impl->has_element_in_active_list());
|
| - EXPECT_FALSE(element_animations_impl->has_element_in_pending_list());
|
| + EXPECT_EQ(element_animations_impl_, player_impl_->element_animations());
|
| + EXPECT_TRUE(element_animations_impl_->has_element_in_active_list());
|
| + EXPECT_FALSE(element_animations_impl_->has_element_in_pending_list());
|
|
|
| // Kill layer on impl thread in active tree.
|
| client_impl_.UnregisterElement(element_id_, ElementListType::ACTIVE);
|
| - EXPECT_EQ(element_animations_impl, player_impl_->element_animations());
|
| - EXPECT_FALSE(element_animations_impl->has_element_in_active_list());
|
| - EXPECT_FALSE(element_animations_impl->has_element_in_pending_list());
|
| + EXPECT_EQ(element_animations_impl_, player_impl_->element_animations());
|
| + EXPECT_FALSE(element_animations_impl_->has_element_in_active_list());
|
| + EXPECT_FALSE(element_animations_impl_->has_element_in_pending_list());
|
|
|
| // Sync doesn't change anything.
|
| PushProperties();
|
| - EXPECT_EQ(element_animations_impl, player_impl_->element_animations());
|
| - EXPECT_FALSE(element_animations_impl->has_element_in_active_list());
|
| - EXPECT_FALSE(element_animations_impl->has_element_in_pending_list());
|
| + EXPECT_EQ(element_animations_impl_, player_impl_->element_animations());
|
| + EXPECT_FALSE(element_animations_impl_->has_element_in_active_list());
|
| + EXPECT_FALSE(element_animations_impl_->has_element_in_pending_list());
|
|
|
| player_->DetachElement();
|
| EXPECT_FALSE(player_->element_animations());
|
| @@ -126,36 +116,31 @@ TEST_F(ElementAnimationsTest, AttachToNotYetCreatedLayer) {
|
| PushProperties();
|
| GetImplTimelineAndPlayerByID();
|
|
|
| + // Perform attachment separately.
|
| player_->AttachElement(element_id_);
|
| + element_animations_ = player_->element_animations();
|
|
|
| - scoped_refptr<ElementAnimations> element_animations =
|
| - player_->element_animations();
|
| - EXPECT_TRUE(element_animations);
|
| -
|
| - EXPECT_FALSE(element_animations->has_element_in_active_list());
|
| - EXPECT_FALSE(element_animations->has_element_in_pending_list());
|
| + EXPECT_FALSE(element_animations_->has_element_in_active_list());
|
| + EXPECT_FALSE(element_animations_->has_element_in_pending_list());
|
|
|
| PushProperties();
|
| + element_animations_impl_ = player_impl_->element_animations();
|
|
|
| - scoped_refptr<ElementAnimations> element_animations_impl =
|
| - player_impl_->element_animations();
|
| - EXPECT_TRUE(element_animations_impl);
|
| -
|
| - EXPECT_FALSE(element_animations_impl->has_element_in_active_list());
|
| - EXPECT_FALSE(element_animations_impl->has_element_in_pending_list());
|
| + EXPECT_FALSE(element_animations_impl_->has_element_in_active_list());
|
| + EXPECT_FALSE(element_animations_impl_->has_element_in_pending_list());
|
|
|
| // Create layer.
|
| client_.RegisterElement(element_id_, ElementListType::ACTIVE);
|
| - EXPECT_TRUE(element_animations->has_element_in_active_list());
|
| - EXPECT_FALSE(element_animations->has_element_in_pending_list());
|
| + EXPECT_TRUE(element_animations_->has_element_in_active_list());
|
| + EXPECT_FALSE(element_animations_->has_element_in_pending_list());
|
|
|
| client_impl_.RegisterElement(element_id_, ElementListType::PENDING);
|
| - EXPECT_FALSE(element_animations_impl->has_element_in_active_list());
|
| - EXPECT_TRUE(element_animations_impl->has_element_in_pending_list());
|
| + EXPECT_FALSE(element_animations_impl_->has_element_in_active_list());
|
| + EXPECT_TRUE(element_animations_impl_->has_element_in_pending_list());
|
|
|
| client_impl_.RegisterElement(element_id_, ElementListType::ACTIVE);
|
| - EXPECT_TRUE(element_animations_impl->has_element_in_active_list());
|
| - EXPECT_TRUE(element_animations_impl->has_element_in_pending_list());
|
| + EXPECT_TRUE(element_animations_impl_->has_element_in_active_list());
|
| + EXPECT_TRUE(element_animations_impl_->has_element_in_pending_list());
|
| }
|
|
|
| TEST_F(ElementAnimationsTest, AddRemovePlayers) {
|
| @@ -191,7 +176,7 @@ TEST_F(ElementAnimationsTest, AddRemovePlayers) {
|
|
|
| int list_size_before = 0;
|
| ElementAnimations::PlayersList::Iterator it(
|
| - &element_animations_impl->players_list());
|
| + &element_animations_impl_->players_list());
|
| AnimationPlayer* player;
|
| while ((player = it.GetNext()) != nullptr) {
|
| EXPECT_TRUE(timeline_->GetPlayerById(player->id()));
|
| @@ -209,7 +194,7 @@ TEST_F(ElementAnimationsTest, AddRemovePlayers) {
|
|
|
| int list_size_after = 0;
|
| it = ElementAnimations::PlayersList::Iterator(
|
| - &element_animations_impl->players_list());
|
| + &element_animations_impl_->players_list());
|
| while ((player = it.GetNext()) != nullptr) {
|
| EXPECT_TRUE(timeline_->GetPlayerById(player->id()));
|
| ++list_size_after;
|
| @@ -222,25 +207,22 @@ TEST_F(ElementAnimationsTest, SyncNewAnimation) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| + EXPECT_FALSE(player_impl_->GetAnimation(TargetProperty::OPACITY));
|
|
|
| - EXPECT_FALSE(animations_impl->GetAnimation(TargetProperty::OPACITY));
|
| -
|
| - EXPECT_FALSE(animations->needs_to_start_animations_for_testing());
|
| - EXPECT_FALSE(animations_impl->needs_to_start_animations_for_testing());
|
| + EXPECT_FALSE(player_->needs_to_start_animations());
|
| + EXPECT_FALSE(player_impl_->needs_to_start_animations());
|
|
|
| int animation_id =
|
| AddOpacityTransitionToPlayer(player_.get(), 1, 0, 1, false);
|
| - EXPECT_TRUE(animations->needs_to_start_animations_for_testing());
|
| + EXPECT_TRUE(player_->needs_to_start_animations());
|
|
|
| PushProperties();
|
| - EXPECT_TRUE(animations_impl->needs_to_start_animations_for_testing());
|
| - animations_impl->ActivateAnimations();
|
| + EXPECT_TRUE(player_impl_->needs_to_start_animations());
|
| + player_impl_->ActivateAnimations();
|
|
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id));
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(animation_id));
|
| EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
| }
|
|
|
| TEST_F(ElementAnimationsTest,
|
| @@ -249,13 +231,10 @@ TEST_F(ElementAnimationsTest,
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| - EXPECT_FALSE(animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET));
|
| + EXPECT_FALSE(player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET));
|
|
|
| - EXPECT_FALSE(animations->needs_to_start_animations_for_testing());
|
| - EXPECT_FALSE(animations_impl->needs_to_start_animations_for_testing());
|
| + EXPECT_FALSE(player_->needs_to_start_animations());
|
| + EXPECT_FALSE(player_impl_->needs_to_start_animations());
|
|
|
| gfx::ScrollOffset initial_value(100.f, 300.f);
|
| gfx::ScrollOffset provider_initial_value(150.f, 300.f);
|
| @@ -272,10 +251,10 @@ TEST_F(ElementAnimationsTest,
|
| const int animation1_id = 1;
|
| std::unique_ptr<Animation> animation_fixed(Animation::Create(
|
| std::move(curve_fixed), animation1_id, 0, TargetProperty::SCROLL_OFFSET));
|
| - animations->AddAnimation(std::move(animation_fixed));
|
| + player_->AddAnimation(std::move(animation_fixed));
|
| PushProperties();
|
| EXPECT_VECTOR2DF_EQ(initial_value,
|
| - animations_impl->GetAnimationById(animation1_id)
|
| + player_impl_->GetAnimationById(animation1_id)
|
| ->curve()
|
| ->ToScrollOffsetAnimationCurve()
|
| ->GetValue(base::TimeDelta()));
|
| @@ -288,10 +267,10 @@ TEST_F(ElementAnimationsTest,
|
| const int animation2_id = 2;
|
| std::unique_ptr<Animation> animation(Animation::Create(
|
| std::move(curve), animation2_id, 0, TargetProperty::SCROLL_OFFSET));
|
| - animations->AddAnimation(std::move(animation));
|
| + player_->AddAnimation(std::move(animation));
|
| PushProperties();
|
| EXPECT_VECTOR2DF_EQ(provider_initial_value,
|
| - animations_impl->GetAnimationById(animation2_id)
|
| + player_impl_->GetAnimationById(animation2_id)
|
| ->curve()
|
| ->ToScrollOffsetAnimationCurve()
|
| ->GetValue(base::TimeDelta()));
|
| @@ -330,13 +309,10 @@ TEST_F(ElementAnimationsTest, AddedPlayerIsDestroyed) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| TestAnimationDelegateThatDestroysPlayer delegate;
|
|
|
| - scoped_refptr<AnimationPlayer> player2 =
|
| - AnimationPlayer::Create(AnimationIdProvider::NextPlayerId());
|
| + const int player2_id = AnimationIdProvider::NextPlayerId();
|
| + scoped_refptr<AnimationPlayer> player2 = AnimationPlayer::Create(player2_id);
|
| delegate.setTimelineAndPlayer(timeline_, player2);
|
|
|
| timeline_->AttachPlayer(player2);
|
| @@ -348,18 +324,25 @@ TEST_F(ElementAnimationsTest, AddedPlayerIsDestroyed) {
|
|
|
| PushProperties();
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id));
|
| + scoped_refptr<AnimationPlayer> player2_impl =
|
| + timeline_impl_->GetPlayerById(player2_id);
|
| + DCHECK(player2_impl);
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| + player2_impl->ActivateAnimations();
|
| + EXPECT_TRUE(player2_impl->GetAnimationById(animation_id));
|
| +
|
| + scoped_refptr<ElementAnimations> element_animations_impl =
|
| + player2_impl->element_animations();
|
| +
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
|
|
| auto events = host_impl_->CreateEvents();
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_EQ(1u, events->events_.size());
|
| EXPECT_EQ(AnimationEvent::STARTED, events->events_[0].type);
|
|
|
| // The actual detachment happens here, inside the callback
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player2->NotifyAnimationStarted(events->events_[0]);
|
| EXPECT_TRUE(delegate.started());
|
| }
|
|
|
| @@ -370,36 +353,34 @@ TEST_F(ElementAnimationsTest, DoNotClobberStartTimes) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| - EXPECT_FALSE(animations_impl->GetAnimation(TargetProperty::OPACITY));
|
| + EXPECT_FALSE(player_impl_->GetAnimation(TargetProperty::OPACITY));
|
|
|
| int animation_id =
|
| - AddOpacityTransitionToElementAnimations(animations.get(), 1, 0, 1, false);
|
| + AddOpacityTransitionToPlayer(player_.get(), 1, 0, 1, false);
|
|
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
|
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id));
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(animation_id));
|
| EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
|
|
| auto events = host_impl_->CreateEvents();
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // Synchronize the start times.
|
| EXPECT_EQ(1u, events->events_.size());
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| - EXPECT_EQ(animations->GetAnimationById(animation_id)->start_time(),
|
| - animations_impl->GetAnimationById(animation_id)->start_time());
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
| + EXPECT_EQ(player_->GetAnimationById(animation_id)->start_time(),
|
| + player_impl_->GetAnimationById(animation_id)->start_time());
|
|
|
| // Start the animation on the main thread. Should not affect the start time.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
|
| - animations->UpdateState(true, nullptr);
|
| - EXPECT_EQ(animations->GetAnimationById(animation_id)->start_time(),
|
| - animations_impl->GetAnimationById(animation_id)->start_time());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(500));
|
| + element_animations_->UpdateState(true, nullptr);
|
| + EXPECT_EQ(player_->GetAnimationById(animation_id)->start_time(),
|
| + player_impl_->GetAnimationById(animation_id)->start_time());
|
| }
|
|
|
| TEST_F(ElementAnimationsTest, UseSpecifiedStartTimes) {
|
| @@ -407,42 +388,38 @@ TEST_F(ElementAnimationsTest, UseSpecifiedStartTimes) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| int animation_id =
|
| - AddOpacityTransitionToElementAnimations(animations.get(), 1, 0, 1, false);
|
| + AddOpacityTransitionToPlayer(player_.get(), 1, 0, 1, false);
|
|
|
| const TimeTicks start_time = TicksFromSecondsF(123);
|
| - animations->GetAnimation(TargetProperty::OPACITY)->set_start_time(start_time);
|
| + player_->GetAnimation(TargetProperty::OPACITY)->set_start_time(start_time);
|
|
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
|
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id));
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(animation_id));
|
| EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
|
|
| auto events = host_impl_->CreateEvents();
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // Synchronize the start times.
|
| EXPECT_EQ(1u, events->events_.size());
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
|
|
| - EXPECT_EQ(start_time,
|
| - animations->GetAnimationById(animation_id)->start_time());
|
| - EXPECT_EQ(animations->GetAnimationById(animation_id)->start_time(),
|
| - animations_impl->GetAnimationById(animation_id)->start_time());
|
| + EXPECT_EQ(start_time, player_->GetAnimationById(animation_id)->start_time());
|
| + EXPECT_EQ(player_->GetAnimationById(animation_id)->start_time(),
|
| + player_impl_->GetAnimationById(animation_id)->start_time());
|
|
|
| // Start the animation on the main thread. Should not affect the start time.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
|
| - animations->UpdateState(true, nullptr);
|
| - EXPECT_EQ(start_time,
|
| - animations->GetAnimationById(animation_id)->start_time());
|
| - EXPECT_EQ(animations->GetAnimationById(animation_id)->start_time(),
|
| - animations_impl->GetAnimationById(animation_id)->start_time());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(500));
|
| + element_animations_->UpdateState(true, nullptr);
|
| + EXPECT_EQ(start_time, player_->GetAnimationById(animation_id)->start_time());
|
| + EXPECT_EQ(player_->GetAnimationById(animation_id)->start_time(),
|
| + player_impl_->GetAnimationById(animation_id)->start_time());
|
| }
|
|
|
| // Tests that animationss activate and deactivate as expected.
|
| @@ -451,9 +428,6 @@ TEST_F(ElementAnimationsTest, Activation) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| AnimationHost* host = client_.host();
|
| AnimationHost* host_impl = client_impl_.host();
|
|
|
| @@ -466,60 +440,62 @@ TEST_F(ElementAnimationsTest, Activation) {
|
| EXPECT_EQ(0u, host->active_element_animations_for_testing().size());
|
| EXPECT_EQ(0u, host_impl->active_element_animations_for_testing().size());
|
|
|
| - AddOpacityTransitionToElementAnimations(animations.get(), 1, 0, 1, false);
|
| + AddOpacityTransitionToPlayer(player_.get(), 1, 0, 1, false);
|
| // The main thread animations should now be active.
|
| EXPECT_EQ(1u, host->active_element_animations_for_testing().size());
|
|
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
| // Both animationss should now be active.
|
| EXPECT_EQ(1u, host->active_element_animations_for_testing().size());
|
| EXPECT_EQ(1u, host_impl->active_element_animations_for_testing().size());
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_EQ(1u, events->events_.size());
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
|
|
| EXPECT_EQ(1u, host->active_element_animations_for_testing().size());
|
| EXPECT_EQ(1u, host_impl->active_element_animations_for_testing().size());
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(500));
|
| + element_animations_->UpdateState(true, nullptr);
|
| EXPECT_EQ(1u, host->active_element_animations_for_testing().size());
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->UpdateState(true, nullptr);
|
| EXPECT_EQ(Animation::FINISHED,
|
| - animations->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + player_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| EXPECT_EQ(1u, host->active_element_animations_for_testing().size());
|
|
|
| events = host_impl_->CreateEvents();
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(1500));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1500));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - EXPECT_EQ(
|
| - Animation::WAITING_FOR_DELETION,
|
| - animations_impl->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + EXPECT_EQ(Animation::WAITING_FOR_DELETION,
|
| + player_impl_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| // The impl thread animations should have de-activated.
|
| EXPECT_EQ(0u, host_impl->active_element_animations_for_testing().size());
|
|
|
| EXPECT_EQ(1u, events->events_.size());
|
| - animations->NotifyAnimationFinished(events->events_[0]);
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1500));
|
| - animations->UpdateState(true, nullptr);
|
| + player_->NotifyAnimationFinished(events->events_[0]);
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1500));
|
| + element_animations_->UpdateState(true, nullptr);
|
|
|
| EXPECT_EQ(Animation::WAITING_FOR_DELETION,
|
| - animations->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + player_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| // The main thread animations should have de-activated.
|
| EXPECT_EQ(0u, host->active_element_animations_for_testing().size());
|
|
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations->HasAnyAnimation());
|
| - EXPECT_FALSE(animations_impl->HasAnyAnimation());
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_FALSE(player_->has_any_animation());
|
| + EXPECT_FALSE(player_impl_->has_any_animation());
|
| EXPECT_EQ(0u, host->active_element_animations_for_testing().size());
|
| EXPECT_EQ(0u, host_impl->active_element_animations_for_testing().size());
|
| }
|
| @@ -529,70 +505,67 @@ TEST_F(ElementAnimationsTest, SyncPause) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| - EXPECT_FALSE(animations_impl->GetAnimation(TargetProperty::OPACITY));
|
| + EXPECT_FALSE(player_impl_->GetAnimation(TargetProperty::OPACITY));
|
|
|
| // Two steps, three ranges: [0-1) -> 0.2, [1-2) -> 0.3, [2-3] -> 0.4.
|
| const double duration = 3.0;
|
| - const int animation_id = AddOpacityStepsToElementAnimations(
|
| - animations.get(), duration, 0.2f, 0.4f, 2);
|
| + const int animation_id =
|
| + AddOpacityStepsToPlayer(player_.get(), duration, 0.2f, 0.4f, 2);
|
|
|
| // Set start offset to be at the beginning of the second range.
|
| - animations->GetAnimationById(animation_id)
|
| + player_->GetAnimationById(animation_id)
|
| ->set_time_offset(TimeDelta::FromSecondsD(1.01));
|
|
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
|
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id));
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(animation_id));
|
| EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
|
|
| TimeTicks time = kInitialTickTime;
|
|
|
| // Start the animations on each animations.
|
| auto events = host_impl_->CreateEvents();
|
| - animations_impl->Animate(time);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(time);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_EQ(1u, events->events_.size());
|
|
|
| - animations->Animate(time);
|
| - animations->UpdateState(true, nullptr);
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + element_animations_->Animate(time);
|
| + element_animations_->UpdateState(true, nullptr);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
|
|
| EXPECT_EQ(Animation::RUNNING,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
| EXPECT_EQ(Animation::RUNNING,
|
| - animations->GetAnimationById(animation_id)->run_state());
|
| + player_->GetAnimationById(animation_id)->run_state());
|
|
|
| EXPECT_EQ(0.3f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| EXPECT_EQ(0.3f,
|
| client_impl_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| EXPECT_EQ(kInitialTickTime,
|
| - animations->GetAnimationById(animation_id)->start_time());
|
| + player_->GetAnimationById(animation_id)->start_time());
|
| EXPECT_EQ(kInitialTickTime,
|
| - animations_impl->GetAnimationById(animation_id)->start_time());
|
| + player_impl_->GetAnimationById(animation_id)->start_time());
|
|
|
| // Pause the animation at the middle of the second range so the offset
|
| // delays animation until the middle of the third range.
|
| - animations->PauseAnimation(animation_id, TimeDelta::FromSecondsD(1.5));
|
| + player_->PauseAnimation(animation_id, 1.5);
|
| EXPECT_EQ(Animation::PAUSED,
|
| - animations->GetAnimationById(animation_id)->run_state());
|
| + player_->GetAnimationById(animation_id)->run_state());
|
|
|
| // The pause run state change should make it to the impl thread animations.
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
|
|
| // Advance time so it stays within the first range.
|
| time += TimeDelta::FromMilliseconds(10);
|
| - animations->Animate(time);
|
| - animations_impl->Animate(time);
|
| + element_animations_->Animate(time);
|
| + element_animations_impl_->Animate(time);
|
|
|
| EXPECT_EQ(Animation::PAUSED,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
|
|
| // Opacity value doesn't depend on time if paused at specified time offset.
|
| EXPECT_EQ(0.4f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| @@ -605,48 +578,46 @@ TEST_F(ElementAnimationsTest, DoNotSyncFinishedAnimation) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| - EXPECT_FALSE(animations_impl->GetAnimation(TargetProperty::OPACITY));
|
| + EXPECT_FALSE(player_impl_->GetAnimation(TargetProperty::OPACITY));
|
|
|
| int animation_id =
|
| - AddOpacityTransitionToElementAnimations(animations.get(), 1, 0, 1, false);
|
| + AddOpacityTransitionToPlayer(player_.get(), 1, 0, 1, false);
|
|
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
|
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id));
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(animation_id));
|
| EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
|
|
| events = host_impl_->CreateEvents();
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_EQ(1u, events->events_.size());
|
| EXPECT_EQ(AnimationEvent::STARTED, events->events_[0].type);
|
|
|
| // Notify main thread animations that the animation has started.
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
|
|
| // Complete animation on impl thread.
|
| events = host_impl_->CreateEvents();
|
| - animations_impl->Animate(kInitialTickTime + TimeDelta::FromSeconds(1));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromSeconds(1));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_EQ(1u, events->events_.size());
|
| EXPECT_EQ(AnimationEvent::FINISHED, events->events_[0].type);
|
|
|
| - animations->NotifyAnimationFinished(events->events_[0]);
|
| + player_->NotifyAnimationFinished(events->events_[0]);
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromSeconds(2));
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime + TimeDelta::FromSeconds(2));
|
| + element_animations_->UpdateState(true, nullptr);
|
|
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations->GetAnimationById(animation_id));
|
| - EXPECT_FALSE(animations_impl->GetAnimationById(animation_id));
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_FALSE(player_->GetAnimationById(animation_id));
|
| + EXPECT_FALSE(player_impl_->GetAnimationById(animation_id));
|
| }
|
|
|
| // Ensure that a finished animation is eventually deleted by both the
|
| @@ -656,43 +627,41 @@ TEST_F(ElementAnimationsTest, AnimationsAreDeleted) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| - AddOpacityTransitionToElementAnimations(animations.get(), 1.0, 0.0f, 1.0f,
|
| - false);
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, nullptr);
|
| - EXPECT_TRUE(animations->needs_push_properties());
|
| + AddOpacityTransitionToPlayer(player_.get(), 1.0, 0.0f, 1.0f, false);
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, nullptr);
|
| + EXPECT_TRUE(player_->needs_push_properties());
|
|
|
| PushProperties();
|
| - EXPECT_FALSE(animations->needs_push_properties());
|
| + EXPECT_FALSE(player_->needs_push_properties());
|
|
|
| EXPECT_FALSE(host_->needs_push_properties());
|
| EXPECT_FALSE(host_impl_->needs_push_properties());
|
|
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
|
|
| - animations_impl->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(500));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // There should be a STARTED event for the animation.
|
| EXPECT_EQ(1u, events->events_.size());
|
| EXPECT_EQ(AnimationEvent::STARTED, events->events_[0].type);
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->UpdateState(true, nullptr);
|
|
|
| EXPECT_FALSE(host_->needs_push_properties());
|
| EXPECT_FALSE(host_impl_->needs_push_properties());
|
|
|
| events = host_impl_->CreateEvents();
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(2000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| EXPECT_TRUE(host_impl_->needs_push_properties());
|
|
|
| @@ -701,13 +670,14 @@ TEST_F(ElementAnimationsTest, AnimationsAreDeleted) {
|
| EXPECT_EQ(AnimationEvent::FINISHED, events->events_[0].type);
|
|
|
| // Neither animations should have deleted the animation yet.
|
| - EXPECT_TRUE(animations->GetAnimation(TargetProperty::OPACITY));
|
| - EXPECT_TRUE(animations_impl->GetAnimation(TargetProperty::OPACITY));
|
| + EXPECT_TRUE(player_->GetAnimation(TargetProperty::OPACITY));
|
| + EXPECT_TRUE(player_impl_->GetAnimation(TargetProperty::OPACITY));
|
|
|
| - animations->NotifyAnimationFinished(events->events_[0]);
|
| + player_->NotifyAnimationFinished(events->events_[0]);
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(3000));
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(3000));
|
| + element_animations_->UpdateState(true, nullptr);
|
| EXPECT_TRUE(host_->needs_push_properties());
|
|
|
| PushProperties();
|
| @@ -716,8 +686,8 @@ TEST_F(ElementAnimationsTest, AnimationsAreDeleted) {
|
| // should have deleted the animation even though activation has not occurred,
|
| // since the animation was already waiting for deletion when
|
| // PushPropertiesTo was called.
|
| - EXPECT_FALSE(animations->HasAnyAnimation());
|
| - EXPECT_FALSE(animations_impl->HasAnyAnimation());
|
| + EXPECT_FALSE(player_->has_any_animation());
|
| + EXPECT_FALSE(player_impl_->has_any_animation());
|
| }
|
|
|
| // Tests that transitioning opacity from 0 to 1 works as expected.
|
| @@ -743,29 +713,28 @@ TEST_F(ElementAnimationsTest, TrivialTransition) {
|
| CreateTestLayer(true, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| std::unique_ptr<Animation> to_add(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 1, TargetProperty::OPACITY));
|
|
|
| - EXPECT_FALSE(animations->needs_to_start_animations_for_testing());
|
| - animations->AddAnimation(std::move(to_add));
|
| - EXPECT_TRUE(animations->needs_to_start_animations_for_testing());
|
| - animations->Animate(kInitialTickTime);
|
| - EXPECT_FALSE(animations->needs_to_start_animations_for_testing());
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->needs_to_start_animations());
|
| + player_->AddAnimation(std::move(to_add));
|
| + EXPECT_TRUE(player_->needs_to_start_animations());
|
| + element_animations_->Animate(kInitialTickTime);
|
| + EXPECT_FALSE(player_->needs_to_start_animations());
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| // A non-impl-only animation should not generate property updates.
|
| const AnimationEvent* event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->UpdateState(true, events.get());
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
| }
|
| @@ -774,8 +743,6 @@ TEST_F(ElementAnimationsTest, FilterTransition) {
|
| CreateTestLayer(true, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| std::unique_ptr<KeyframedFilterAnimationCurve> curve(
|
| @@ -792,19 +759,20 @@ TEST_F(ElementAnimationsTest, FilterTransition) {
|
|
|
| std::unique_ptr<Animation> animation(
|
| Animation::Create(std::move(curve), 1, 0, TargetProperty::FILTER));
|
| - animations->AddAnimation(std::move(animation));
|
| + player_->AddAnimation(std::move(animation));
|
|
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(start_filters,
|
| client_.GetFilters(element_id_, ElementListType::ACTIVE));
|
| // A non-impl-only animation should not generate property updates.
|
| const AnimationEvent* event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(500));
|
| + element_animations_->UpdateState(true, events.get());
|
| EXPECT_EQ(1u,
|
| client_.GetFilters(element_id_, ElementListType::ACTIVE).size());
|
| EXPECT_EQ(FilterOperation::CreateBrightnessFilter(1.5f),
|
| @@ -812,11 +780,12 @@ TEST_F(ElementAnimationsTest, FilterTransition) {
|
| event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->UpdateState(true, events.get());
|
| EXPECT_EQ(end_filters,
|
| client_.GetFilters(element_id_, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
| }
|
| @@ -826,9 +795,6 @@ TEST_F(ElementAnimationsTest, ScrollOffsetTransition) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| gfx::ScrollOffset initial_value(100.f, 300.f);
|
| @@ -841,64 +807,63 @@ TEST_F(ElementAnimationsTest, ScrollOffsetTransition) {
|
| std::unique_ptr<Animation> animation(
|
| Animation::Create(std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET));
|
| animation->set_needs_synchronized_start_time(true);
|
| - animations->AddAnimation(std::move(animation));
|
| + player_->AddAnimation(std::move(animation));
|
|
|
| client_impl_.SetScrollOffsetForAnimation(initial_value);
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_TRUE(animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET));
|
| - TimeDelta duration =
|
| - animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| - ->curve()
|
| - ->Duration();
|
| - EXPECT_EQ(duration, animations->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_TRUE(player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET));
|
| + TimeDelta duration = player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| + ->curve()
|
| + ->Duration();
|
| + EXPECT_EQ(duration, player_->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| ->curve()
|
| ->Duration());
|
|
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, nullptr);
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, nullptr);
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(initial_value,
|
| client_.GetScrollOffset(element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations_impl->HasActiveAnimation());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_impl_->HasActiveAnimation());
|
| EXPECT_EQ(initial_value,
|
| client_impl_.GetScrollOffset(element_id_, ElementListType::ACTIVE));
|
| // Scroll offset animations should not generate property updates.
|
| const AnimationEvent* event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
|
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| - animations->Animate(kInitialTickTime + duration / 2);
|
| - animations->UpdateState(true, nullptr);
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
| + element_animations_->Animate(kInitialTickTime + duration / 2);
|
| + element_animations_->UpdateState(true, nullptr);
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_VECTOR2DF_EQ(
|
| gfx::Vector2dF(200.f, 250.f),
|
| client_.GetScrollOffset(element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime + duration / 2);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime + duration / 2);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_VECTOR2DF_EQ(
|
| gfx::Vector2dF(200.f, 250.f),
|
| client_impl_.GetScrollOffset(element_id_, ElementListType::ACTIVE));
|
| event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
|
|
| - animations_impl->Animate(kInitialTickTime + duration);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime + duration);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_VECTOR2DF_EQ(target_value, client_impl_.GetScrollOffset(
|
| element_id_, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations_impl->HasActiveAnimation());
|
| + EXPECT_FALSE(player_impl_->HasActiveAnimation());
|
| event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
|
|
| - animations->Animate(kInitialTickTime + duration);
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime + duration);
|
| + element_animations_->UpdateState(true, nullptr);
|
| EXPECT_VECTOR2DF_EQ(target_value, client_.GetScrollOffset(
|
| element_id_, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| }
|
|
|
| TEST_F(ElementAnimationsTest, ScrollOffsetTransitionOnImplOnly) {
|
| @@ -906,8 +871,6 @@ TEST_F(ElementAnimationsTest, ScrollOffsetTransitionOnImplOnly) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| gfx::ScrollOffset initial_value(100.f, 300.f);
|
| @@ -922,11 +885,11 @@ TEST_F(ElementAnimationsTest, ScrollOffsetTransitionOnImplOnly) {
|
| std::unique_ptr<Animation> animation(
|
| Animation::Create(std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET));
|
| animation->set_is_impl_only(true);
|
| - animations_impl->AddAnimation(std::move(animation));
|
| + player_impl_->AddAnimation(std::move(animation));
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations_impl->HasActiveAnimation());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_impl_->HasActiveAnimation());
|
| EXPECT_EQ(initial_value,
|
| client_impl_.GetScrollOffset(element_id_, ElementListType::ACTIVE));
|
| // Scroll offset animations should not generate property updates.
|
| @@ -936,19 +899,19 @@ TEST_F(ElementAnimationsTest, ScrollOffsetTransitionOnImplOnly) {
|
| TimeDelta duration = TimeDelta::FromMicroseconds(
|
| duration_in_seconds * base::Time::kMicrosecondsPerSecond);
|
|
|
| - animations_impl->Animate(kInitialTickTime + duration / 2);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime + duration / 2);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_VECTOR2DF_EQ(
|
| gfx::Vector2dF(200.f, 250.f),
|
| client_impl_.GetScrollOffset(element_id_, ElementListType::ACTIVE));
|
| event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
|
|
| - animations_impl->Animate(kInitialTickTime + duration);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime + duration);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_VECTOR2DF_EQ(target_value, client_impl_.GetScrollOffset(
|
| element_id_, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations_impl->HasActiveAnimation());
|
| + EXPECT_FALSE(player_impl_->HasActiveAnimation());
|
| event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
| }
|
| @@ -962,49 +925,47 @@ TEST_F(ElementAnimationsTest, UpdateStateWithoutAnimate) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| // Add first scroll offset animation.
|
| - AddScrollOffsetAnimationToElementAnimations(
|
| - animations_impl.get(), gfx::ScrollOffset(100.f, 300.f),
|
| - gfx::ScrollOffset(100.f, 200.f), true);
|
| + AddScrollOffsetAnimationToPlayer(player_impl_.get(),
|
| + gfx::ScrollOffset(100.f, 300.f),
|
| + gfx::ScrollOffset(100.f, 200.f), true);
|
|
|
| // Calling UpdateState after Animate should promote the animation to running
|
| // state.
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| - EXPECT_EQ(Animation::RUNNING,
|
| - animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| - ->run_state());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| + EXPECT_EQ(
|
| + Animation::RUNNING,
|
| + player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)->run_state());
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(1500));
|
| - animations_impl->UpdateState(true, events.get());
|
| - EXPECT_EQ(Animation::WAITING_FOR_DELETION,
|
| - animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| - ->run_state());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1500));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| + EXPECT_EQ(
|
| + Animation::WAITING_FOR_DELETION,
|
| + player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)->run_state());
|
|
|
| // Add second scroll offset animation.
|
| - AddScrollOffsetAnimationToElementAnimations(
|
| - animations_impl.get(), gfx::ScrollOffset(100.f, 200.f),
|
| - gfx::ScrollOffset(100.f, 100.f), true);
|
| + AddScrollOffsetAnimationToPlayer(player_impl_.get(),
|
| + gfx::ScrollOffset(100.f, 200.f),
|
| + gfx::ScrollOffset(100.f, 100.f), true);
|
|
|
| // Calling UpdateState without Animate should NOT promote the animation to
|
| // running state.
|
| - animations_impl->UpdateState(true, events.get());
|
| - EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| - animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| - ->run_state());
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| + EXPECT_EQ(
|
| + Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| + player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)->run_state());
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(2000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - EXPECT_EQ(Animation::RUNNING,
|
| - animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| - ->run_state());
|
| + EXPECT_EQ(
|
| + Animation::RUNNING,
|
| + player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)->run_state());
|
| EXPECT_VECTOR2DF_EQ(
|
| gfx::ScrollOffset(100.f, 200.f),
|
| client_impl_.GetScrollOffset(element_id_, ElementListType::ACTIVE));
|
| @@ -1019,11 +980,8 @@ TEST_F(ElementAnimationsTest, ScrollOffsetTransitionNoImplProvider) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| - EXPECT_TRUE(animations_impl->has_element_in_pending_list());
|
| - EXPECT_FALSE(animations_impl->has_element_in_active_list());
|
| + EXPECT_TRUE(element_animations_impl_->has_element_in_pending_list());
|
| + EXPECT_FALSE(element_animations_impl_->has_element_in_active_list());
|
|
|
| auto events = host_impl_->CreateEvents();
|
|
|
| @@ -1037,73 +995,72 @@ TEST_F(ElementAnimationsTest, ScrollOffsetTransitionNoImplProvider) {
|
| std::unique_ptr<Animation> animation(
|
| Animation::Create(std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET));
|
| animation->set_needs_synchronized_start_time(true);
|
| - animations->AddAnimation(std::move(animation));
|
| + player_->AddAnimation(std::move(animation));
|
|
|
| client_.SetScrollOffsetForAnimation(initial_value);
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_TRUE(animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET));
|
| - TimeDelta duration =
|
| - animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| - ->curve()
|
| - ->Duration();
|
| - EXPECT_EQ(duration, animations->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_TRUE(player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET));
|
| + TimeDelta duration = player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| + ->curve()
|
| + ->Duration();
|
| + EXPECT_EQ(duration, player_->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| ->curve()
|
| ->Duration());
|
|
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, nullptr);
|
|
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(initial_value,
|
| client_.GetScrollOffset(element_id_, ElementListType::ACTIVE));
|
| EXPECT_EQ(gfx::ScrollOffset(), client_impl_.GetScrollOffset(
|
| element_id_, ElementListType::PENDING));
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
|
|
| - EXPECT_TRUE(animations_impl->HasActiveAnimation());
|
| + EXPECT_TRUE(player_impl_->HasActiveAnimation());
|
| EXPECT_EQ(initial_value, client_impl_.GetScrollOffset(
|
| element_id_, ElementListType::PENDING));
|
|
|
| CreateTestImplLayer(ElementListType::ACTIVE);
|
|
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| DCHECK_EQ(1UL, events->events_.size());
|
|
|
| // Scroll offset animations should not generate property updates.
|
| const AnimationEvent* event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
|
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| - animations->Animate(kInitialTickTime + duration / 2);
|
| - animations->UpdateState(true, nullptr);
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
| + element_animations_->Animate(kInitialTickTime + duration / 2);
|
| + element_animations_->UpdateState(true, nullptr);
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_VECTOR2DF_EQ(
|
| gfx::Vector2dF(400.f, 150.f),
|
| client_.GetScrollOffset(element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime + duration / 2);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime + duration / 2);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_VECTOR2DF_EQ(
|
| gfx::Vector2dF(400.f, 150.f),
|
| client_impl_.GetScrollOffset(element_id_, ElementListType::PENDING));
|
| event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
|
|
| - animations_impl->Animate(kInitialTickTime + duration);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime + duration);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_VECTOR2DF_EQ(target_value, client_impl_.GetScrollOffset(
|
| element_id_, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations_impl->HasActiveAnimation());
|
| + EXPECT_FALSE(player_impl_->HasActiveAnimation());
|
| event = GetMostRecentPropertyUpdateEvent(events.get());
|
| EXPECT_FALSE(event);
|
|
|
| - animations->Animate(kInitialTickTime + duration);
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime + duration);
|
| + element_animations_->UpdateState(true, nullptr);
|
| EXPECT_VECTOR2DF_EQ(target_value, client_.GetScrollOffset(
|
| element_id_, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| }
|
|
|
| TEST_F(ElementAnimationsTest, ScrollOffsetRemovalClearsScrollDelta) {
|
| @@ -1111,9 +1068,6 @@ TEST_F(ElementAnimationsTest, ScrollOffsetRemovalClearsScrollDelta) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| // First test the 1-argument version of RemoveAnimation.
|
| @@ -1127,21 +1081,24 @@ TEST_F(ElementAnimationsTest, ScrollOffsetRemovalClearsScrollDelta) {
|
| std::unique_ptr<Animation> animation(Animation::Create(
|
| std::move(curve), animation_id, 0, TargetProperty::SCROLL_OFFSET));
|
| animation->set_needs_synchronized_start_time(true);
|
| - animations->AddAnimation(std::move(animation));
|
| + player_->AddAnimation(std::move(animation));
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations->scroll_offset_animation_was_interrupted());
|
| - EXPECT_FALSE(animations_impl->scroll_offset_animation_was_interrupted());
|
| + element_animations_impl_->ActivateAnimations();
|
| + EXPECT_FALSE(element_animations_->scroll_offset_animation_was_interrupted());
|
| + EXPECT_FALSE(
|
| + element_animations_impl_->scroll_offset_animation_was_interrupted());
|
|
|
| - animations->RemoveAnimation(animation_id);
|
| - EXPECT_TRUE(animations->scroll_offset_animation_was_interrupted());
|
| + player_->RemoveAnimation(animation_id);
|
| + EXPECT_TRUE(element_animations_->scroll_offset_animation_was_interrupted());
|
|
|
| PushProperties();
|
| - EXPECT_TRUE(animations_impl->scroll_offset_animation_was_interrupted());
|
| - EXPECT_FALSE(animations->scroll_offset_animation_was_interrupted());
|
| + EXPECT_TRUE(
|
| + element_animations_impl_->scroll_offset_animation_was_interrupted());
|
| + EXPECT_FALSE(element_animations_->scroll_offset_animation_was_interrupted());
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations_impl->scroll_offset_animation_was_interrupted());
|
| + element_animations_impl_->ActivateAnimations();
|
| + EXPECT_FALSE(
|
| + element_animations_impl_->scroll_offset_animation_was_interrupted());
|
|
|
| // Now, test the 2-argument version of RemoveAnimation.
|
| curve = ScrollOffsetAnimationCurve::Create(
|
| @@ -1150,57 +1107,64 @@ TEST_F(ElementAnimationsTest, ScrollOffsetRemovalClearsScrollDelta) {
|
| animation = Animation::Create(std::move(curve), animation_id, 0,
|
| TargetProperty::SCROLL_OFFSET);
|
| animation->set_needs_synchronized_start_time(true);
|
| - animations->AddAnimation(std::move(animation));
|
| + player_->AddAnimation(std::move(animation));
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations->scroll_offset_animation_was_interrupted());
|
| - EXPECT_FALSE(animations_impl->scroll_offset_animation_was_interrupted());
|
| + element_animations_impl_->ActivateAnimations();
|
| + EXPECT_FALSE(element_animations_->scroll_offset_animation_was_interrupted());
|
| + EXPECT_FALSE(
|
| + element_animations_impl_->scroll_offset_animation_was_interrupted());
|
|
|
| - animations->RemoveAnimation(animation_id);
|
| - EXPECT_TRUE(animations->scroll_offset_animation_was_interrupted());
|
| + player_->RemoveAnimation(animation_id);
|
| + EXPECT_TRUE(element_animations_->scroll_offset_animation_was_interrupted());
|
|
|
| PushProperties();
|
| - EXPECT_TRUE(animations_impl->scroll_offset_animation_was_interrupted());
|
| - EXPECT_FALSE(animations->scroll_offset_animation_was_interrupted());
|
| + EXPECT_TRUE(
|
| + element_animations_impl_->scroll_offset_animation_was_interrupted());
|
| + EXPECT_FALSE(element_animations_->scroll_offset_animation_was_interrupted());
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations_impl->scroll_offset_animation_was_interrupted());
|
| + element_animations_impl_->ActivateAnimations();
|
| + EXPECT_FALSE(
|
| + element_animations_impl_->scroll_offset_animation_was_interrupted());
|
|
|
| // Check that removing non-scroll-offset animations does not cause
|
| // scroll_offset_animation_was_interrupted() to get set.
|
| - animation_id =
|
| - AddAnimatedTransformToElementAnimations(animations.get(), 1.0, 1, 2);
|
| + animation_id = AddAnimatedTransformToPlayer(player_.get(), 1.0, 1, 2);
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations->scroll_offset_animation_was_interrupted());
|
| - EXPECT_FALSE(animations_impl->scroll_offset_animation_was_interrupted());
|
| + element_animations_impl_->ActivateAnimations();
|
| + EXPECT_FALSE(element_animations_->scroll_offset_animation_was_interrupted());
|
| + EXPECT_FALSE(
|
| + element_animations_impl_->scroll_offset_animation_was_interrupted());
|
|
|
| - animations->RemoveAnimation(animation_id);
|
| - EXPECT_FALSE(animations->scroll_offset_animation_was_interrupted());
|
| + player_->RemoveAnimation(animation_id);
|
| + EXPECT_FALSE(element_animations_->scroll_offset_animation_was_interrupted());
|
|
|
| PushProperties();
|
| - EXPECT_FALSE(animations_impl->scroll_offset_animation_was_interrupted());
|
| - EXPECT_FALSE(animations->scroll_offset_animation_was_interrupted());
|
| + EXPECT_FALSE(
|
| + element_animations_impl_->scroll_offset_animation_was_interrupted());
|
| + EXPECT_FALSE(element_animations_->scroll_offset_animation_was_interrupted());
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations_impl->scroll_offset_animation_was_interrupted());
|
| + element_animations_impl_->ActivateAnimations();
|
| + EXPECT_FALSE(
|
| + element_animations_impl_->scroll_offset_animation_was_interrupted());
|
|
|
| - animation_id =
|
| - AddAnimatedFilterToElementAnimations(animations.get(), 1.0, 0.1f, 0.2f);
|
| + animation_id = AddAnimatedFilterToPlayer(player_.get(), 1.0, 0.1f, 0.2f);
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations->scroll_offset_animation_was_interrupted());
|
| - EXPECT_FALSE(animations_impl->scroll_offset_animation_was_interrupted());
|
| + element_animations_impl_->ActivateAnimations();
|
| + EXPECT_FALSE(element_animations_->scroll_offset_animation_was_interrupted());
|
| + EXPECT_FALSE(
|
| + element_animations_impl_->scroll_offset_animation_was_interrupted());
|
|
|
| - animations->RemoveAnimation(animation_id);
|
| - EXPECT_FALSE(animations->scroll_offset_animation_was_interrupted());
|
| + player_->RemoveAnimation(animation_id);
|
| + EXPECT_FALSE(element_animations_->scroll_offset_animation_was_interrupted());
|
|
|
| PushProperties();
|
| - EXPECT_FALSE(animations_impl->scroll_offset_animation_was_interrupted());
|
| - EXPECT_FALSE(animations->scroll_offset_animation_was_interrupted());
|
| + EXPECT_FALSE(
|
| + element_animations_impl_->scroll_offset_animation_was_interrupted());
|
| + EXPECT_FALSE(element_animations_->scroll_offset_animation_was_interrupted());
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations_impl->scroll_offset_animation_was_interrupted());
|
| + element_animations_impl_->ActivateAnimations();
|
| + EXPECT_FALSE(
|
| + element_animations_impl_->scroll_offset_animation_was_interrupted());
|
| }
|
|
|
| // Tests that impl-only animations lead to start and finished notifications
|
| @@ -1211,9 +1175,6 @@ TEST_F(ElementAnimationsTest,
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| TestAnimationDelegate delegate;
|
| @@ -1230,24 +1191,23 @@ TEST_F(ElementAnimationsTest,
|
| std::unique_ptr<Animation> to_add(
|
| Animation::Create(std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET));
|
| to_add->set_is_impl_only(true);
|
| - animations_impl->AddAnimation(std::move(to_add));
|
| + player_impl_->AddAnimation(std::move(to_add));
|
|
|
| EXPECT_FALSE(delegate.started());
|
| EXPECT_FALSE(delegate.finished());
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| EXPECT_TRUE(delegate.started());
|
| EXPECT_FALSE(delegate.finished());
|
|
|
| events = host_impl_->CreateEvents();
|
| - animations_impl->Animate(kInitialTickTime + duration);
|
| - EXPECT_EQ(duration,
|
| - animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| - ->curve()
|
| - ->Duration());
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime + duration);
|
| + EXPECT_EQ(duration, player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| + ->curve()
|
| + ->Duration());
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| EXPECT_TRUE(delegate.started());
|
| EXPECT_TRUE(delegate.finished());
|
| @@ -1259,32 +1219,29 @@ TEST_F(ElementAnimationsTest, SpecifiedStartTimesAreSentToMainThreadDelegate) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| TestAnimationDelegate delegate;
|
| player_->set_animation_delegate(&delegate);
|
|
|
| int animation_id =
|
| - AddOpacityTransitionToElementAnimations(animations.get(), 1, 0, 1, false);
|
| + AddOpacityTransitionToPlayer(player_.get(), 1, 0, 1, false);
|
|
|
| const TimeTicks start_time = TicksFromSecondsF(123);
|
| - animations->GetAnimation(TargetProperty::OPACITY)->set_start_time(start_time);
|
| + player_->GetAnimation(TargetProperty::OPACITY)->set_start_time(start_time);
|
|
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
|
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id));
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(animation_id));
|
| EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
|
|
| auto events = host_impl_->CreateEvents();
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // Synchronize the start times.
|
| EXPECT_EQ(1u, events->events_.size());
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
|
|
| // Validate start time on the main thread delegate.
|
| EXPECT_EQ(start_time, delegate.start_time());
|
| @@ -1297,8 +1254,6 @@ TEST_F(ElementAnimationsTest,
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| std::unique_ptr<Animation> to_add(CreateAnimation(
|
| @@ -1308,28 +1263,31 @@ TEST_F(ElementAnimationsTest,
|
|
|
| // We should pause at the first keyframe indefinitely waiting for that
|
| // animation to start.
|
| - animations->AddAnimation(std::move(to_add));
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + player_->AddAnimation(std::move(to_add));
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| // Send the synchronized start time.
|
| - animations->NotifyAnimationStarted(AnimationEvent(
|
| + player_->NotifyAnimationStarted(AnimationEvent(
|
| AnimationEvent::STARTED, ElementId(), 1, TargetProperty::OPACITY,
|
| kInitialTickTime + TimeDelta::FromMilliseconds(2000)));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(5000));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(5000));
|
| + element_animations_->UpdateState(true, events.get());
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| }
|
|
|
| // Tests that two queued animations affecting the same property run in sequence.
|
| @@ -1337,41 +1295,41 @@ TEST_F(ElementAnimationsTest, TrivialQueuing) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| - EXPECT_FALSE(animations->needs_to_start_animations_for_testing());
|
| + EXPECT_FALSE(player_->needs_to_start_animations());
|
|
|
| - animations->AddAnimation(CreateAnimation(
|
| + player_->AddAnimation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 1, TargetProperty::OPACITY));
|
| - animations->AddAnimation(CreateAnimation(
|
| + player_->AddAnimation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f)),
|
| 2, TargetProperty::OPACITY));
|
|
|
| - EXPECT_TRUE(animations->needs_to_start_animations_for_testing());
|
| + EXPECT_TRUE(player_->needs_to_start_animations());
|
|
|
| - animations->Animate(kInitialTickTime);
|
| + element_animations_->Animate(kInitialTickTime);
|
|
|
| // The second animation still needs to be started.
|
| - EXPECT_TRUE(animations->needs_to_start_animations_for_testing());
|
| + EXPECT_TRUE(player_->needs_to_start_animations());
|
|
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - EXPECT_TRUE(animations->needs_to_start_animations_for_testing());
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_FALSE(animations->needs_to_start_animations_for_testing());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + EXPECT_TRUE(player_->needs_to_start_animations());
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_FALSE(player_->needs_to_start_animations());
|
|
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_->UpdateState(true, events.get());
|
| EXPECT_EQ(0.5f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| }
|
|
|
| // Tests interrupting a transition with another transition.
|
| @@ -1379,34 +1337,34 @@ TEST_F(ElementAnimationsTest, Interrupt) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| - animations->AddAnimation(CreateAnimation(
|
| + player_->AddAnimation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 1, TargetProperty::OPACITY));
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| std::unique_ptr<Animation> to_add(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f)),
|
| 2, TargetProperty::OPACITY));
|
| - animations->AbortAnimations(TargetProperty::OPACITY);
|
| - animations->AddAnimation(std::move(to_add));
|
| + player_->AbortAnimations(TargetProperty::OPACITY, false);
|
| + player_->AddAnimation(std::move(to_add));
|
|
|
| // Since the previous animation was aborted, the new animation should start
|
| // right in this call to animate.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(500));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1500));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1500));
|
| + element_animations_->UpdateState(true, events.get());
|
| EXPECT_EQ(0.5f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| }
|
|
|
| // Tests scheduling two animations to run together when only one property is
|
| @@ -1415,34 +1373,34 @@ TEST_F(ElementAnimationsTest, ScheduleTogetherWhenAPropertyIsBlocked) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| - animations->AddAnimation(CreateAnimation(
|
| + player_->AddAnimation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1)), 1,
|
| TargetProperty::TRANSFORM));
|
| - animations->AddAnimation(CreateAnimation(
|
| + player_->AddAnimation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1)), 2,
|
| TargetProperty::TRANSFORM));
|
| - animations->AddAnimation(CreateAnimation(
|
| + player_->AddAnimation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 2, TargetProperty::OPACITY));
|
|
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, events.get());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->UpdateState(true, events.get());
|
| // Should not have started the float transition yet.
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| // The float animation should have started at time 1 and should be done.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_->UpdateState(true, events.get());
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| }
|
|
|
| // Tests scheduling two animations to run together with different lengths and
|
| @@ -1452,40 +1410,40 @@ TEST_F(ElementAnimationsTest, ScheduleTogetherWithAnAnimWaiting) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| - animations->AddAnimation(CreateAnimation(
|
| + player_->AddAnimation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeTransformTransition(2)), 1,
|
| TargetProperty::TRANSFORM));
|
| - animations->AddAnimation(CreateAnimation(
|
| + player_->AddAnimation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 1, TargetProperty::OPACITY));
|
| - animations->AddAnimation(CreateAnimation(
|
| + player_->AddAnimation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f)),
|
| 2, TargetProperty::OPACITY));
|
|
|
| // Animations with id 1 should both start now.
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| // The opacity animation should have finished at time 1, but the group
|
| // of animations with id 1 don't finish until time 2 because of the length
|
| // of the transform animation.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_->UpdateState(true, events.get());
|
| // Should not have started the float transition yet.
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| // The second opacity animation should start at time 2 and should be done by
|
| // time 3.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(3000));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(3000));
|
| + element_animations_->UpdateState(true, events.get());
|
| EXPECT_EQ(0.5f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| }
|
|
|
| // Test that a looping animation loops and for the correct number of iterations.
|
| @@ -1493,44 +1451,48 @@ TEST_F(ElementAnimationsTest, TrivialLooping) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| std::unique_ptr<Animation> to_add(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 1, TargetProperty::OPACITY));
|
| to_add->set_iterations(3);
|
| - animations->AddAnimation(std::move(to_add));
|
| + player_->AddAnimation(std::move(to_add));
|
|
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1250));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1250));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.25f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1750));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1750));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.75f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2250));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2250));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.25f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2750));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2750));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.75f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(3000));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(3000));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| // Just be extra sure.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(4000));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(4000));
|
| + element_animations_->UpdateState(true, events.get());
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| }
|
|
|
| @@ -1539,45 +1501,45 @@ TEST_F(ElementAnimationsTest, InfiniteLooping) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| std::unique_ptr<Animation> to_add(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 1, TargetProperty::OPACITY));
|
| to_add->set_iterations(-1);
|
| - animations->AddAnimation(std::move(to_add));
|
| + player_->AddAnimation(std::move(to_add));
|
|
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1250));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1250));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.25f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1750));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1750));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.75f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - animations->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(1073741824250));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1073741824250));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.25f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(1073741824750));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1073741824750));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.75f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - EXPECT_TRUE(animations->GetAnimation(TargetProperty::OPACITY));
|
| - animations->GetAnimation(TargetProperty::OPACITY)
|
| + EXPECT_TRUE(player_->GetAnimation(TargetProperty::OPACITY));
|
| + player_->GetAnimation(TargetProperty::OPACITY)
|
| ->SetRunState(Animation::ABORTED,
|
| kInitialTickTime + TimeDelta::FromMilliseconds(750));
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.75f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| }
|
|
|
| @@ -1586,45 +1548,47 @@ TEST_F(ElementAnimationsTest, PauseResume) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| - animations->AddAnimation(CreateAnimation(
|
| + player_->AddAnimation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 1, TargetProperty::OPACITY));
|
|
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(500));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.5f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - EXPECT_TRUE(animations->GetAnimation(TargetProperty::OPACITY));
|
| - animations->GetAnimation(TargetProperty::OPACITY)
|
| + EXPECT_TRUE(player_->GetAnimation(TargetProperty::OPACITY));
|
| + player_->GetAnimation(TargetProperty::OPACITY)
|
| ->SetRunState(Animation::PAUSED,
|
| kInitialTickTime + TimeDelta::FromMilliseconds(500));
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1024000));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1024000));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.5f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - EXPECT_TRUE(animations->GetAnimation(TargetProperty::OPACITY));
|
| - animations->GetAnimation(TargetProperty::OPACITY)
|
| + EXPECT_TRUE(player_->GetAnimation(TargetProperty::OPACITY));
|
| + player_->GetAnimation(TargetProperty::OPACITY)
|
| ->SetRunState(Animation::RUNNING,
|
| kInitialTickTime + TimeDelta::FromMilliseconds(1024000));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1024250));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1024250));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.75f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1024500));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1024500));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| }
|
|
|
| @@ -1632,41 +1596,42 @@ TEST_F(ElementAnimationsTest, AbortAGroupedAnimation) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| const int animation_id = 2;
|
| - animations->AddAnimation(Animation::Create(
|
| + player_->AddAnimation(Animation::Create(
|
| std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1)), 1, 1,
|
| TargetProperty::TRANSFORM));
|
| - animations->AddAnimation(Animation::Create(
|
| + player_->AddAnimation(Animation::Create(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(2.0, 0.f, 1.f)),
|
| animation_id, 1, TargetProperty::OPACITY));
|
| - animations->AddAnimation(Animation::Create(
|
| + player_->AddAnimation(Animation::Create(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.75f)),
|
| 3, 2, TargetProperty::OPACITY));
|
|
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.5f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - EXPECT_TRUE(animations->GetAnimationById(animation_id));
|
| - animations->GetAnimationById(animation_id)
|
| + EXPECT_TRUE(player_->GetAnimationById(animation_id));
|
| + player_->GetAnimationById(animation_id)
|
| ->SetRunState(Animation::ABORTED,
|
| kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000));
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(!animations->HasActiveAnimation());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(!player_->HasActiveAnimation());
|
| EXPECT_EQ(0.75f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| }
|
|
|
| @@ -1675,30 +1640,26 @@ TEST_F(ElementAnimationsTest, PushUpdatesWhenSynchronizedStartTimeNeeded) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| std::unique_ptr<Animation> to_add(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(2.0, 0.f, 1.f)),
|
| 0, TargetProperty::OPACITY));
|
| to_add->set_needs_synchronized_start_time(true);
|
| - animations->AddAnimation(std::move(to_add));
|
| + player_->AddAnimation(std::move(to_add));
|
|
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, events.get());
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| - Animation* active_animation =
|
| - animations->GetAnimation(TargetProperty::OPACITY);
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, events.get());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| + Animation* active_animation = player_->GetAnimation(TargetProperty::OPACITY);
|
| EXPECT_TRUE(active_animation);
|
| EXPECT_TRUE(active_animation->needs_synchronized_start_time());
|
|
|
| - EXPECT_TRUE(animations->needs_push_properties());
|
| + EXPECT_TRUE(player_->needs_push_properties());
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
|
|
| - active_animation = animations_impl->GetAnimation(TargetProperty::OPACITY);
|
| + active_animation = player_impl_->GetAnimation(TargetProperty::OPACITY);
|
| EXPECT_TRUE(active_animation);
|
| EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| active_animation->run_state());
|
| @@ -1709,46 +1670,47 @@ TEST_F(ElementAnimationsTest, SkipUpdateState) {
|
| CreateTestLayer(true, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| std::unique_ptr<Animation> first_animation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1)), 1,
|
| TargetProperty::TRANSFORM));
|
| first_animation->set_is_controlling_instance_for_test(true);
|
| - animations->AddAnimation(std::move(first_animation));
|
| + player_->AddAnimation(std::move(first_animation));
|
|
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, events.get());
|
|
|
| std::unique_ptr<Animation> second_animation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 2, TargetProperty::OPACITY));
|
| second_animation->set_is_controlling_instance_for_test(true);
|
| - animations->AddAnimation(std::move(second_animation));
|
| + player_->AddAnimation(std::move(second_animation));
|
|
|
| // Animate but don't UpdateState.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| events = host_impl_->CreateEvents();
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->UpdateState(true, events.get());
|
|
|
| // Should have one STARTED event and one FINISHED event.
|
| EXPECT_EQ(2u, events->events_.size());
|
| EXPECT_NE(events->events_[0].type, events->events_[1].type);
|
|
|
| // The float transition should still be at its starting point.
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(3000));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(3000));
|
| + element_animations_->UpdateState(true, events.get());
|
|
|
| // The float tranisition should now be done.
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->HasActiveAnimation());
|
| }
|
|
|
| // Tests that an animation animations with only a pending observer gets ticked
|
| @@ -1757,43 +1719,43 @@ TEST_F(ElementAnimationsTest, InactiveObserverGetsTicked) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| const int id = 1;
|
| - animations->AddAnimation(CreateAnimation(
|
| + player_impl_->AddAnimation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.5f, 1.f)),
|
| id, TargetProperty::OPACITY));
|
|
|
| // Without an observer, the animation shouldn't progress to the STARTING
|
| // state.
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_EQ(0u, events->events_.size());
|
| EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| - animations->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + player_impl_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
|
|
| CreateTestImplLayer(ElementListType::PENDING);
|
|
|
| // With only a pending observer, the animation should progress to the
|
| // STARTING state and get ticked at its starting point, but should not
|
| // progress to RUNNING.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_EQ(0u, events->events_.size());
|
| EXPECT_EQ(Animation::STARTING,
|
| - animations->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + player_impl_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| EXPECT_EQ(0.5f,
|
| client_impl_.GetOpacity(element_id_, ElementListType::PENDING));
|
|
|
| // Even when already in the STARTING state, the animation should stay
|
| // there, and shouldn't be ticked past its starting point.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_EQ(0u, events->events_.size());
|
| EXPECT_EQ(Animation::STARTING,
|
| - animations->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + player_impl_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| EXPECT_EQ(0.5f,
|
| client_impl_.GetOpacity(element_id_, ElementListType::PENDING));
|
|
|
| @@ -1801,18 +1763,20 @@ TEST_F(ElementAnimationsTest, InactiveObserverGetsTicked) {
|
|
|
| // Now that an active observer has been added, the animation should still
|
| // initially tick at its starting point, but should now progress to RUNNING.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(3000));
|
| - animations->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(3000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_EQ(1u, events->events_.size());
|
| EXPECT_EQ(Animation::RUNNING,
|
| - animations->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + player_impl_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| EXPECT_EQ(0.5f,
|
| client_impl_.GetOpacity(element_id_, ElementListType::PENDING));
|
| EXPECT_EQ(0.5f,
|
| client_impl_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| // The animation should now tick past its starting point.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(3500));
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(3500));
|
| EXPECT_NE(0.5f,
|
| client_impl_.GetOpacity(element_id_, ElementListType::PENDING));
|
| EXPECT_NE(0.5f,
|
| @@ -1823,8 +1787,6 @@ TEST_F(ElementAnimationsTest, TransformAnimationBounds) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| std::unique_ptr<KeyframedTransformAnimationCurve> curve1(
|
| KeyframedTransformAnimationCurve::Create());
|
|
|
| @@ -1837,7 +1799,7 @@ TEST_F(ElementAnimationsTest, TransformAnimationBounds) {
|
|
|
| std::unique_ptr<Animation> animation(
|
| Animation::Create(std::move(curve1), 1, 1, TargetProperty::TRANSFORM));
|
| - animations_impl->AddAnimation(std::move(animation));
|
| + player_impl_->AddAnimation(std::move(animation));
|
|
|
| std::unique_ptr<KeyframedTransformAnimationCurve> curve2(
|
| KeyframedTransformAnimationCurve::Create());
|
| @@ -1851,28 +1813,28 @@ TEST_F(ElementAnimationsTest, TransformAnimationBounds) {
|
|
|
| animation =
|
| Animation::Create(std::move(curve2), 2, 2, TargetProperty::TRANSFORM);
|
| - animations_impl->AddAnimation(std::move(animation));
|
| + player_impl_->AddAnimation(std::move(animation));
|
|
|
| gfx::BoxF box(1.f, 2.f, -1.f, 3.f, 4.f, 5.f);
|
| gfx::BoxF bounds;
|
|
|
| - EXPECT_TRUE(animations_impl->TransformAnimationBoundsForBox(box, &bounds));
|
| + EXPECT_TRUE(player_impl_->TransformAnimationBoundsForBox(box, &bounds));
|
| EXPECT_EQ(gfx::BoxF(1.f, 2.f, -4.f, 13.f, 19.f, 20.f).ToString(),
|
| bounds.ToString());
|
|
|
| - animations_impl->GetAnimationById(1)->SetRunState(Animation::FINISHED,
|
| - TicksFromSecondsF(0.0));
|
| + player_impl_->GetAnimationById(1)->SetRunState(Animation::FINISHED,
|
| + TicksFromSecondsF(0.0));
|
|
|
| // Only the unfinished animation should affect the animated bounds.
|
| - EXPECT_TRUE(animations_impl->TransformAnimationBoundsForBox(box, &bounds));
|
| + EXPECT_TRUE(player_impl_->TransformAnimationBoundsForBox(box, &bounds));
|
| EXPECT_EQ(gfx::BoxF(1.f, 2.f, -4.f, 7.f, 16.f, 20.f).ToString(),
|
| bounds.ToString());
|
|
|
| - animations_impl->GetAnimationById(2)->SetRunState(Animation::FINISHED,
|
| - TicksFromSecondsF(0.0));
|
| + player_impl_->GetAnimationById(2)->SetRunState(Animation::FINISHED,
|
| + TicksFromSecondsF(0.0));
|
|
|
| // There are no longer any running animations.
|
| - EXPECT_FALSE(animations_impl->HasTransformAnimationThatInflatesBounds());
|
| + EXPECT_FALSE(player_impl_->HasTransformAnimationThatInflatesBounds());
|
|
|
| // Add an animation whose bounds we don't yet support computing.
|
| std::unique_ptr<KeyframedTransformAnimationCurve> curve3(
|
| @@ -1887,8 +1849,8 @@ TEST_F(ElementAnimationsTest, TransformAnimationBounds) {
|
| base::TimeDelta::FromSecondsD(1.0), operations3, nullptr));
|
| animation =
|
| Animation::Create(std::move(curve3), 3, 3, TargetProperty::TRANSFORM);
|
| - animations_impl->AddAnimation(std::move(animation));
|
| - EXPECT_FALSE(animations_impl->TransformAnimationBoundsForBox(box, &bounds));
|
| + player_impl_->AddAnimation(std::move(animation));
|
| + EXPECT_FALSE(player_impl_->TransformAnimationBoundsForBox(box, &bounds));
|
| }
|
|
|
| // Tests that AbortAnimations aborts all animations targeting the specified
|
| @@ -1897,46 +1859,45 @@ TEST_F(ElementAnimationsTest, AbortAnimations) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| // Start with several animations, and allow some of them to reach the finished
|
| // state.
|
| - animations->AddAnimation(Animation::Create(
|
| + player_->AddAnimation(Animation::Create(
|
| std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 1, 1,
|
| TargetProperty::TRANSFORM));
|
| - animations->AddAnimation(Animation::Create(
|
| + player_->AddAnimation(Animation::Create(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 2, 2, TargetProperty::OPACITY));
|
| - animations->AddAnimation(Animation::Create(
|
| + player_->AddAnimation(Animation::Create(
|
| std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 3, 3,
|
| TargetProperty::TRANSFORM));
|
| - animations->AddAnimation(Animation::Create(
|
| + player_->AddAnimation(Animation::Create(
|
| std::unique_ptr<AnimationCurve>(new FakeTransformTransition(2.0)), 4, 4,
|
| TargetProperty::TRANSFORM));
|
| - animations->AddAnimation(Animation::Create(
|
| + player_->AddAnimation(Animation::Create(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 5, 5, TargetProperty::OPACITY));
|
|
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, nullptr);
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->UpdateState(true, nullptr);
|
|
|
| - EXPECT_EQ(Animation::FINISHED, animations->GetAnimationById(1)->run_state());
|
| - EXPECT_EQ(Animation::FINISHED, animations->GetAnimationById(2)->run_state());
|
| - EXPECT_EQ(Animation::RUNNING, animations->GetAnimationById(3)->run_state());
|
| + EXPECT_EQ(Animation::FINISHED, player_->GetAnimationById(1)->run_state());
|
| + EXPECT_EQ(Animation::FINISHED, player_->GetAnimationById(2)->run_state());
|
| + EXPECT_EQ(Animation::RUNNING, player_->GetAnimationById(3)->run_state());
|
| EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| - animations->GetAnimationById(4)->run_state());
|
| - EXPECT_EQ(Animation::RUNNING, animations->GetAnimationById(5)->run_state());
|
| + player_->GetAnimationById(4)->run_state());
|
| + EXPECT_EQ(Animation::RUNNING, player_->GetAnimationById(5)->run_state());
|
|
|
| - animations->AbortAnimations(TargetProperty::TRANSFORM);
|
| + player_->AbortAnimations(TargetProperty::TRANSFORM, false);
|
|
|
| // Only un-finished TRANSFORM animations should have been aborted.
|
| - EXPECT_EQ(Animation::FINISHED, animations->GetAnimationById(1)->run_state());
|
| - EXPECT_EQ(Animation::FINISHED, animations->GetAnimationById(2)->run_state());
|
| - EXPECT_EQ(Animation::ABORTED, animations->GetAnimationById(3)->run_state());
|
| - EXPECT_EQ(Animation::ABORTED, animations->GetAnimationById(4)->run_state());
|
| - EXPECT_EQ(Animation::RUNNING, animations->GetAnimationById(5)->run_state());
|
| + EXPECT_EQ(Animation::FINISHED, player_->GetAnimationById(1)->run_state());
|
| + EXPECT_EQ(Animation::FINISHED, player_->GetAnimationById(2)->run_state());
|
| + EXPECT_EQ(Animation::ABORTED, player_->GetAnimationById(3)->run_state());
|
| + EXPECT_EQ(Animation::ABORTED, player_->GetAnimationById(4)->run_state());
|
| + EXPECT_EQ(Animation::RUNNING, player_->GetAnimationById(5)->run_state());
|
| }
|
|
|
| // An animation aborted on the main thread should get deleted on both threads.
|
| @@ -1945,31 +1906,28 @@ TEST_F(ElementAnimationsTest, MainThreadAbortedAnimationGetsDeleted) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| int animation_id =
|
| AddOpacityTransitionToPlayer(player_.get(), 1.0, 0.f, 1.f, false);
|
| EXPECT_TRUE(host_->needs_push_properties());
|
|
|
| PushProperties();
|
|
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
|
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id));
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(animation_id));
|
| EXPECT_FALSE(host_->needs_push_properties());
|
|
|
| - animations->AbortAnimations(TargetProperty::OPACITY);
|
| + player_->AbortAnimations(TargetProperty::OPACITY, false);
|
| EXPECT_EQ(Animation::ABORTED,
|
| - animations->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + player_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| EXPECT_TRUE(host_->needs_push_properties());
|
|
|
| - animations->Animate(kInitialTickTime);
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime);
|
| + element_animations_->UpdateState(true, nullptr);
|
| EXPECT_EQ(Animation::ABORTED,
|
| - animations->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + player_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
|
|
| - EXPECT_TRUE(animations->needs_push_properties());
|
| + EXPECT_TRUE(player_->needs_push_properties());
|
| EXPECT_TRUE(player_->needs_push_properties());
|
| EXPECT_TRUE(host_->needs_push_properties());
|
|
|
| @@ -1977,8 +1935,8 @@ TEST_F(ElementAnimationsTest, MainThreadAbortedAnimationGetsDeleted) {
|
| EXPECT_FALSE(host_->needs_push_properties());
|
| EXPECT_FALSE(player_->needs_push_properties());
|
|
|
| - EXPECT_FALSE(animations->GetAnimationById(animation_id));
|
| - EXPECT_FALSE(animations_impl->GetAnimationById(animation_id));
|
| + EXPECT_FALSE(player_->GetAnimationById(animation_id));
|
| + EXPECT_FALSE(player_impl_->GetAnimationById(animation_id));
|
| }
|
|
|
| // An animation aborted on the impl thread should get deleted on both threads.
|
| @@ -1987,54 +1945,50 @@ TEST_F(ElementAnimationsTest, ImplThreadAbortedAnimationGetsDeleted) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| TestAnimationDelegate delegate;
|
| player_->set_animation_delegate(&delegate);
|
|
|
| - int animation_id = AddOpacityTransitionToElementAnimations(
|
| - animations.get(), 1.0, 0.f, 1.f, false);
|
| + int animation_id =
|
| + AddOpacityTransitionToPlayer(player_.get(), 1.0, 0.f, 1.f, false);
|
|
|
| PushProperties();
|
| EXPECT_FALSE(host_->needs_push_properties());
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id));
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(animation_id));
|
|
|
| - animations_impl->AbortAnimations(TargetProperty::OPACITY);
|
| - EXPECT_EQ(
|
| - Animation::ABORTED,
|
| - animations_impl->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + player_impl_->AbortAnimations(TargetProperty::OPACITY, false);
|
| + EXPECT_EQ(Animation::ABORTED,
|
| + player_impl_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| EXPECT_TRUE(host_impl_->needs_push_properties());
|
| EXPECT_TRUE(player_impl_->needs_push_properties());
|
|
|
| auto events = host_impl_->CreateEvents();
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_TRUE(host_impl_->needs_push_properties());
|
| EXPECT_EQ(1u, events->events_.size());
|
| EXPECT_EQ(AnimationEvent::ABORTED, events->events_[0].type);
|
| - EXPECT_EQ(
|
| - Animation::WAITING_FOR_DELETION,
|
| - animations_impl->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + EXPECT_EQ(Animation::WAITING_FOR_DELETION,
|
| + player_impl_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
|
|
| - animations->NotifyAnimationAborted(events->events_[0]);
|
| + player_->NotifyAnimationAborted(events->events_[0]);
|
| EXPECT_EQ(Animation::ABORTED,
|
| - animations->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + player_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| EXPECT_TRUE(delegate.aborted());
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(500));
|
| + element_animations_->UpdateState(true, nullptr);
|
| EXPECT_TRUE(host_->needs_push_properties());
|
| EXPECT_EQ(Animation::WAITING_FOR_DELETION,
|
| - animations->GetAnimation(TargetProperty::OPACITY)->run_state());
|
| + player_->GetAnimation(TargetProperty::OPACITY)->run_state());
|
|
|
| PushProperties();
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations->GetAnimationById(animation_id));
|
| - EXPECT_FALSE(animations_impl->GetAnimationById(animation_id));
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_FALSE(player_->GetAnimationById(animation_id));
|
| + EXPECT_FALSE(player_impl_->GetAnimationById(animation_id));
|
| }
|
|
|
| // Test that an impl-only scroll offset animation that needs to be completed on
|
| @@ -2044,9 +1998,6 @@ TEST_F(ElementAnimationsTest, ImplThreadTakeoverAnimationGetsDeleted) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| TestAnimationDelegate delegate_impl;
|
| player_impl_->set_animation_delegate(&delegate_impl);
|
| TestAnimationDelegate delegate;
|
| @@ -2065,25 +2016,23 @@ TEST_F(ElementAnimationsTest, ImplThreadTakeoverAnimationGetsDeleted) {
|
| std::move(curve), animation_id, 0, TargetProperty::SCROLL_OFFSET));
|
| animation->set_start_time(TicksFromSecondsF(123));
|
| animation->set_is_impl_only(true);
|
| - animations_impl->AddAnimation(std::move(animation));
|
| + player_impl_->AddAnimation(std::move(animation));
|
|
|
| PushProperties();
|
| EXPECT_FALSE(host_->needs_push_properties());
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id));
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(animation_id));
|
|
|
| - const bool needs_completion = true;
|
| - animations_impl->AbortAnimations(TargetProperty::SCROLL_OFFSET,
|
| - needs_completion);
|
| + player_impl_->AbortAnimations(TargetProperty::SCROLL_OFFSET, true);
|
| EXPECT_TRUE(host_impl_->needs_push_properties());
|
| - EXPECT_EQ(Animation::ABORTED_BUT_NEEDS_COMPLETION,
|
| - animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| - ->run_state());
|
| + EXPECT_EQ(
|
| + Animation::ABORTED_BUT_NEEDS_COMPLETION,
|
| + player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)->run_state());
|
|
|
| auto events = host_impl_->CreateEvents();
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_TRUE(delegate_impl.finished());
|
| EXPECT_TRUE(host_impl_->needs_push_properties());
|
| EXPECT_EQ(1u, events->events_.size());
|
| @@ -2092,25 +2041,25 @@ TEST_F(ElementAnimationsTest, ImplThreadTakeoverAnimationGetsDeleted) {
|
| EXPECT_EQ(
|
| target_value,
|
| events->events_[0].curve->ToScrollOffsetAnimationCurve()->target_value());
|
| - EXPECT_EQ(Animation::WAITING_FOR_DELETION,
|
| - animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET)
|
| - ->run_state());
|
| + EXPECT_EQ(
|
| + Animation::WAITING_FOR_DELETION,
|
| + player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)->run_state());
|
|
|
| // MT receives the event to take over.
|
| - animations->NotifyAnimationTakeover(events->events_[0]);
|
| + player_->NotifyAnimationTakeover(events->events_[0]);
|
| EXPECT_TRUE(delegate.takeover());
|
|
|
| // AnimationPlayer::NotifyAnimationTakeover requests SetNeedsPushProperties
|
| // to purge CT animations marked for deletion.
|
| - EXPECT_TRUE(animations->needs_push_properties());
|
| + EXPECT_TRUE(player_->needs_push_properties());
|
|
|
| // ElementAnimations::PurgeAnimationsMarkedForDeletion call happens only in
|
| // ElementAnimations::PushPropertiesTo.
|
| PushProperties();
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations->GetAnimationById(animation_id));
|
| - EXPECT_FALSE(animations_impl->GetAnimationById(animation_id));
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_FALSE(player_->GetAnimationById(animation_id));
|
| + EXPECT_FALSE(player_impl_->GetAnimationById(animation_id));
|
| }
|
|
|
| // Ensure that we only generate FINISHED events for animations in a group
|
| @@ -2120,8 +2069,6 @@ TEST_F(ElementAnimationsTest, FinishedEventsForGroup) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| const int group_id = 1;
|
| @@ -2131,16 +2078,16 @@ TEST_F(ElementAnimationsTest, FinishedEventsForGroup) {
|
| std::unique_ptr<AnimationCurve>(new FakeTransformTransition(2.0)), 1,
|
| group_id, TargetProperty::TRANSFORM));
|
| first_animation->set_is_controlling_instance_for_test(true);
|
| - animations_impl->AddAnimation(std::move(first_animation));
|
| + player_impl_->AddAnimation(std::move(first_animation));
|
|
|
| std::unique_ptr<Animation> second_animation(Animation::Create(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 2, group_id, TargetProperty::OPACITY));
|
| second_animation->set_is_controlling_instance_for_test(true);
|
| - animations_impl->AddAnimation(std::move(second_animation));
|
| + player_impl_->AddAnimation(std::move(second_animation));
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // Both animations should have started.
|
| EXPECT_EQ(2u, events->events_.size());
|
| @@ -2148,21 +2095,20 @@ TEST_F(ElementAnimationsTest, FinishedEventsForGroup) {
|
| EXPECT_EQ(AnimationEvent::STARTED, events->events_[1].type);
|
|
|
| events = host_impl_->CreateEvents();
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(1000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // The opacity animation should be finished, but should not have generated
|
| // a FINISHED event yet.
|
| EXPECT_EQ(0u, events->events_.size());
|
| EXPECT_EQ(Animation::FINISHED,
|
| - animations_impl->GetAnimationById(2)->run_state());
|
| - EXPECT_EQ(Animation::RUNNING,
|
| - animations_impl->GetAnimationById(1)->run_state());
|
| + player_impl_->GetAnimationById(2)->run_state());
|
| + EXPECT_EQ(Animation::RUNNING, player_impl_->GetAnimationById(1)->run_state());
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(2000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // Both animations should have generated FINISHED events.
|
| EXPECT_EQ(2u, events->events_.size());
|
| @@ -2178,8 +2124,6 @@ TEST_F(ElementAnimationsTest, FinishedAndAbortedEventsForGroup) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| // Add two animations with the same group id.
|
| @@ -2187,28 +2131,28 @@ TEST_F(ElementAnimationsTest, FinishedAndAbortedEventsForGroup) {
|
| std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 1,
|
| TargetProperty::TRANSFORM));
|
| first_animation->set_is_controlling_instance_for_test(true);
|
| - animations_impl->AddAnimation(std::move(first_animation));
|
| + player_impl_->AddAnimation(std::move(first_animation));
|
|
|
| std::unique_ptr<Animation> second_animation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 1, TargetProperty::OPACITY));
|
| second_animation->set_is_controlling_instance_for_test(true);
|
| - animations_impl->AddAnimation(std::move(second_animation));
|
| + player_impl_->AddAnimation(std::move(second_animation));
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // Both animations should have started.
|
| EXPECT_EQ(2u, events->events_.size());
|
| EXPECT_EQ(AnimationEvent::STARTED, events->events_[0].type);
|
| EXPECT_EQ(AnimationEvent::STARTED, events->events_[1].type);
|
|
|
| - animations_impl->AbortAnimations(TargetProperty::OPACITY);
|
| + player_impl_->AbortAnimations(TargetProperty::OPACITY, false);
|
|
|
| events = host_impl_->CreateEvents();
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(1000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // We should have exactly 2 events: a FINISHED event for the tranform
|
| // animation, and an ABORTED event for the opacity animation.
|
| @@ -2224,22 +2168,20 @@ TEST_F(ElementAnimationsTest, HasOnlyTranslationTransforms) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| EXPECT_TRUE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
| EXPECT_TRUE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
|
|
| - animations_impl->AddAnimation(CreateAnimation(
|
| + player_impl_->AddAnimation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 1, TargetProperty::OPACITY));
|
|
|
| // Opacity animations aren't non-translation transforms.
|
| EXPECT_TRUE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
| EXPECT_TRUE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
|
|
| std::unique_ptr<KeyframedTransformAnimationCurve> curve1(
|
| KeyframedTransformAnimationCurve::Create());
|
| @@ -2253,13 +2195,13 @@ TEST_F(ElementAnimationsTest, HasOnlyTranslationTransforms) {
|
|
|
| std::unique_ptr<Animation> animation(
|
| Animation::Create(std::move(curve1), 2, 2, TargetProperty::TRANSFORM));
|
| - animations_impl->AddAnimation(std::move(animation));
|
| + player_impl_->AddAnimation(std::move(animation));
|
|
|
| // The only transform animation we've added is a translation.
|
| EXPECT_TRUE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
| EXPECT_TRUE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
|
|
| std::unique_ptr<KeyframedTransformAnimationCurve> curve2(
|
| KeyframedTransformAnimationCurve::Create());
|
| @@ -2274,35 +2216,35 @@ TEST_F(ElementAnimationsTest, HasOnlyTranslationTransforms) {
|
| animation =
|
| Animation::Create(std::move(curve2), 3, 3, TargetProperty::TRANSFORM);
|
| animation->set_affects_active_elements(false);
|
| - animations_impl->AddAnimation(std::move(animation));
|
| + player_impl_->AddAnimation(std::move(animation));
|
|
|
| // A scale animation is not a translation.
|
| EXPECT_FALSE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
| EXPECT_TRUE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
| EXPECT_FALSE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
| EXPECT_FALSE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
|
|
| - animations_impl->GetAnimationById(3)->set_affects_pending_elements(false);
|
| + player_impl_->GetAnimationById(3)->set_affects_pending_elements(false);
|
| EXPECT_TRUE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
| EXPECT_FALSE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
|
|
| - animations_impl->GetAnimationById(3)->SetRunState(Animation::FINISHED,
|
| - TicksFromSecondsF(0.0));
|
| + player_impl_->GetAnimationById(3)->SetRunState(Animation::FINISHED,
|
| + TicksFromSecondsF(0.0));
|
|
|
| // Only unfinished animations should be considered by
|
| // HasOnlyTranslationTransforms.
|
| EXPECT_TRUE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::PENDING));
|
| EXPECT_TRUE(
|
| - animations_impl->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
| + player_impl_->HasOnlyTranslationTransforms(ElementListType::ACTIVE));
|
| }
|
|
|
| TEST_F(ElementAnimationsTest, AnimationStartScale) {
|
| @@ -2310,8 +2252,6 @@ TEST_F(ElementAnimationsTest, AnimationStartScale) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| std::unique_ptr<KeyframedTransformAnimationCurve> curve1(
|
| KeyframedTransformAnimationCurve::Create());
|
|
|
| @@ -2325,22 +2265,22 @@ TEST_F(ElementAnimationsTest, AnimationStartScale) {
|
| std::unique_ptr<Animation> animation(
|
| Animation::Create(std::move(curve1), 1, 1, TargetProperty::TRANSFORM));
|
| animation->set_affects_active_elements(false);
|
| - animations_impl->AddAnimation(std::move(animation));
|
| + player_impl_->AddAnimation(std::move(animation));
|
|
|
| float start_scale = 0.f;
|
| - EXPECT_TRUE(animations_impl->AnimationStartScale(ElementListType::PENDING,
|
| - &start_scale));
|
| + EXPECT_TRUE(player_impl_->AnimationStartScale(ElementListType::PENDING,
|
| + &start_scale));
|
| EXPECT_EQ(4.f, start_scale);
|
| - EXPECT_TRUE(animations_impl->AnimationStartScale(ElementListType::ACTIVE,
|
| - &start_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->AnimationStartScale(ElementListType::ACTIVE, &start_scale));
|
| EXPECT_EQ(0.f, start_scale);
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_TRUE(animations_impl->AnimationStartScale(ElementListType::PENDING,
|
| - &start_scale));
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_TRUE(player_impl_->AnimationStartScale(ElementListType::PENDING,
|
| + &start_scale));
|
| EXPECT_EQ(4.f, start_scale);
|
| - EXPECT_TRUE(animations_impl->AnimationStartScale(ElementListType::ACTIVE,
|
| - &start_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->AnimationStartScale(ElementListType::ACTIVE, &start_scale));
|
| EXPECT_EQ(4.f, start_scale);
|
|
|
| std::unique_ptr<KeyframedTransformAnimationCurve> curve2(
|
| @@ -2353,14 +2293,14 @@ TEST_F(ElementAnimationsTest, AnimationStartScale) {
|
| curve2->AddKeyframe(TransformKeyframe::Create(
|
| base::TimeDelta::FromSecondsD(1.0), operations3, nullptr));
|
|
|
| - animations_impl->RemoveAnimation(1);
|
| + player_impl_->RemoveAnimation(1);
|
| animation =
|
| Animation::Create(std::move(curve2), 2, 2, TargetProperty::TRANSFORM);
|
|
|
| // Reverse Direction
|
| animation->set_direction(Animation::Direction::REVERSE);
|
| animation->set_affects_active_elements(false);
|
| - animations_impl->AddAnimation(std::move(animation));
|
| + player_impl_->AddAnimation(std::move(animation));
|
|
|
| std::unique_ptr<KeyframedTransformAnimationCurve> curve3(
|
| KeyframedTransformAnimationCurve::Create());
|
| @@ -2376,33 +2316,33 @@ TEST_F(ElementAnimationsTest, AnimationStartScale) {
|
| animation =
|
| Animation::Create(std::move(curve3), 3, 3, TargetProperty::TRANSFORM);
|
| animation->set_affects_active_elements(false);
|
| - animations_impl->AddAnimation(std::move(animation));
|
| + player_impl_->AddAnimation(std::move(animation));
|
|
|
| - EXPECT_TRUE(animations_impl->AnimationStartScale(ElementListType::PENDING,
|
| - &start_scale));
|
| + EXPECT_TRUE(player_impl_->AnimationStartScale(ElementListType::PENDING,
|
| + &start_scale));
|
| EXPECT_EQ(6.f, start_scale);
|
| - EXPECT_TRUE(animations_impl->AnimationStartScale(ElementListType::ACTIVE,
|
| - &start_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->AnimationStartScale(ElementListType::ACTIVE, &start_scale));
|
| EXPECT_EQ(0.f, start_scale);
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_TRUE(animations_impl->AnimationStartScale(ElementListType::PENDING,
|
| - &start_scale));
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_TRUE(player_impl_->AnimationStartScale(ElementListType::PENDING,
|
| + &start_scale));
|
| EXPECT_EQ(6.f, start_scale);
|
| - EXPECT_TRUE(animations_impl->AnimationStartScale(ElementListType::ACTIVE,
|
| - &start_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->AnimationStartScale(ElementListType::ACTIVE, &start_scale));
|
| EXPECT_EQ(6.f, start_scale);
|
|
|
| - animations_impl->GetAnimationById(2)->SetRunState(Animation::FINISHED,
|
| - TicksFromSecondsF(0.0));
|
| + player_impl_->GetAnimationById(2)->SetRunState(Animation::FINISHED,
|
| + TicksFromSecondsF(0.0));
|
|
|
| // Only unfinished animations should be considered by
|
| // AnimationStartScale.
|
| - EXPECT_TRUE(animations_impl->AnimationStartScale(ElementListType::PENDING,
|
| - &start_scale));
|
| + EXPECT_TRUE(player_impl_->AnimationStartScale(ElementListType::PENDING,
|
| + &start_scale));
|
| EXPECT_EQ(5.f, start_scale);
|
| - EXPECT_TRUE(animations_impl->AnimationStartScale(ElementListType::ACTIVE,
|
| - &start_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->AnimationStartScale(ElementListType::ACTIVE, &start_scale));
|
| EXPECT_EQ(5.f, start_scale);
|
| }
|
|
|
| @@ -2411,14 +2351,12 @@ TEST_F(ElementAnimationsTest, MaximumTargetScale) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| float max_scale = 0.f;
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(0.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(0.f, max_scale);
|
|
|
| std::unique_ptr<KeyframedTransformAnimationCurve> curve1(
|
| @@ -2434,21 +2372,21 @@ TEST_F(ElementAnimationsTest, MaximumTargetScale) {
|
| std::unique_ptr<Animation> animation(
|
| Animation::Create(std::move(curve1), 1, 1, TargetProperty::TRANSFORM));
|
| animation->set_affects_active_elements(false);
|
| - animations_impl->AddAnimation(std::move(animation));
|
| + player_impl_->AddAnimation(std::move(animation));
|
|
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(4.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(0.f, max_scale);
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(4.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(4.f, max_scale);
|
|
|
| std::unique_ptr<KeyframedTransformAnimationCurve> curve2(
|
| @@ -2464,21 +2402,21 @@ TEST_F(ElementAnimationsTest, MaximumTargetScale) {
|
| animation =
|
| Animation::Create(std::move(curve2), 2, 2, TargetProperty::TRANSFORM);
|
| animation->set_affects_active_elements(false);
|
| - animations_impl->AddAnimation(std::move(animation));
|
| + player_impl_->AddAnimation(std::move(animation));
|
|
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(6.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(4.f, max_scale);
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(6.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(6.f, max_scale);
|
|
|
| std::unique_ptr<KeyframedTransformAnimationCurve> curve3(
|
| @@ -2494,32 +2432,32 @@ TEST_F(ElementAnimationsTest, MaximumTargetScale) {
|
| animation =
|
| Animation::Create(std::move(curve3), 3, 3, TargetProperty::TRANSFORM);
|
| animation->set_affects_active_elements(false);
|
| - animations_impl->AddAnimation(std::move(animation));
|
| + player_impl_->AddAnimation(std::move(animation));
|
|
|
| - EXPECT_FALSE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_FALSE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(6.f, max_scale);
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_FALSE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + player_impl_->ActivateAnimations();
|
| EXPECT_FALSE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| + EXPECT_FALSE(
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
|
|
| - animations_impl->GetAnimationById(3)->SetRunState(Animation::FINISHED,
|
| - TicksFromSecondsF(0.0));
|
| - animations_impl->GetAnimationById(2)->SetRunState(Animation::FINISHED,
|
| - TicksFromSecondsF(0.0));
|
| + player_impl_->GetAnimationById(3)->SetRunState(Animation::FINISHED,
|
| + TicksFromSecondsF(0.0));
|
| + player_impl_->GetAnimationById(2)->SetRunState(Animation::FINISHED,
|
| + TicksFromSecondsF(0.0));
|
|
|
| // Only unfinished animations should be considered by
|
| // MaximumTargetScale.
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(4.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(4.f, max_scale);
|
| }
|
|
|
| @@ -2528,8 +2466,6 @@ TEST_F(ElementAnimationsTest, MaximumTargetScaleWithDirection) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| std::unique_ptr<KeyframedTransformAnimationCurve> curve1(
|
| KeyframedTransformAnimationCurve::Create());
|
| TransformOperations operations1;
|
| @@ -2544,7 +2480,7 @@ TEST_F(ElementAnimationsTest, MaximumTargetScaleWithDirection) {
|
| std::unique_ptr<Animation> animation_owned(
|
| Animation::Create(std::move(curve1), 1, 1, TargetProperty::TRANSFORM));
|
| Animation* animation = animation_owned.get();
|
| - animations_impl->AddAnimation(std::move(animation_owned));
|
| + player_impl_->AddAnimation(std::move(animation_owned));
|
|
|
| float max_scale = 0.f;
|
|
|
| @@ -2552,76 +2488,76 @@ TEST_F(ElementAnimationsTest, MaximumTargetScaleWithDirection) {
|
|
|
| // NORMAL direction with positive playback rate.
|
| animation->set_direction(Animation::Direction::NORMAL);
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(6.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(6.f, max_scale);
|
|
|
| // ALTERNATE direction with positive playback rate.
|
| animation->set_direction(Animation::Direction::ALTERNATE_NORMAL);
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(6.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(6.f, max_scale);
|
|
|
| // REVERSE direction with positive playback rate.
|
| animation->set_direction(Animation::Direction::REVERSE);
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(3.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(3.f, max_scale);
|
|
|
| // ALTERNATE reverse direction.
|
| animation->set_direction(Animation::Direction::REVERSE);
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(3.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(3.f, max_scale);
|
|
|
| animation->set_playback_rate(-1.0);
|
|
|
| // NORMAL direction with negative playback rate.
|
| animation->set_direction(Animation::Direction::NORMAL);
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(3.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(3.f, max_scale);
|
|
|
| // ALTERNATE direction with negative playback rate.
|
| animation->set_direction(Animation::Direction::ALTERNATE_NORMAL);
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(3.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(3.f, max_scale);
|
|
|
| // REVERSE direction with negative playback rate.
|
| animation->set_direction(Animation::Direction::REVERSE);
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(6.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(6.f, max_scale);
|
|
|
| // ALTERNATE reverse direction with negative playback rate.
|
| animation->set_direction(Animation::Direction::REVERSE);
|
| - EXPECT_TRUE(animations_impl->MaximumTargetScale(ElementListType::PENDING,
|
| - &max_scale));
|
| + EXPECT_TRUE(
|
| + player_impl_->MaximumTargetScale(ElementListType::PENDING, &max_scale));
|
| EXPECT_EQ(6.f, max_scale);
|
| EXPECT_TRUE(
|
| - animations_impl->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| + player_impl_->MaximumTargetScale(ElementListType::ACTIVE, &max_scale));
|
| EXPECT_EQ(6.f, max_scale);
|
| }
|
|
|
| @@ -2630,36 +2566,33 @@ TEST_F(ElementAnimationsTest, NewlyPushedAnimationWaitsForActivation) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| - EXPECT_FALSE(animations->needs_to_start_animations_for_testing());
|
| - int animation_id = AddOpacityTransitionToElementAnimations(
|
| - animations.get(), 1, 0.5f, 1.f, false);
|
| - EXPECT_TRUE(animations->needs_to_start_animations_for_testing());
|
| + EXPECT_FALSE(player_->needs_to_start_animations());
|
| + int animation_id =
|
| + AddOpacityTransitionToPlayer(player_.get(), 1, 0.5f, 1.f, false);
|
| + EXPECT_TRUE(player_->needs_to_start_animations());
|
|
|
| - EXPECT_FALSE(animations_impl->needs_to_start_animations_for_testing());
|
| + EXPECT_FALSE(player_impl_->needs_to_start_animations());
|
| PushProperties();
|
| - EXPECT_TRUE(animations_impl->needs_to_start_animations_for_testing());
|
| + EXPECT_TRUE(player_impl_->needs_to_start_animations());
|
|
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id));
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(animation_id));
|
| EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id)
|
| - ->affects_pending_elements());
|
| - EXPECT_FALSE(animations_impl->GetAnimationById(animation_id)
|
| - ->affects_active_elements());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
| + EXPECT_TRUE(
|
| + player_impl_->GetAnimationById(animation_id)->affects_pending_elements());
|
| + EXPECT_FALSE(
|
| + player_impl_->GetAnimationById(animation_id)->affects_active_elements());
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| - EXPECT_FALSE(animations_impl->needs_to_start_animations_for_testing());
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + EXPECT_FALSE(player_impl_->needs_to_start_animations());
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // Since the animation hasn't been activated, it should still be STARTING
|
| // rather than RUNNING.
|
| EXPECT_EQ(Animation::STARTING,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
|
|
| // Since the animation hasn't been activated, only the pending observer
|
| // should have been ticked.
|
| @@ -2667,20 +2600,20 @@ TEST_F(ElementAnimationsTest, NewlyPushedAnimationWaitsForActivation) {
|
| client_impl_.GetOpacity(element_id_, ElementListType::PENDING));
|
| EXPECT_EQ(0.f, client_impl_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id)
|
| - ->affects_pending_elements());
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id)
|
| - ->affects_active_elements());
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_TRUE(
|
| + player_impl_->GetAnimationById(animation_id)->affects_pending_elements());
|
| + EXPECT_TRUE(
|
| + player_impl_->GetAnimationById(animation_id)->affects_active_elements());
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(1000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // Since the animation has been activated, it should have reached the
|
| // RUNNING state and the active observer should start to get ticked.
|
| EXPECT_EQ(Animation::RUNNING,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
| EXPECT_EQ(0.5f,
|
| client_impl_.GetOpacity(element_id_, ElementListType::PENDING));
|
| EXPECT_EQ(0.5f,
|
| @@ -2692,25 +2625,22 @@ TEST_F(ElementAnimationsTest, ActivationBetweenAnimateAndUpdateState) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| - const int animation_id = AddOpacityTransitionToElementAnimations(
|
| - animations.get(), 1, 0.5f, 1.f, true);
|
| + const int animation_id =
|
| + AddOpacityTransitionToPlayer(player_.get(), 1, 0.5f, 1.f, true);
|
|
|
| PushProperties();
|
|
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id));
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(animation_id));
|
| EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id)
|
| - ->affects_pending_elements());
|
| - EXPECT_FALSE(animations_impl->GetAnimationById(animation_id)
|
| - ->affects_active_elements());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
| + EXPECT_TRUE(
|
| + player_impl_->GetAnimationById(animation_id)->affects_pending_elements());
|
| + EXPECT_FALSE(
|
| + player_impl_->GetAnimationById(animation_id)->affects_active_elements());
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
|
|
| // Since the animation hasn't been activated, only the pending observer
|
| // should have been ticked.
|
| @@ -2718,20 +2648,21 @@ TEST_F(ElementAnimationsTest, ActivationBetweenAnimateAndUpdateState) {
|
| client_impl_.GetOpacity(element_id_, ElementListType::PENDING));
|
| EXPECT_EQ(0.f, client_impl_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id)
|
| - ->affects_pending_elements());
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id)
|
| - ->affects_active_elements());
|
| + player_impl_->ActivateAnimations();
|
| + EXPECT_TRUE(
|
| + player_impl_->GetAnimationById(animation_id)->affects_pending_elements());
|
| + EXPECT_TRUE(
|
| + player_impl_->GetAnimationById(animation_id)->affects_active_elements());
|
|
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // Since the animation has been activated, it should have reached the
|
| // RUNNING state.
|
| EXPECT_EQ(Animation::RUNNING,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
|
|
| - animations_impl->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(500));
|
|
|
| // Both elements should have been ticked.
|
| EXPECT_EQ(0.75f,
|
| @@ -2745,9 +2676,6 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| EXPECT_FALSE(client_.GetHasPotentialTransformAnimation(
|
| @@ -2764,7 +2692,7 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| // Case 1: An animation that's allowed to run until its finish point.
|
| - AddAnimatedTransformToElementAnimations(animations.get(), 1.0, 1, 1);
|
| + AddAnimatedTransformToPlayer(player_.get(), 1.0, 1, 1);
|
| EXPECT_TRUE(client_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_.GetTransformIsCurrentlyAnimating(
|
| @@ -2780,7 +2708,7 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_TRUE(client_impl_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::PENDING));
|
| EXPECT_TRUE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| @@ -2790,15 +2718,16 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {
|
| EXPECT_TRUE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
| events->events_.clear();
|
|
|
| // Finish the animation.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->UpdateState(true, nullptr);
|
| EXPECT_FALSE(client_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_.GetTransformIsCurrentlyAnimating(
|
| @@ -2816,9 +2745,9 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {
|
| EXPECT_TRUE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(1000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_FALSE(client_impl_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::PENDING));
|
| EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| @@ -2829,13 +2758,11 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| // Case 2: An animation that's removed before it finishes.
|
| - int animation_id =
|
| - AddAnimatedTransformToElementAnimations(animations.get(), 10.0, 2, 2);
|
| - int animation2_id =
|
| - AddAnimatedTransformToElementAnimations(animations.get(), 10.0, 2, 1);
|
| - animations->GetAnimationById(animation2_id)
|
| + int animation_id = AddAnimatedTransformToPlayer(player_.get(), 10.0, 2, 2);
|
| + int animation2_id = AddAnimatedTransformToPlayer(player_.get(), 10.0, 2, 1);
|
| + player_->GetAnimationById(animation2_id)
|
| ->set_time_offset(base::TimeDelta::FromMilliseconds(-10000));
|
| - animations->GetAnimationById(animation2_id)
|
| + player_->GetAnimationById(animation2_id)
|
| ->set_fill_mode(Animation::FillMode::NONE);
|
| EXPECT_TRUE(client_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| @@ -2852,7 +2779,7 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_TRUE(client_impl_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| // animation1 is in effect currently and animation2 isn't. As the element has
|
| @@ -2861,15 +2788,15 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {
|
| EXPECT_TRUE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(2000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
| events->events_.clear();
|
|
|
| - animations->RemoveAnimation(animation_id);
|
| - animations->RemoveAnimation(animation2_id);
|
| + player_->RemoveAnimation(animation_id);
|
| + player_->RemoveAnimation(animation2_id);
|
| EXPECT_FALSE(client_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_.GetTransformIsCurrentlyAnimating(
|
| @@ -2885,15 +2812,14 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {
|
| EXPECT_TRUE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_FALSE(client_impl_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| // Case 3: An animation that's aborted before it finishes.
|
| - animation_id =
|
| - AddAnimatedTransformToElementAnimations(animations.get(), 10.0, 3, 3);
|
| + animation_id = AddAnimatedTransformToPlayer(player_.get(), 10.0, 3, 3);
|
| EXPECT_TRUE(client_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_.GetTransformIsCurrentlyAnimating(
|
| @@ -2909,20 +2835,20 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_TRUE(client_impl_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(2000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
| events->events_.clear();
|
|
|
| - animations_impl->AbortAnimations(TargetProperty::TRANSFORM);
|
| + player_impl_->AbortAnimations(TargetProperty::TRANSFORM, false);
|
| EXPECT_FALSE(client_impl_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::PENDING));
|
| EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| @@ -2932,22 +2858,21 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(4000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(4000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - animations->NotifyAnimationAborted(events->events_[0]);
|
| + element_animations_->NotifyAnimationAborted(events->events_[0]);
|
| EXPECT_FALSE(client_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_.GetTransformIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| // Case 4 : An animation that's not in effect.
|
| - animation_id =
|
| - AddAnimatedTransformToElementAnimations(animations.get(), 1.0, 1, 6);
|
| - animations->GetAnimationById(animation_id)
|
| + animation_id = AddAnimatedTransformToPlayer(player_.get(), 1.0, 1, 6);
|
| + player_->GetAnimationById(animation_id)
|
| ->set_time_offset(base::TimeDelta::FromMilliseconds(-10000));
|
| - animations->GetAnimationById(animation_id)
|
| + player_->GetAnimationById(animation_id)
|
| ->set_fill_mode(Animation::FillMode::NONE);
|
|
|
| PushProperties();
|
| @@ -2960,7 +2885,7 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenTransformAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_TRUE(client_impl_.GetHasPotentialTransformAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating(
|
| @@ -2972,9 +2897,6 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenOpacityAnimationChanges) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| EXPECT_FALSE(client_.GetHasPotentialOpacityAnimation(
|
| @@ -2991,8 +2913,8 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenOpacityAnimationChanges) {
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| // Case 1: An animation that's allowed to run until its finish point.
|
| - AddOpacityTransitionToElementAnimations(animations.get(), 1.0, 0.f, 1.f,
|
| - false /*use_timing_function*/);
|
| + AddOpacityTransitionToPlayer(player_.get(), 1.0, 0.f, 1.f,
|
| + false /*use_timing_function*/);
|
| EXPECT_TRUE(client_.GetHasPotentialOpacityAnimation(element_id_,
|
| ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_.GetOpacityIsCurrentlyAnimating(element_id_,
|
| @@ -3008,7 +2930,7 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenOpacityAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_TRUE(client_impl_.GetHasPotentialOpacityAnimation(
|
| element_id_, ElementListType::PENDING));
|
| EXPECT_TRUE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| @@ -3018,15 +2940,16 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenOpacityAnimationChanges) {
|
| EXPECT_TRUE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
| events->events_.clear();
|
|
|
| // Finish the animation.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->UpdateState(true, nullptr);
|
| EXPECT_FALSE(client_.GetHasPotentialOpacityAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_.GetOpacityIsCurrentlyAnimating(element_id_,
|
| @@ -3044,9 +2967,9 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenOpacityAnimationChanges) {
|
| EXPECT_TRUE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(1000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_FALSE(client_impl_.GetHasPotentialOpacityAnimation(
|
| element_id_, ElementListType::PENDING));
|
| EXPECT_FALSE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| @@ -3057,8 +2980,8 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenOpacityAnimationChanges) {
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| // Case 2: An animation that's removed before it finishes.
|
| - int animation_id = AddOpacityTransitionToElementAnimations(
|
| - animations.get(), 10.0, 0.f, 1.f, false /*use_timing_function*/);
|
| + int animation_id = AddOpacityTransitionToPlayer(
|
| + player_.get(), 10.0, 0.f, 1.f, false /*use_timing_function*/);
|
| EXPECT_TRUE(client_.GetHasPotentialOpacityAnimation(element_id_,
|
| ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_.GetOpacityIsCurrentlyAnimating(element_id_,
|
| @@ -3074,20 +2997,20 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenOpacityAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_TRUE(client_impl_.GetHasPotentialOpacityAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(2000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
| events->events_.clear();
|
|
|
| - animations->RemoveAnimation(animation_id);
|
| + player_->RemoveAnimation(animation_id);
|
| EXPECT_FALSE(client_.GetHasPotentialOpacityAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_.GetOpacityIsCurrentlyAnimating(element_id_,
|
| @@ -3103,15 +3026,15 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenOpacityAnimationChanges) {
|
| EXPECT_TRUE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_FALSE(client_impl_.GetHasPotentialOpacityAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| // Case 3: An animation that's aborted before it finishes.
|
| - animation_id = AddOpacityTransitionToElementAnimations(
|
| - animations.get(), 10.0, 0.f, 0.5f, false /*use_timing_function*/);
|
| + animation_id = AddOpacityTransitionToPlayer(player_.get(), 10.0, 0.f, 0.5f,
|
| + false /*use_timing_function*/);
|
| EXPECT_TRUE(client_.GetHasPotentialOpacityAnimation(element_id_,
|
| ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_.GetOpacityIsCurrentlyAnimating(element_id_,
|
| @@ -3127,20 +3050,20 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenOpacityAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_TRUE(client_impl_.GetHasPotentialOpacityAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(2000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
| events->events_.clear();
|
|
|
| - animations_impl->AbortAnimations(TargetProperty::OPACITY);
|
| + player_impl_->AbortAnimations(TargetProperty::OPACITY, false);
|
| EXPECT_FALSE(client_impl_.GetHasPotentialOpacityAnimation(
|
| element_id_, ElementListType::PENDING));
|
| EXPECT_FALSE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| @@ -3150,22 +3073,22 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenOpacityAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(4000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(4000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - animations->NotifyAnimationAborted(events->events_[0]);
|
| + element_animations_->NotifyAnimationAborted(events->events_[0]);
|
| EXPECT_FALSE(client_.GetHasPotentialOpacityAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_.GetOpacityIsCurrentlyAnimating(element_id_,
|
| ElementListType::ACTIVE));
|
|
|
| // Case 4 : An animation that's not in effect.
|
| - animation_id = AddOpacityTransitionToElementAnimations(
|
| - animations.get(), 1.0, 0.f, 0.5f, false /*use_timing_function*/);
|
| - animations->GetAnimationById(animation_id)
|
| + animation_id = AddOpacityTransitionToPlayer(player_.get(), 1.0, 0.f, 0.5f,
|
| + false /*use_timing_function*/);
|
| + player_->GetAnimationById(animation_id)
|
| ->set_time_offset(base::TimeDelta::FromMilliseconds(-10000));
|
| - animations->GetAnimationById(animation_id)
|
| + player_->GetAnimationById(animation_id)
|
| ->set_fill_mode(Animation::FillMode::NONE);
|
|
|
| PushProperties();
|
| @@ -3178,7 +3101,7 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenOpacityAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_TRUE(client_impl_.GetHasPotentialOpacityAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_impl_.GetOpacityIsCurrentlyAnimating(
|
| @@ -3190,9 +3113,6 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenFilterAnimationChanges) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| EXPECT_FALSE(client_.GetHasPotentialFilterAnimation(element_id_,
|
| @@ -3209,7 +3129,7 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenFilterAnimationChanges) {
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| // Case 1: An animation that's allowed to run until its finish point.
|
| - AddAnimatedFilterToElementAnimations(animations.get(), 1.0, 0.f, 1.f);
|
| + AddAnimatedFilterToPlayer(player_.get(), 1.0, 0.f, 1.f);
|
| EXPECT_TRUE(client_.GetHasPotentialFilterAnimation(element_id_,
|
| ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_.GetFilterIsCurrentlyAnimating(element_id_,
|
| @@ -3225,7 +3145,7 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenFilterAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_TRUE(client_impl_.GetHasPotentialFilterAnimation(
|
| element_id_, ElementListType::PENDING));
|
| EXPECT_TRUE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| @@ -3235,15 +3155,16 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenFilterAnimationChanges) {
|
| EXPECT_TRUE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
| events->events_.clear();
|
|
|
| // Finish the animation.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->UpdateState(true, nullptr);
|
| EXPECT_FALSE(client_.GetHasPotentialFilterAnimation(element_id_,
|
| ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_.GetFilterIsCurrentlyAnimating(element_id_,
|
| @@ -3261,9 +3182,9 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenFilterAnimationChanges) {
|
| EXPECT_TRUE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(1000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_FALSE(client_impl_.GetHasPotentialFilterAnimation(
|
| element_id_, ElementListType::PENDING));
|
| EXPECT_FALSE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| @@ -3274,8 +3195,7 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenFilterAnimationChanges) {
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| // Case 2: An animation that's removed before it finishes.
|
| - int animation_id =
|
| - AddAnimatedFilterToElementAnimations(animations.get(), 10.0, 0.f, 1.f);
|
| + int animation_id = AddAnimatedFilterToPlayer(player_.get(), 10.0, 0.f, 1.f);
|
| EXPECT_TRUE(client_.GetHasPotentialFilterAnimation(element_id_,
|
| ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_.GetFilterIsCurrentlyAnimating(element_id_,
|
| @@ -3291,20 +3211,20 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenFilterAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_TRUE(client_impl_.GetHasPotentialFilterAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(2000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
| events->events_.clear();
|
|
|
| - animations->RemoveAnimation(animation_id);
|
| + player_->RemoveAnimation(animation_id);
|
| EXPECT_FALSE(client_.GetHasPotentialFilterAnimation(element_id_,
|
| ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_.GetFilterIsCurrentlyAnimating(element_id_,
|
| @@ -3320,15 +3240,14 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenFilterAnimationChanges) {
|
| EXPECT_TRUE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_FALSE(client_impl_.GetHasPotentialFilterAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| // Case 3: An animation that's aborted before it finishes.
|
| - animation_id =
|
| - AddAnimatedFilterToElementAnimations(animations.get(), 10.0, 0.f, 0.5f);
|
| + animation_id = AddAnimatedFilterToPlayer(player_.get(), 10.0, 0.f, 0.5f);
|
| EXPECT_TRUE(client_.GetHasPotentialFilterAnimation(element_id_,
|
| ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_.GetFilterIsCurrentlyAnimating(element_id_,
|
| @@ -3344,20 +3263,20 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenFilterAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_TRUE(client_impl_.GetHasPotentialFilterAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_TRUE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(2000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - animations->NotifyAnimationStarted(events->events_[0]);
|
| + player_->NotifyAnimationStarted(events->events_[0]);
|
| events->events_.clear();
|
|
|
| - animations_impl->AbortAnimations(TargetProperty::FILTER);
|
| + player_impl_->AbortAnimations(TargetProperty::FILTER, false);
|
| EXPECT_FALSE(client_impl_.GetHasPotentialFilterAnimation(
|
| element_id_, ElementListType::PENDING));
|
| EXPECT_FALSE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| @@ -3367,22 +3286,21 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenFilterAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(4000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(4000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| - animations->NotifyAnimationAborted(events->events_[0]);
|
| + element_animations_->NotifyAnimationAborted(events->events_[0]);
|
| EXPECT_FALSE(client_.GetHasPotentialFilterAnimation(element_id_,
|
| ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_.GetFilterIsCurrentlyAnimating(element_id_,
|
| ElementListType::ACTIVE));
|
|
|
| // Case 4 : An animation that's not in effect.
|
| - animation_id =
|
| - AddAnimatedFilterToElementAnimations(animations.get(), 1.0, 0.f, 0.5f);
|
| - animations->GetAnimationById(animation_id)
|
| + animation_id = AddAnimatedFilterToPlayer(player_.get(), 1.0, 0.f, 0.5f);
|
| + player_->GetAnimationById(animation_id)
|
| ->set_time_offset(base::TimeDelta::FromMilliseconds(-10000));
|
| - animations->GetAnimationById(animation_id)
|
| + player_->GetAnimationById(animation_id)
|
| ->set_fill_mode(Animation::FillMode::NONE);
|
|
|
| PushProperties();
|
| @@ -3395,7 +3313,7 @@ TEST_F(ElementAnimationsTest, ObserverNotifiedWhenFilterAnimationChanges) {
|
| EXPECT_FALSE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + element_animations_impl_->ActivateAnimations();
|
| EXPECT_TRUE(client_impl_.GetHasPotentialFilterAnimation(
|
| element_id_, ElementListType::ACTIVE));
|
| EXPECT_FALSE(client_impl_.GetFilterIsCurrentlyAnimating(
|
| @@ -3406,15 +3324,14 @@ TEST_F(ElementAnimationsTest, ClippedOpacityValues) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| + AddOpacityTransitionToPlayer(player_.get(), 1, 1.f, 2.f, true);
|
|
|
| - AddOpacityTransitionToElementAnimations(animations.get(), 1, 1.f, 2.f, true);
|
| -
|
| - animations->Animate(kInitialTickTime);
|
| + element_animations_->Animate(kInitialTickTime);
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| // Opacity values are clipped [0,1]
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| }
|
|
|
| @@ -3422,15 +3339,14 @@ TEST_F(ElementAnimationsTest, ClippedNegativeOpacityValues) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| - AddOpacityTransitionToElementAnimations(animations.get(), 1, 0.f, -2.f, true);
|
| + AddOpacityTransitionToPlayer(player_.get(), 1, 0.f, -2.f, true);
|
|
|
| - animations->Animate(kInitialTickTime);
|
| + element_animations_->Animate(kInitialTickTime);
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| // Opacity values are clipped [0,1]
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| }
|
|
|
| @@ -3439,43 +3355,41 @@ TEST_F(ElementAnimationsTest, PushedDeletedAnimationWaitsForActivation) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| - const int animation_id = AddOpacityTransitionToElementAnimations(
|
| - animations.get(), 1, 0.5f, 1.f, true);
|
| + const int animation_id =
|
| + AddOpacityTransitionToPlayer(player_.get(), 1, 0.5f, 1.f, true);
|
|
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + player_impl_->ActivateAnimations();
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
| EXPECT_EQ(Animation::RUNNING,
|
| - animations_impl->GetAnimationById(animation_id)->run_state());
|
| + player_impl_->GetAnimationById(animation_id)->run_state());
|
| EXPECT_EQ(0.5f,
|
| client_impl_.GetOpacity(element_id_, ElementListType::PENDING));
|
| EXPECT_EQ(0.5f,
|
| client_impl_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id)
|
| - ->affects_pending_elements());
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id)
|
| - ->affects_active_elements());
|
| + EXPECT_TRUE(
|
| + player_impl_->GetAnimationById(animation_id)->affects_pending_elements());
|
| + EXPECT_TRUE(
|
| + player_impl_->GetAnimationById(animation_id)->affects_active_elements());
|
|
|
| // Delete the animation on the main-thread animations.
|
| - animations->RemoveAnimation(
|
| - animations->GetAnimation(TargetProperty::OPACITY)->id());
|
| + player_->RemoveAnimation(
|
| + player_->GetAnimation(TargetProperty::OPACITY)->id());
|
| PushProperties();
|
|
|
| // The animation should no longer affect pending elements.
|
| - EXPECT_FALSE(animations_impl->GetAnimationById(animation_id)
|
| - ->affects_pending_elements());
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(animation_id)
|
| - ->affects_active_elements());
|
| + EXPECT_FALSE(
|
| + player_impl_->GetAnimationById(animation_id)->affects_pending_elements());
|
| + EXPECT_TRUE(
|
| + player_impl_->GetAnimationById(animation_id)->affects_active_elements());
|
|
|
| - animations_impl->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(500));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // Only the active observer should have been ticked.
|
| EXPECT_EQ(0.5f,
|
| @@ -3483,10 +3397,10 @@ TEST_F(ElementAnimationsTest, PushedDeletedAnimationWaitsForActivation) {
|
| EXPECT_EQ(0.75f,
|
| client_impl_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
|
|
| // Activation should cause the animation to be deleted.
|
| - EXPECT_FALSE(animations_impl->HasAnyAnimation());
|
| + EXPECT_FALSE(player_impl_->has_any_animation());
|
| }
|
|
|
| // Tests that an animation that affects only active elements won't block
|
| @@ -3496,48 +3410,45 @@ TEST_F(ElementAnimationsTest, StartAnimationsAffectingDifferentObservers) {
|
| AttachTimelinePlayerLayer();
|
| CreateImplTimelineAndPlayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| - scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
|
| -
|
| auto events = host_impl_->CreateEvents();
|
|
|
| - const int first_animation_id = AddOpacityTransitionToElementAnimations(
|
| - animations.get(), 1, 0.f, 1.f, true);
|
| + const int first_animation_id =
|
| + AddOpacityTransitionToPlayer(player_.get(), 1, 0.f, 1.f, true);
|
|
|
| PushProperties();
|
| - animations_impl->ActivateAnimations();
|
| - animations_impl->Animate(kInitialTickTime);
|
| - animations_impl->UpdateState(true, events.get());
|
| + player_impl_->ActivateAnimations();
|
| + element_animations_impl_->Animate(kInitialTickTime);
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // Remove the first animation from the main-thread animations, and add a
|
| // new animation affecting the same property.
|
| - animations->RemoveAnimation(
|
| - animations->GetAnimation(TargetProperty::OPACITY)->id());
|
| - const int second_animation_id = AddOpacityTransitionToElementAnimations(
|
| - animations.get(), 1, 1.f, 0.5f, true);
|
| + player_->RemoveAnimation(
|
| + player_->GetAnimation(TargetProperty::OPACITY)->id());
|
| + const int second_animation_id =
|
| + AddOpacityTransitionToPlayer(player_.get(), 1, 1.f, 0.5f, true);
|
| PushProperties();
|
|
|
| // The original animation should only affect active elements, and the new
|
| // animation should only affect pending elements.
|
| - EXPECT_FALSE(animations_impl->GetAnimationById(first_animation_id)
|
| + EXPECT_FALSE(player_impl_->GetAnimationById(first_animation_id)
|
| ->affects_pending_elements());
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(first_animation_id)
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(first_animation_id)
|
| ->affects_active_elements());
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(second_animation_id)
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(second_animation_id)
|
| ->affects_pending_elements());
|
| - EXPECT_FALSE(animations_impl->GetAnimationById(second_animation_id)
|
| + EXPECT_FALSE(player_impl_->GetAnimationById(second_animation_id)
|
| ->affects_active_elements());
|
|
|
| - animations_impl->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(500));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // The original animation should still be running, and the new animation
|
| // should be starting.
|
| EXPECT_EQ(Animation::RUNNING,
|
| - animations_impl->GetAnimationById(first_animation_id)->run_state());
|
| - EXPECT_EQ(
|
| - Animation::STARTING,
|
| - animations_impl->GetAnimationById(second_animation_id)->run_state());
|
| + player_impl_->GetAnimationById(first_animation_id)->run_state());
|
| + EXPECT_EQ(Animation::STARTING,
|
| + player_impl_->GetAnimationById(second_animation_id)->run_state());
|
|
|
| // The active observer should have been ticked by the original animation,
|
| // and the pending observer should have been ticked by the new animation.
|
| @@ -3546,25 +3457,24 @@ TEST_F(ElementAnimationsTest, StartAnimationsAffectingDifferentObservers) {
|
| EXPECT_EQ(0.5f,
|
| client_impl_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| - animations_impl->ActivateAnimations();
|
| + player_impl_->ActivateAnimations();
|
|
|
| // The original animation should have been deleted, and the new animation
|
| // should now affect both elements.
|
| - EXPECT_FALSE(animations_impl->GetAnimationById(first_animation_id));
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(second_animation_id)
|
| + EXPECT_FALSE(player_impl_->GetAnimationById(first_animation_id));
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(second_animation_id)
|
| ->affects_pending_elements());
|
| - EXPECT_TRUE(animations_impl->GetAnimationById(second_animation_id)
|
| + EXPECT_TRUE(player_impl_->GetAnimationById(second_animation_id)
|
| ->affects_active_elements());
|
|
|
| - animations_impl->Animate(kInitialTickTime +
|
| - TimeDelta::FromMilliseconds(1000));
|
| - animations_impl->UpdateState(true, events.get());
|
| + element_animations_impl_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1000));
|
| + element_animations_impl_->UpdateState(true, events.get());
|
|
|
| // The new animation should be running, and the active observer should have
|
| // been ticked at the new animation's starting point.
|
| - EXPECT_EQ(
|
| - Animation::RUNNING,
|
| - animations_impl->GetAnimationById(second_animation_id)->run_state());
|
| + EXPECT_EQ(Animation::RUNNING,
|
| + player_impl_->GetAnimationById(second_animation_id)->run_state());
|
| EXPECT_EQ(1.f,
|
| client_impl_.GetOpacity(element_id_, ElementListType::PENDING));
|
| EXPECT_EQ(1.f, client_impl_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| @@ -3574,69 +3484,69 @@ TEST_F(ElementAnimationsTest, TestIsCurrentlyAnimatingProperty) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| // Create an animation that initially affects only pending elements.
|
| std::unique_ptr<Animation> animation(CreateAnimation(
|
| std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
|
| 1, TargetProperty::OPACITY));
|
| animation->set_affects_active_elements(false);
|
|
|
| - animations->AddAnimation(std::move(animation));
|
| - animations->Animate(kInitialTickTime);
|
| - EXPECT_TRUE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| - animations->UpdateState(true, nullptr);
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| + player_->AddAnimation(std::move(animation));
|
| + element_animations_->Animate(kInitialTickTime);
|
| + EXPECT_TRUE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::PENDING));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::ACTIVE));
|
| + element_animations_->UpdateState(true, nullptr);
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
|
|
| - EXPECT_TRUE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::FILTER, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::FILTER, ElementListType::ACTIVE));
|
| + EXPECT_TRUE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::PENDING));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::ACTIVE));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::FILTER,
|
| + ElementListType::PENDING));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::FILTER,
|
| + ElementListType::ACTIVE));
|
|
|
| - animations->ActivateAnimations();
|
| + player_->ActivateAnimations();
|
|
|
| - EXPECT_TRUE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_TRUE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::FILTER, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::FILTER, ElementListType::ACTIVE));
|
| + EXPECT_TRUE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::PENDING));
|
| + EXPECT_TRUE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::ACTIVE));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::FILTER,
|
| + ElementListType::PENDING));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::FILTER,
|
| + ElementListType::ACTIVE));
|
|
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(10));
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(10));
|
| + element_animations_->UpdateState(true, nullptr);
|
|
|
| - EXPECT_TRUE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_TRUE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::FILTER, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::FILTER, ElementListType::ACTIVE));
|
| + EXPECT_TRUE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::PENDING));
|
| + EXPECT_TRUE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::ACTIVE));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::FILTER,
|
| + ElementListType::PENDING));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::FILTER,
|
| + ElementListType::ACTIVE));
|
|
|
| EXPECT_EQ(0.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
|
|
| // Tick past the end of the animation.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1100));
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(1100));
|
| + element_animations_->UpdateState(true, nullptr);
|
|
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::FILTER, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::FILTER, ElementListType::ACTIVE));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::PENDING));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::ACTIVE));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::FILTER,
|
| + ElementListType::PENDING));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::FILTER,
|
| + ElementListType::ACTIVE));
|
|
|
| EXPECT_EQ(1.f, client_.GetOpacity(element_id_, ElementListType::ACTIVE));
|
| }
|
| @@ -3645,8 +3555,6 @@ TEST_F(ElementAnimationsTest, TestIsAnimatingPropertyTimeOffsetFillMode) {
|
| CreateTestLayer(false, false);
|
| AttachTimelinePlayerLayer();
|
|
|
| - scoped_refptr<ElementAnimations> animations = element_animations();
|
| -
|
| // Create an animation that initially affects only pending elements, and has
|
| // a start delay of 2 seconds.
|
| std::unique_ptr<Animation> animation(CreateAnimation(
|
| @@ -3656,70 +3564,72 @@ TEST_F(ElementAnimationsTest, TestIsAnimatingPropertyTimeOffsetFillMode) {
|
| animation->set_time_offset(TimeDelta::FromMilliseconds(-2000));
|
| animation->set_affects_active_elements(false);
|
|
|
| - animations->AddAnimation(std::move(animation));
|
| + player_->AddAnimation(std::move(animation));
|
|
|
| - animations->Animate(kInitialTickTime);
|
| + element_animations_->Animate(kInitialTickTime);
|
|
|
| // Since the animation has a start delay, the elements it affects have a
|
| // potentially running transform animation but aren't currently animating
|
| // transform.
|
| - EXPECT_TRUE(animations->IsPotentiallyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsPotentiallyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| + EXPECT_TRUE(player_->IsPotentiallyAnimatingProperty(
|
| TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| + EXPECT_FALSE(player_->IsPotentiallyAnimatingProperty(
|
| TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| - EXPECT_FALSE(animations->IsPotentiallyAnimatingProperty(
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::PENDING));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::ACTIVE));
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->IsPotentiallyAnimatingProperty(
|
| TargetProperty::FILTER, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsPotentiallyAnimatingProperty(
|
| + EXPECT_FALSE(player_->IsPotentiallyAnimatingProperty(
|
| TargetProperty::FILTER, ElementListType::ACTIVE));
|
|
|
| - animations->ActivateAnimations();
|
| + player_->ActivateAnimations();
|
|
|
| - EXPECT_TRUE(animations->IsPotentiallyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_TRUE(animations->IsPotentiallyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| + EXPECT_TRUE(player_->IsPotentiallyAnimatingProperty(
|
| TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| - EXPECT_TRUE(animations->HasActiveAnimation());
|
| - EXPECT_FALSE(animations->IsPotentiallyAnimatingProperty(
|
| + EXPECT_TRUE(player_->IsPotentiallyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::ACTIVE));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::PENDING));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::ACTIVE));
|
| + EXPECT_TRUE(player_->HasActiveAnimation());
|
| + EXPECT_FALSE(player_->IsPotentiallyAnimatingProperty(
|
| TargetProperty::FILTER, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsPotentiallyAnimatingProperty(
|
| + EXPECT_FALSE(player_->IsPotentiallyAnimatingProperty(
|
| TargetProperty::FILTER, ElementListType::ACTIVE));
|
|
|
| - animations->UpdateState(true, nullptr);
|
| + element_animations_->UpdateState(true, nullptr);
|
|
|
| // Tick past the start delay.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000));
|
| - animations->UpdateState(true, nullptr);
|
| - EXPECT_TRUE(animations->IsPotentiallyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_TRUE(animations->IsPotentiallyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| - EXPECT_TRUE(animations->IsCurrentlyAnimatingProperty(
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(2000));
|
| + element_animations_->UpdateState(true, nullptr);
|
| + EXPECT_TRUE(player_->IsPotentiallyAnimatingProperty(
|
| TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_TRUE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| + EXPECT_TRUE(player_->IsPotentiallyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::ACTIVE));
|
| + EXPECT_TRUE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::PENDING));
|
| + EXPECT_TRUE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::ACTIVE));
|
|
|
| // After the animaton finishes, the elements it affects have neither a
|
| // potentially running transform animation nor a currently running transform
|
| // animation.
|
| - animations->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(4000));
|
| - animations->UpdateState(true, nullptr);
|
| - EXPECT_FALSE(animations->IsPotentiallyAnimatingProperty(
|
| + element_animations_->Animate(kInitialTickTime +
|
| + TimeDelta::FromMilliseconds(4000));
|
| + element_animations_->UpdateState(true, nullptr);
|
| + EXPECT_FALSE(player_->IsPotentiallyAnimatingProperty(
|
| TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsPotentiallyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| - TargetProperty::OPACITY, ElementListType::PENDING));
|
| - EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty(
|
| + EXPECT_FALSE(player_->IsPotentiallyAnimatingProperty(
|
| TargetProperty::OPACITY, ElementListType::ACTIVE));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::PENDING));
|
| + EXPECT_FALSE(player_->IsCurrentlyAnimatingProperty(TargetProperty::OPACITY,
|
| + ElementListType::ACTIVE));
|
| }
|
|
|
| } // namespace
|
|
|