Index: ui/compositor/layer_animator_unittest.cc |
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc |
index 66efca72ccf4bbc7845aa94097d0fbf072693c12..c032e87d2dcd05ad7d8d7d2e81cb58ac4cc1a8ac 100644 |
--- a/ui/compositor/layer_animator_unittest.cc |
+++ b/ui/compositor/layer_animator_unittest.cc |
@@ -24,8 +24,6 @@ |
#include "ui/gfx/rect.h" |
#include "ui/gfx/transform.h" |
-using gfx::AnimationContainerElement; |
- |
namespace ui { |
namespace { |
@@ -196,14 +194,13 @@ class TestLayerAnimationSequence : public LayerAnimationSequence { |
TEST(LayerAnimatorTest, ImplicitAnimation) { |
scoped_refptr<LayerAnimator> animator( |
LayerAnimator::CreateImplicitAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
base::TimeTicks now = gfx::FrameTime::Now(); |
animator->SetBrightness(0.5); |
EXPECT_TRUE(animator->is_animating()); |
- element->Step(now + base::TimeDelta::FromSeconds(1)); |
+ animator->Step(now + base::TimeDelta::FromSeconds(1)); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), 0.5); |
} |
@@ -285,7 +282,6 @@ TEST(LayerAnimatorTest, AbortAllAnimations) { |
// trivial case and should result in the animation being started immediately. |
TEST(LayerAnimatorTest, ScheduleAnimationThatCanRunImmediately) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -308,12 +304,12 @@ TEST(LayerAnimatorTest, ScheduleAnimationThatCanRunImmediately) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness); |
@@ -324,7 +320,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAnimationThatCanRunImmediately) { |
double epsilon = 0.00001; |
LayerAnimatorTestController test_controller( |
LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = test_controller.animator(); |
+ LayerAnimator* animator = test_controller.animator(); |
test_controller.animator()->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
test_controller.animator()->SetDelegate(&delegate); |
@@ -354,7 +350,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAnimationThatCanRunImmediately) { |
cc::Animation::Opacity, |
effective_start)); |
- element->Step(effective_start + delta/2); |
+ animator->Step(effective_start + delta / 2); |
EXPECT_TRUE(test_controller.animator()->is_animating()); |
EXPECT_NEAR( |
@@ -363,7 +359,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAnimationThatCanRunImmediately) { |
last_progressed_fraction(), |
epsilon); |
- element->Step(effective_start + delta); |
+ animator->Step(effective_start + delta); |
EXPECT_FALSE(test_controller.animator()->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); |
@@ -373,7 +369,6 @@ TEST(LayerAnimatorTest, ScheduleThreadedAnimationThatCanRunImmediately) { |
// should start immediately and should progress in lock step. |
TEST(LayerAnimatorTest, ScheduleTwoAnimationsThatCanRunImmediately) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -407,13 +402,13 @@ TEST(LayerAnimatorTest, ScheduleTwoAnimationsThatCanRunImmediately) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness); |
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), middle_bounds); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness); |
@@ -426,7 +421,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAndNonThreadedAnimations) { |
double epsilon = 0.00001; |
LayerAnimatorTestController test_controller( |
LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = test_controller.animator(); |
+ LayerAnimator* animator = test_controller.animator(); |
test_controller.animator()->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
test_controller.animator()->SetDelegate(&delegate); |
@@ -470,7 +465,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAndNonThreadedAnimations) { |
cc::Animation::Opacity, |
effective_start)); |
- element->Step(effective_start + delta/2); |
+ animator->Step(effective_start + delta / 2); |
EXPECT_TRUE(test_controller.animator()->is_animating()); |
EXPECT_NEAR( |
@@ -480,7 +475,7 @@ TEST(LayerAnimatorTest, ScheduleThreadedAndNonThreadedAnimations) { |
epsilon); |
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), middle_bounds); |
- element->Step(effective_start + delta); |
+ animator->Step(effective_start + delta); |
EXPECT_FALSE(test_controller.animator()->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); |
@@ -491,7 +486,6 @@ TEST(LayerAnimatorTest, ScheduleThreadedAndNonThreadedAnimations) { |
// animations should run one after another. |
TEST(LayerAnimatorTest, ScheduleTwoAnimationsOnSameProperty) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -519,22 +513,22 @@ TEST(LayerAnimatorTest, ScheduleTwoAnimationsOnSameProperty) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), start_brightness); |
@@ -545,7 +539,6 @@ TEST(LayerAnimatorTest, ScheduleTwoAnimationsOnSameProperty) { |
// order. |
TEST(LayerAnimatorTest, ScheduleBlockedAnimation) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -589,31 +582,31 @@ TEST(LayerAnimatorTest, ScheduleBlockedAnimation) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), middle_grayscale); |
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), start_bounds); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), target_grayscale); |
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), start_bounds); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale); |
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), start_bounds); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(3000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(3000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale); |
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), target_bounds); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(4000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(4000)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale); |
@@ -625,7 +618,6 @@ TEST(LayerAnimatorTest, ScheduleBlockedAnimation) { |
// the second grayscale animation starts. |
TEST(LayerAnimatorTest, ScheduleTogether) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -662,13 +654,13 @@ TEST(LayerAnimatorTest, ScheduleTogether) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), target_grayscale); |
CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), start_bounds); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale); |
@@ -679,7 +671,6 @@ TEST(LayerAnimatorTest, ScheduleTogether) { |
// case (see the trival case for ScheduleAnimation). |
TEST(LayerAnimatorTest, StartAnimationThatCanRunImmediately) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -702,12 +693,12 @@ TEST(LayerAnimatorTest, StartAnimationThatCanRunImmediately) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness); |
@@ -718,7 +709,7 @@ TEST(LayerAnimatorTest, StartThreadedAnimationThatCanRunImmediately) { |
double epsilon = 0.00001; |
LayerAnimatorTestController test_controller( |
LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = test_controller.animator(); |
+ LayerAnimator* animator = test_controller.animator(); |
test_controller.animator()->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
test_controller.animator()->SetDelegate(&delegate); |
@@ -748,7 +739,7 @@ TEST(LayerAnimatorTest, StartThreadedAnimationThatCanRunImmediately) { |
cc::Animation::Opacity, |
effective_start)); |
- element->Step(effective_start + delta/2); |
+ animator->Step(effective_start + delta / 2); |
EXPECT_TRUE(test_controller.animator()->is_animating()); |
EXPECT_NEAR( |
@@ -757,7 +748,7 @@ TEST(LayerAnimatorTest, StartThreadedAnimationThatCanRunImmediately) { |
last_progressed_fraction(), |
epsilon); |
- element->Step(effective_start + delta); |
+ animator->Step(effective_start + delta); |
EXPECT_FALSE(test_controller.animator()->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); |
} |
@@ -793,7 +784,6 @@ TEST(LayerAnimatorTest, PreemptBySettingNewTarget) { |
// Preempt by animating to new target, with a non-threaded animation. |
TEST(LayerAnimatorTest, PreemptByImmediatelyAnimatingToNewTarget) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -816,7 +806,7 @@ TEST(LayerAnimatorTest, PreemptByImmediatelyAnimatingToNewTarget) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
animator->StartAnimation( |
new LayerAnimationSequence( |
@@ -833,13 +823,13 @@ TEST(LayerAnimatorTest, PreemptByImmediatelyAnimatingToNewTarget) { |
EXPECT_TRUE(animator->is_animating()); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), |
0.5 * (start_brightness + middle_brightness)); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), start_brightness); |
@@ -850,7 +840,7 @@ TEST(LayerAnimatorTest, PreemptThreadedByImmediatelyAnimatingToNewTarget) { |
double epsilon = 0.00001; |
LayerAnimatorTestController test_controller( |
LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = test_controller.animator(); |
+ LayerAnimator* animator = test_controller.animator(); |
test_controller.animator()->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
test_controller.animator()->SetDelegate(&delegate); |
@@ -881,7 +871,7 @@ TEST(LayerAnimatorTest, PreemptThreadedByImmediatelyAnimatingToNewTarget) { |
cc::Animation::Opacity, |
effective_start)); |
- element->Step(effective_start + delta/2); |
+ animator->Step(effective_start + delta / 2); |
test_controller.animator()->StartAnimation( |
new LayerAnimationSequence( |
@@ -906,7 +896,7 @@ TEST(LayerAnimatorTest, PreemptThreadedByImmediatelyAnimatingToNewTarget) { |
cc::Animation::Opacity, |
second_effective_start)); |
- element->Step(second_effective_start + delta/2); |
+ animator->Step(second_effective_start + delta / 2); |
EXPECT_TRUE(test_controller.animator()->is_animating()); |
EXPECT_NEAR( |
@@ -915,7 +905,7 @@ TEST(LayerAnimatorTest, PreemptThreadedByImmediatelyAnimatingToNewTarget) { |
last_progressed_fraction(), |
epsilon); |
- element->Step(second_effective_start + delta); |
+ animator->Step(second_effective_start + delta); |
EXPECT_FALSE(test_controller.animator()->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); |
@@ -924,7 +914,6 @@ TEST(LayerAnimatorTest, PreemptThreadedByImmediatelyAnimatingToNewTarget) { |
// Preempt by enqueuing the new animation. |
TEST(LayerAnimatorTest, PreemptEnqueueNewAnimation) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -946,7 +935,7 @@ TEST(LayerAnimatorTest, PreemptEnqueueNewAnimation) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
animator->StartAnimation( |
new LayerAnimationSequence( |
@@ -958,17 +947,17 @@ TEST(LayerAnimatorTest, PreemptEnqueueNewAnimation) { |
EXPECT_TRUE(animator->is_animating()); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), start_brightness); |
@@ -979,7 +968,6 @@ TEST(LayerAnimatorTest, PreemptEnqueueNewAnimation) { |
// animation started. |
TEST(LayerAnimatorTest, PreemptyByReplacingQueuedAnimations) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -1001,7 +989,7 @@ TEST(LayerAnimatorTest, PreemptyByReplacingQueuedAnimations) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
animator->StartAnimation( |
new LayerAnimationSequence( |
@@ -1018,17 +1006,17 @@ TEST(LayerAnimatorTest, PreemptyByReplacingQueuedAnimations) { |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), start_brightness); |
@@ -1113,7 +1101,6 @@ TEST(LayerAnimatorTest, MultiPreemptBySettingNewTarget) { |
// Preempt by animating to new target. |
TEST(LayerAnimatorTest, MultiPreemptByImmediatelyAnimatingToNewTarget) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -1144,7 +1131,7 @@ TEST(LayerAnimatorTest, MultiPreemptByImmediatelyAnimatingToNewTarget) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
animator->StartTogether( |
CreateMultiSequence( |
@@ -1164,7 +1151,7 @@ TEST(LayerAnimatorTest, MultiPreemptByImmediatelyAnimatingToNewTarget) { |
EXPECT_TRUE(animator->is_animating()); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), |
@@ -1172,7 +1159,7 @@ TEST(LayerAnimatorTest, MultiPreemptByImmediatelyAnimatingToNewTarget) { |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), |
0.5 * (start_brightness + middle_brightness)); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale); |
@@ -1184,7 +1171,7 @@ TEST(LayerAnimatorTest, MultiPreemptThreadedByImmediatelyAnimatingToNewTarget) { |
double epsilon = 0.00001; |
LayerAnimatorTestController test_controller( |
LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = test_controller.animator(); |
+ LayerAnimator* animator = test_controller.animator(); |
test_controller.animator()->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
test_controller.animator()->SetDelegate(&delegate); |
@@ -1223,7 +1210,7 @@ TEST(LayerAnimatorTest, MultiPreemptThreadedByImmediatelyAnimatingToNewTarget) { |
cc::Animation::Opacity, |
effective_start)); |
- element->Step(effective_start + delta/2); |
+ animator->Step(effective_start + delta / 2); |
test_controller.animator()->StartTogether( |
CreateMultiSequence( |
@@ -1253,7 +1240,7 @@ TEST(LayerAnimatorTest, MultiPreemptThreadedByImmediatelyAnimatingToNewTarget) { |
cc::Animation::Opacity, |
second_effective_start)); |
- element->Step(second_effective_start + delta/2); |
+ animator->Step(second_effective_start + delta / 2); |
EXPECT_TRUE(test_controller.animator()->is_animating()); |
EXPECT_NEAR( |
@@ -1265,7 +1252,7 @@ TEST(LayerAnimatorTest, MultiPreemptThreadedByImmediatelyAnimatingToNewTarget) { |
0.5 * (start_brightness + middle_brightness), |
epsilon); |
- element->Step(second_effective_start + delta); |
+ animator->Step(second_effective_start + delta); |
EXPECT_FALSE(test_controller.animator()->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); |
@@ -1275,7 +1262,6 @@ TEST(LayerAnimatorTest, MultiPreemptThreadedByImmediatelyAnimatingToNewTarget) { |
// Preempt by enqueuing the new animation. |
TEST(LayerAnimatorTest, MultiPreemptEnqueueNewAnimation) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -1304,7 +1290,7 @@ TEST(LayerAnimatorTest, MultiPreemptEnqueueNewAnimation) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
animator->StartTogether( |
CreateMultiSequence( |
@@ -1318,19 +1304,19 @@ TEST(LayerAnimatorTest, MultiPreemptEnqueueNewAnimation) { |
EXPECT_TRUE(animator->is_animating()); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), target_grayscale); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), middle_grayscale); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale); |
@@ -1342,7 +1328,6 @@ TEST(LayerAnimatorTest, MultiPreemptEnqueueNewAnimation) { |
// animation started. |
TEST(LayerAnimatorTest, MultiPreemptByReplacingQueuedAnimations) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -1371,7 +1356,7 @@ TEST(LayerAnimatorTest, MultiPreemptByReplacingQueuedAnimations) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
animator->StartTogether( |
CreateMultiSequence( |
@@ -1392,19 +1377,19 @@ TEST(LayerAnimatorTest, MultiPreemptByReplacingQueuedAnimations) { |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), middle_grayscale); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), target_grayscale); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), middle_grayscale); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), middle_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), start_grayscale); |
@@ -1414,7 +1399,6 @@ TEST(LayerAnimatorTest, MultiPreemptByReplacingQueuedAnimations) { |
// Test that non-threaded cyclic sequences continue to animate. |
TEST(LayerAnimatorTest, CyclicSequences) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -1440,29 +1424,29 @@ TEST(LayerAnimatorTest, CyclicSequences) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(2000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), start_brightness); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(3000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(3000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness); |
// Skip ahead by a lot. |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000000000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000000000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), start_brightness); |
// Skip ahead by a lot. |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000001000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000001000)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), target_brightness); |
@@ -1476,7 +1460,7 @@ TEST(LayerAnimatorTest, CyclicSequences) { |
TEST(LayerAnimatorTest, ThreadedCyclicSequences) { |
LayerAnimatorTestController test_controller( |
LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = test_controller.animator(); |
+ LayerAnimator* animator = test_controller.animator(); |
test_controller.animator()->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
test_controller.animator()->SetDelegate(&delegate); |
@@ -1510,7 +1494,7 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) { |
cc::Animation::Opacity, |
effective_start)); |
- element->Step(effective_start + delta); |
+ animator->Step(effective_start + delta); |
EXPECT_TRUE(test_controller.animator()->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); |
@@ -1523,7 +1507,7 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) { |
cc::Animation::Opacity, |
second_effective_start)); |
- element->Step(second_effective_start + delta); |
+ animator->Step(second_effective_start + delta); |
EXPECT_TRUE(test_controller.animator()->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); |
@@ -1537,7 +1521,7 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) { |
cc::Animation::Opacity, |
third_effective_start)); |
- element->Step(third_effective_start + delta); |
+ animator->Step(third_effective_start + delta); |
EXPECT_TRUE(test_controller.animator()->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); |
@@ -1551,7 +1535,7 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) { |
fourth_effective_start)); |
// Skip ahead by a lot. |
- element->Step(fourth_effective_start + 1000 * delta); |
+ animator->Step(fourth_effective_start + 1000 * delta); |
EXPECT_TRUE(test_controller.animator()->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); |
@@ -1566,7 +1550,7 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) { |
fifth_effective_start)); |
// Skip ahead by a lot. |
- element->Step(fifth_effective_start + 999 * delta); |
+ animator->Step(fifth_effective_start + 999 * delta); |
EXPECT_TRUE(test_controller.animator()->is_animating()); |
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); |
@@ -1579,7 +1563,6 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) { |
TEST(LayerAnimatorTest, AddObserverExplicit) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationObserver observer; |
TestLayerAnimationDelegate delegate; |
@@ -1602,7 +1585,7 @@ TEST(LayerAnimatorTest, AddObserverExplicit) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_EQ(observer.last_ended_sequence(), sequence); |
@@ -1621,7 +1604,6 @@ TEST(LayerAnimatorTest, AddObserverExplicit) { |
// when the object goes out of scope. |
TEST(LayerAnimatorTest, ImplicitAnimationObservers) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestImplicitAnimationObserver observer(false); |
TestLayerAnimationDelegate delegate; |
@@ -1638,7 +1620,7 @@ TEST(LayerAnimatorTest, ImplicitAnimationObservers) { |
EXPECT_FALSE(observer.animations_completed()); |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_TRUE(observer.animations_completed()); |
EXPECT_TRUE(observer.WasAnimationCompletedForProperty( |
LayerAnimationElement::BRIGHTNESS)); |
@@ -1680,7 +1662,6 @@ TEST(LayerAnimatorTest, AnimatorKeptAliveBySettings) { |
TestLayerAnimator* animator = new TestLayerAnimator(); |
LayerAnimatorDestructionObserver destruction_observer; |
animator->SetDestructionObserver(&destruction_observer); |
- AnimationContainerElement* element = animator; |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -1690,7 +1671,7 @@ TEST(LayerAnimatorTest, AnimatorKeptAliveBySettings) { |
ScopedLayerAnimationSettings settings(animator); |
base::TimeTicks now = gfx::FrameTime::Now(); |
animator->SetBrightness(0.5); |
- element->Step(now + base::TimeDelta::FromSeconds(1)); |
+ animator->Step(now + base::TimeDelta::FromSeconds(1)); |
EXPECT_FALSE(destruction_observer.IsAnimatorDeleted()); |
} |
// ScopedLayerAnimationSettings was destroyed, so Animator should be deleted. |
@@ -1770,7 +1751,6 @@ TEST(LayerAnimatorTest, AbortedAnimationStatusInImplicitObservers) { |
TEST(LayerAnimatorTest, RemoveObserverShouldRemoveFromSequences) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationObserver observer; |
TestLayerAnimationObserver removed_observer; |
@@ -1797,7 +1777,7 @@ TEST(LayerAnimatorTest, RemoveObserverShouldRemoveFromSequences) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_EQ(observer.last_ended_sequence(), sequence); |
EXPECT_TRUE(!removed_observer.last_ended_sequence()); |
@@ -1833,7 +1813,6 @@ TEST(LayerAnimatorTest, ObserverReleasedBeforeAnimationSequenceEnds) { |
TEST(LayerAnimatorTest, ObserverAttachedAfterAnimationStarted) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestImplicitAnimationObserver observer(false); |
@@ -1851,14 +1830,14 @@ TEST(LayerAnimatorTest, ObserverAttachedAfterAnimationStarted) { |
animator->StartAnimation(sequence); |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
setter.AddObserver(&observer); |
// Start observing an in-flight animation. |
sequence->AddObserver(&observer); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
} |
EXPECT_TRUE(observer.animations_completed()); |
@@ -1868,7 +1847,6 @@ TEST(LayerAnimatorTest, ObserverAttachedAfterAnimationStarted) { |
TEST(LayerAnimatorTest, ObserverDetachedBeforeAnimationFinished) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestImplicitAnimationObserver observer(false); |
@@ -1886,7 +1864,7 @@ TEST(LayerAnimatorTest, ObserverDetachedBeforeAnimationFinished) { |
animator->StartAnimation(sequence); |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
} |
EXPECT_FALSE(observer.animations_completed()); |
@@ -1912,7 +1890,6 @@ TEST(LayerAnimatorTest, ObserverDeletesAnimationsOnEnd) { |
ScopedAnimationDurationScaleMode normal_duration_mode( |
ScopedAnimationDurationScaleMode::NORMAL_DURATION); |
scoped_refptr<LayerAnimator> animator(new TestLayerAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -1946,7 +1923,7 @@ TEST(LayerAnimatorTest, ObserverDeletesAnimationsOnEnd) { |
ASSERT_TRUE(animator->IsAnimatingProperty(LayerAnimationElement::BOUNDS)); |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + halfway_delta); |
+ animator->Step(start_time + halfway_delta); |
// Completing the brightness animation should have stopped the bounds |
// animation. |
@@ -1982,7 +1959,6 @@ TEST(LayerAnimatorTest, CallbackDeletesAnimationInProgress) { |
ScopedAnimationDurationScaleMode normal_duration_mode( |
ScopedAnimationDurationScaleMode::NORMAL_DURATION); |
scoped_refptr<LayerAnimator> animator(new TestLayerAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDeletingDelegate delegate(animator.get(), 30); |
animator->SetDelegate(&delegate); |
@@ -2003,14 +1979,14 @@ TEST(LayerAnimatorTest, CallbackDeletesAnimationInProgress) { |
ASSERT_TRUE(animator->IsAnimatingProperty(LayerAnimationElement::BOUNDS)); |
base::TimeTicks start_time = animator->last_step_time(); |
- ASSERT_NO_FATAL_FAILURE(element->Step(start_time + bounds_delta1)); |
+ ASSERT_NO_FATAL_FAILURE(animator->Step(start_time + bounds_delta1)); |
ASSERT_TRUE(animator->IsAnimatingProperty(LayerAnimationElement::BOUNDS)); |
// The next step should change the animated bounds past the threshold and |
// cause the animaton to stop. |
- ASSERT_NO_FATAL_FAILURE(element->Step(start_time + bounds_delta2)); |
+ ASSERT_NO_FATAL_FAILURE(animator->Step(start_time + bounds_delta2)); |
ASSERT_FALSE(animator->IsAnimatingProperty(LayerAnimationElement::BOUNDS)); |
- ASSERT_NO_FATAL_FAILURE(element->Step(start_time + final_delta)); |
+ ASSERT_NO_FATAL_FAILURE(animator->Step(start_time + final_delta)); |
// Completing the animation should have stopped the bounds |
// animation. |
@@ -2200,7 +2176,6 @@ TEST(LayerAnimatorTest, GetTargetGrayscale) { |
// Verifies color property is modified appropriately. |
TEST(LayerAnimatorTest, Color) { |
scoped_refptr<LayerAnimator> animator(LayerAnimator::CreateDefaultAnimator()); |
- AnimationContainerElement* element = animator.get(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -2223,13 +2198,13 @@ TEST(LayerAnimatorTest, Color) { |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(500)); |
EXPECT_TRUE(animator->is_animating()); |
EXPECT_EQ(ColorToString(middle_color), |
ColorToString(delegate.GetColorForAnimation())); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
EXPECT_FALSE(animator->is_animating()); |
EXPECT_EQ(ColorToString(target_color), |
@@ -2337,7 +2312,6 @@ TEST(LayerAnimatorTest, ObserverDeletesAnimatorAfterFinishingAnimation) { |
observer->set_delete_on_animation_ended(true); |
observer->set_delete_on_animation_aborted(true); |
LayerAnimator* animator = observer->animator(); |
- AnimationContainerElement* element = observer->animator(); |
animator->set_disable_timer_for_test(true); |
TestLayerAnimationDelegate delegate; |
animator->SetDelegate(&delegate); |
@@ -2360,7 +2334,7 @@ TEST(LayerAnimatorTest, ObserverDeletesAnimatorAfterFinishingAnimation) { |
animator->StartAnimation(bounds_sequence); |
base::TimeTicks start_time = animator->last_step_time(); |
- element->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
+ animator->Step(start_time + base::TimeDelta::FromMilliseconds(1500)); |
EXPECT_TRUE(observer_was_deleted); |
} |