diff options
Diffstat (limited to 'chromium/ui/compositor/layer_animation_sequence_unittest.cc')
-rw-r--r-- | chromium/ui/compositor/layer_animation_sequence_unittest.cc | 74 |
1 files changed, 35 insertions, 39 deletions
diff --git a/chromium/ui/compositor/layer_animation_sequence_unittest.cc b/chromium/ui/compositor/layer_animation_sequence_unittest.cc index 3b4591762b0..65779741578 100644 --- a/chromium/ui/compositor/layer_animation_sequence_unittest.cc +++ b/chromium/ui/compositor/layer_animation_sequence_unittest.cc @@ -28,9 +28,10 @@ TEST(LayerAnimationSequenceTest, NoElement) { start_time += base::TimeDelta::FromSeconds(1); sequence.set_start_time(start_time); EXPECT_TRUE(sequence.IsFinished(start_time)); - EXPECT_TRUE(sequence.properties().size() == 0); - LayerAnimationElement::AnimatableProperties properties; - EXPECT_FALSE(sequence.HasConflictingProperty(properties)); + EXPECT_EQ(static_cast<LayerAnimationElement::AnimatableProperties>( + LayerAnimationElement::UNKNOWN), + sequence.properties()); + EXPECT_FALSE(sequence.HasConflictingProperty(LayerAnimationElement::UNKNOWN)); } // Check that the sequences progresses the delegate as expected when it contains @@ -62,9 +63,9 @@ TEST(LayerAnimationSequenceTest, SingleElement) { EXPECT_FLOAT_EQ(target, delegate.GetBrightnessForAnimation()); } - EXPECT_TRUE(sequence.properties().size() == 1); - EXPECT_TRUE(sequence.properties().find(LayerAnimationElement::BRIGHTNESS) != - sequence.properties().end()); + EXPECT_EQ(static_cast<LayerAnimationElement::AnimatableProperties>( + LayerAnimationElement::BRIGHTNESS), + sequence.properties()); } // Check that the sequences progresses the delegate as expected when it contains @@ -91,12 +92,12 @@ TEST(LayerAnimationSequenceTest, SingleThreadedElement) { sequence.Progress(start_time, &delegate); EXPECT_FLOAT_EQ(start, sequence.last_progressed_fraction()); effective_start = start_time + delta; - sequence.OnThreadedAnimationStarted(cc::AnimationEvent( - cc::AnimationEvent::Started, - 0, - sequence.animation_group_id(), - cc::Animation::Opacity, - (effective_start - base::TimeTicks()).InSecondsF())); + sequence.OnThreadedAnimationStarted( + cc::AnimationEvent(cc::AnimationEvent::Started, + 0, + sequence.animation_group_id(), + cc::Animation::Opacity, + effective_start)); sequence.Progress(effective_start + delta/2, &delegate); EXPECT_FLOAT_EQ(middle, sequence.last_progressed_fraction()); EXPECT_TRUE(sequence.IsFinished(effective_start + delta)); @@ -105,9 +106,9 @@ TEST(LayerAnimationSequenceTest, SingleThreadedElement) { EXPECT_FLOAT_EQ(target, delegate.GetOpacityForAnimation()); } - EXPECT_TRUE(sequence.properties().size() == 1); - EXPECT_TRUE(sequence.properties().find(LayerAnimationElement::OPACITY) != - sequence.properties().end()); + EXPECT_EQ(static_cast<LayerAnimationElement::AnimatableProperties>( + LayerAnimationElement::OPACITY), + sequence.properties()); } // Check that the sequences progresses the delegate as expected when it contains @@ -125,11 +126,8 @@ TEST(LayerAnimationSequenceTest, MultipleElement) { LayerAnimationElement::CreateOpacityElement(target_opacity, delta)); // Pause bounds for a second. - LayerAnimationElement::AnimatableProperties properties; - properties.insert(LayerAnimationElement::BOUNDS); - - sequence.AddElement( - LayerAnimationElement::CreatePauseElement(properties, delta)); + sequence.AddElement(LayerAnimationElement::CreatePauseElement( + LayerAnimationElement::BOUNDS, delta)); gfx::Transform start_transform, target_transform, middle_transform; start_transform.Rotate(-30.0); @@ -151,12 +149,12 @@ TEST(LayerAnimationSequenceTest, MultipleElement) { EXPECT_FLOAT_EQ(0.0, sequence.last_progressed_fraction()); opacity_effective_start = start_time + delta; EXPECT_EQ(starting_group_id, sequence.animation_group_id()); - sequence.OnThreadedAnimationStarted(cc::AnimationEvent( - cc::AnimationEvent::Started, - 0, - sequence.animation_group_id(), - cc::Animation::Opacity, - (opacity_effective_start - base::TimeTicks()).InSecondsF())); + sequence.OnThreadedAnimationStarted( + cc::AnimationEvent(cc::AnimationEvent::Started, + 0, + sequence.animation_group_id(), + cc::Animation::Opacity, + opacity_effective_start)); sequence.Progress(opacity_effective_start + delta/2, &delegate); EXPECT_FLOAT_EQ(0.5, sequence.last_progressed_fraction()); sequence.Progress(opacity_effective_start + delta, &delegate); @@ -182,12 +180,12 @@ TEST(LayerAnimationSequenceTest, MultipleElement) { EXPECT_FLOAT_EQ(0.0, sequence.last_progressed_fraction()); transform_effective_start = opacity_effective_start + 3 * delta; EXPECT_NE(starting_group_id, sequence.animation_group_id()); - sequence.OnThreadedAnimationStarted(cc::AnimationEvent( - cc::AnimationEvent::Started, - 0, - sequence.animation_group_id(), - cc::Animation::Transform, - (transform_effective_start - base::TimeTicks()).InSecondsF())); + sequence.OnThreadedAnimationStarted( + cc::AnimationEvent(cc::AnimationEvent::Started, + 0, + sequence.animation_group_id(), + cc::Animation::Transform, + transform_effective_start)); sequence.Progress(transform_effective_start + delta/2, &delegate); EXPECT_FLOAT_EQ(0.5, sequence.last_progressed_fraction()); EXPECT_TRUE(sequence.IsFinished(transform_effective_start + delta)); @@ -196,13 +194,11 @@ TEST(LayerAnimationSequenceTest, MultipleElement) { delegate.GetTransformForAnimation()); } - EXPECT_TRUE(sequence.properties().size() == 3); - EXPECT_TRUE(sequence.properties().find(LayerAnimationElement::OPACITY) != - sequence.properties().end()); - EXPECT_TRUE(sequence.properties().find(LayerAnimationElement::TRANSFORM) != - sequence.properties().end()); - EXPECT_TRUE(sequence.properties().find(LayerAnimationElement::BOUNDS) != - sequence.properties().end()); + EXPECT_EQ( + static_cast<LayerAnimationElement::AnimatableProperties>( + LayerAnimationElement::OPACITY | LayerAnimationElement::TRANSFORM | + LayerAnimationElement::BOUNDS), + sequence.properties()); } // Check that a sequence can still be aborted if it has cycled many times. |