Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: cc/animation/element_animations_unittest.cc

Issue 2757453003: Purge impl-only animations awaiting deletion in AnimationPlayer::UpdateState. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/animation/animation_player.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/animation/element_animations.h" 5 #include "cc/animation/element_animations.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "cc/animation/animation_delegate.h" 8 #include "cc/animation/animation_delegate.h"
9 #include "cc/animation/animation_events.h" 9 #include "cc/animation/animation_events.h"
10 #include "cc/animation/animation_host.h" 10 #include "cc/animation/animation_host.h"
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 // Calling UpdateState after Animate should promote the animation to running 920 // Calling UpdateState after Animate should promote the animation to running
921 // state. 921 // state.
922 player_impl_->Tick(kInitialTickTime); 922 player_impl_->Tick(kInitialTickTime);
923 player_impl_->UpdateState(true, events.get()); 923 player_impl_->UpdateState(true, events.get());
924 EXPECT_EQ( 924 EXPECT_EQ(
925 Animation::RUNNING, 925 Animation::RUNNING,
926 player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)->run_state()); 926 player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)->run_state());
927 927
928 player_impl_->Tick(kInitialTickTime + TimeDelta::FromMilliseconds(1500)); 928 player_impl_->Tick(kInitialTickTime + TimeDelta::FromMilliseconds(1500));
929 player_impl_->UpdateState(true, events.get()); 929 player_impl_->UpdateState(true, events.get());
930 EXPECT_EQ( 930 EXPECT_EQ(nullptr, player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET));
931 Animation::WAITING_FOR_DELETION,
932 player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)->run_state());
933 931
934 // Add second scroll offset animation. 932 // Add second scroll offset animation.
935 AddScrollOffsetAnimationToPlayer(player_impl_.get(), 933 AddScrollOffsetAnimationToPlayer(player_impl_.get(),
936 gfx::ScrollOffset(100.f, 200.f), 934 gfx::ScrollOffset(100.f, 200.f),
937 gfx::ScrollOffset(100.f, 100.f), true); 935 gfx::ScrollOffset(100.f, 100.f), true);
938 936
939 // Calling UpdateState without Animate should NOT promote the animation to 937 // Calling UpdateState without Animate should NOT promote the animation to
940 // running state. 938 // running state.
941 player_impl_->UpdateState(true, events.get()); 939 player_impl_->UpdateState(true, events.get());
942 EXPECT_EQ( 940 EXPECT_EQ(
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
2005 player_impl_->Tick(kInitialTickTime); 2003 player_impl_->Tick(kInitialTickTime);
2006 player_impl_->UpdateState(true, events.get()); 2004 player_impl_->UpdateState(true, events.get());
2007 EXPECT_TRUE(delegate_impl.finished()); 2005 EXPECT_TRUE(delegate_impl.finished());
2008 EXPECT_TRUE(host_impl_->needs_push_properties()); 2006 EXPECT_TRUE(host_impl_->needs_push_properties());
2009 EXPECT_EQ(1u, events->events_.size()); 2007 EXPECT_EQ(1u, events->events_.size());
2010 EXPECT_EQ(AnimationEvent::TAKEOVER, events->events_[0].type); 2008 EXPECT_EQ(AnimationEvent::TAKEOVER, events->events_[0].type);
2011 EXPECT_EQ(123, events->events_[0].animation_start_time); 2009 EXPECT_EQ(123, events->events_[0].animation_start_time);
2012 EXPECT_EQ( 2010 EXPECT_EQ(
2013 target_value, 2011 target_value,
2014 events->events_[0].curve->ToScrollOffsetAnimationCurve()->target_value()); 2012 events->events_[0].curve->ToScrollOffsetAnimationCurve()->target_value());
2015 EXPECT_EQ( 2013 EXPECT_EQ(nullptr, player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET));
2016 Animation::WAITING_FOR_DELETION,
2017 player_impl_->GetAnimation(TargetProperty::SCROLL_OFFSET)->run_state());
2018 2014
2019 // MT receives the event to take over. 2015 // MT receives the event to take over.
2020 player_->NotifyAnimationTakeover(events->events_[0]); 2016 player_->NotifyAnimationTakeover(events->events_[0]);
2021 EXPECT_TRUE(delegate.takeover()); 2017 EXPECT_TRUE(delegate.takeover());
2022 2018
2023 // AnimationPlayer::NotifyAnimationTakeover requests SetNeedsPushProperties 2019 // AnimationPlayer::NotifyAnimationTakeover requests SetNeedsPushProperties
2024 // to purge CT animations marked for deletion. 2020 // to purge CT animations marked for deletion.
2025 EXPECT_TRUE(player_->needs_push_properties()); 2021 EXPECT_TRUE(player_->needs_push_properties());
2026 2022
2027 // ElementAnimations::PurgeAnimationsMarkedForDeletion call happens only in 2023 // ElementAnimations::PurgeAnimationsMarkedForDeletion call happens only in
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
3587 DestroyTestMainLayer(); 3583 DestroyTestMainLayer();
3588 EXPECT_EQ(0u, host_->ticking_players_for_testing().size()); 3584 EXPECT_EQ(0u, host_->ticking_players_for_testing().size());
3589 3585
3590 PushProperties(); 3586 PushProperties();
3591 EXPECT_EQ(0u, host_->ticking_players_for_testing().size()); 3587 EXPECT_EQ(0u, host_->ticking_players_for_testing().size());
3592 EXPECT_EQ(0u, host_impl_->ticking_players_for_testing().size()); 3588 EXPECT_EQ(0u, host_impl_->ticking_players_for_testing().size());
3593 } 3589 }
3594 3590
3595 } // namespace 3591 } // namespace
3596 } // namespace cc 3592 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/animation_player.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698