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

Unified Diff: ui/compositor/layer_unittest.cc

Issue 2335043002: CC Animation: Move animations_ from ElementAnimations to AnimationPlayer. (Closed)
Patch Set: Clean it up harder. Rework UpdateClientAnimationState. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« cc/animation/element_animations.h ('K') | « ui/compositor/layer_animator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_unittest.cc
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index b683a1612d8d1b7594c5160f98c55730c4471e91..d357c78a26bd422caedb67eea62df15214bdd81e 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -22,6 +22,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h"
+#include "cc/animation/animation_player.h"
#include "cc/layers/layer.h"
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
@@ -1791,41 +1792,43 @@ TEST_F(LayerWithRealCompositorTest, AddRemoveThreadedAnimations) {
l1->SetAnimator(LayerAnimator::CreateImplicitAnimator());
l2->SetAnimator(LayerAnimator::CreateImplicitAnimator());
- EXPECT_FALSE(l1->HasPendingThreadedAnimationsForTesting());
+ auto player1 = l1->GetAnimator()->GetAnimationPlayerForTesting();
+ auto player2 = l2->GetAnimator()->GetAnimationPlayerForTesting();
+
+ EXPECT_FALSE(player1->has_any_animation());
// Trigger a threaded animation.
l1->SetOpacity(0.5f);
- EXPECT_TRUE(l1->HasPendingThreadedAnimationsForTesting());
+ EXPECT_TRUE(player1->has_any_animation());
// Ensure we can remove a pending threaded animation.
l1->GetAnimator()->StopAnimating();
- EXPECT_FALSE(l1->HasPendingThreadedAnimationsForTesting());
+ EXPECT_FALSE(player1->has_any_animation());
// Trigger another threaded animation.
l1->SetOpacity(0.2f);
- EXPECT_TRUE(l1->HasPendingThreadedAnimationsForTesting());
+ EXPECT_TRUE(player1->has_any_animation());
root->Add(l1.get());
GetCompositor()->SetRootLayer(root.get());
- // Now that l1 is part of a tree, it should have dispatched the pending
- // animation.
- EXPECT_FALSE(l1->HasPendingThreadedAnimationsForTesting());
+ // Now l1 is part of a tree.
+ EXPECT_TRUE(player1->has_any_animation());
- // Ensure that l1 no longer holds on to animations.
l1->SetOpacity(0.1f);
- EXPECT_FALSE(l1->HasPendingThreadedAnimationsForTesting());
+ // IMMEDIATELY_SET_NEW_TARGET is a default preemption strategy for conflicting
+ // animations.
+ EXPECT_FALSE(player1->has_any_animation());
- // Ensure that adding a layer to an existing tree causes its pending
- // animations to get dispatched.
+ // Adding a layer to an existing tree.
l2->SetOpacity(0.5f);
- EXPECT_TRUE(l2->HasPendingThreadedAnimationsForTesting());
+ EXPECT_TRUE(player2->has_any_animation());
l1->Add(l2.get());
- EXPECT_FALSE(l2->HasPendingThreadedAnimationsForTesting());
+ EXPECT_TRUE(player2->has_any_animation());
}
// Tests that in-progress threaded animations complete when a Layer's
« cc/animation/element_animations.h ('K') | « ui/compositor/layer_animator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698