| Index: Source/core/animation/CompositorAnimationsTest.cpp
|
| diff --git a/Source/core/animation/CompositorAnimationsTest.cpp b/Source/core/animation/CompositorAnimationsTest.cpp
|
| index 9f957873bf8139811b42b1d35b7f78e36ee8e939..918a87bcb08b8a925ac2288e1a1a1daf04f8aa78 100644
|
| --- a/Source/core/animation/CompositorAnimationsTest.cpp
|
| +++ b/Source/core/animation/CompositorAnimationsTest.cpp
|
| @@ -64,6 +64,13 @@ using ::testing::_;
|
| class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTestBase {
|
|
|
| protected:
|
| + enum Direction {
|
| + Normal = CompositorAnimationsImpl::CompositorTiming::Normal,
|
| + Alternate = CompositorAnimationsImpl::CompositorTiming::Alternate,
|
| + Reverse = CompositorAnimationsImpl::CompositorTiming::Reverse,
|
| + AlternateReverse = CompositorAnimationsImpl::CompositorTiming::AlternateReverse
|
| + };
|
| +
|
| RefPtr<TimingFunction> m_linearTimingFunction;
|
| RefPtr<TimingFunction> m_cubicEaseTimingFunction;
|
| RefPtr<TimingFunction> m_cubicCustomTimingFunction;
|
| @@ -360,20 +367,21 @@ TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorPlaybackRate
|
|
|
| TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirection)
|
| {
|
| + m_timing.direction = Timing::PlaybackDirectionNormal;
|
| + EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
|
| + EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), Normal);
|
| +
|
| m_timing.direction = Timing::PlaybackDirectionAlternate;
|
| EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
|
| - EXPECT_TRUE(m_compositorTiming.alternate);
|
| - EXPECT_FALSE(m_compositorTiming.reverse);
|
| + EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), Alternate);
|
|
|
| m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
|
| EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
|
| - EXPECT_TRUE(m_compositorTiming.alternate);
|
| - EXPECT_TRUE(m_compositorTiming.reverse);
|
| + EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), AlternateReverse);
|
|
|
| m_timing.direction = Timing::PlaybackDirectionReverse;
|
| EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
|
| - EXPECT_FALSE(m_compositorTiming.alternate);
|
| - EXPECT_TRUE(m_compositorTiming.reverse);
|
| + EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), Reverse);
|
| }
|
|
|
| TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIterationsAndStartDelay)
|
| @@ -385,8 +393,7 @@ TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIte
|
| EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
|
| EXPECT_DOUBLE_EQ(6.0, m_compositorTiming.scaledTimeOffset);
|
| EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
|
| - EXPECT_TRUE(m_compositorTiming.alternate);
|
| - EXPECT_FALSE(m_compositorTiming.reverse);
|
| + EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), Alternate);
|
|
|
| m_timing.direction = Timing::PlaybackDirectionAlternate;
|
| m_timing.iterationCount = 4.0;
|
| @@ -395,8 +402,7 @@ TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIte
|
| EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
|
| EXPECT_DOUBLE_EQ(11.0, m_compositorTiming.scaledTimeOffset);
|
| EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
|
| - EXPECT_TRUE(m_compositorTiming.alternate);
|
| - EXPECT_FALSE(m_compositorTiming.reverse);
|
| + EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), Alternate);
|
|
|
| m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
|
| m_timing.iterationCount = 4.0;
|
| @@ -405,8 +411,7 @@ TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIte
|
| EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
|
| EXPECT_DOUBLE_EQ(6.0, m_compositorTiming.scaledTimeOffset);
|
| EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
|
| - EXPECT_TRUE(m_compositorTiming.alternate);
|
| - EXPECT_TRUE(m_compositorTiming.reverse);
|
| + EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), AlternateReverse);
|
|
|
| m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
|
| m_timing.iterationCount = 4.0;
|
| @@ -415,8 +420,7 @@ TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIte
|
| EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
|
| EXPECT_DOUBLE_EQ(11.0, m_compositorTiming.scaledTimeOffset);
|
| EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
|
| - EXPECT_TRUE(m_compositorTiming.alternate);
|
| - EXPECT_TRUE(m_compositorTiming.reverse);
|
| + EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), AlternateReverse);
|
| }
|
|
|
| TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTimingTimingFunctionPassThru)
|
| @@ -705,7 +709,7 @@ TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation)
|
|
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
|
| - usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(false));
|
| + usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::Normal));
|
|
|
| EXPECT_CALL(*mockAnimationPtr, delete_())
|
| .Times(1)
|
| @@ -752,7 +756,7 @@ TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration)
|
|
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
|
| - usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(false));
|
| + usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::Normal));
|
|
|
| EXPECT_CALL(*mockAnimationPtr, delete_())
|
| .Times(1)
|
| @@ -805,7 +809,7 @@ TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
|
|
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
|
| - usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(true));
|
| + usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::Alternate));
|
|
|
| EXPECT_CALL(*mockAnimationPtr, delete_())
|
| .Times(1)
|
| @@ -854,7 +858,7 @@ TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationStartDelay
|
|
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(-3.25));
|
| - usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(false));
|
| + usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::Normal));
|
|
|
| EXPECT_CALL(*mockAnimationPtr, delete_())
|
| .Times(1)
|
| @@ -914,7 +918,7 @@ TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation
|
|
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10));
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
|
| - usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(true));
|
| + usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::Alternate));
|
|
|
| EXPECT_CALL(*mockAnimationPtr, delete_())
|
| .Times(1)
|
| @@ -960,10 +964,10 @@ TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation)
|
| EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
|
| .WillOnce(Return(mockCurvePtr));
|
|
|
| - usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 5.0), 1.0, 0.0, 1.0, 1.0));
|
| - usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.5, 20.0), blink::WebAnimationCurve::TimingFunctionTypeLinear));
|
| - usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.75, -1.0), blink::WebAnimationCurve::TimingFunctionTypeEaseOut));
|
| - usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 2.0)));
|
| + usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebAnimationCurve::TimingFunctionTypeEaseIn));
|
| + usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.25, -1.0), blink::WebAnimationCurve::TimingFunctionTypeLinear));
|
| + usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.5, 20.0), 0.0, 0.0, 0.0, 1.0));
|
| + usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 5.0)));
|
|
|
| // Create the animation
|
| blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blink::WebAnimation::TargetPropertyOpacity);
|
| @@ -974,7 +978,7 @@ TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation)
|
|
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10));
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
|
| - usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(true));
|
| + usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::AlternateReverse));
|
|
|
| EXPECT_CALL(*mockAnimationPtr, delete_())
|
| .Times(1)
|
| @@ -1012,8 +1016,8 @@ TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative
|
| EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
|
| .WillOnce(Return(mockCurvePtr));
|
|
|
| - usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 5.0), blink::WebAnimationCurve::TimingFunctionTypeLinear));
|
| - usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.5, 2.0)));
|
| + usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebAnimationCurve::TimingFunctionTypeLinear));
|
| + usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.5, 5.0)));
|
|
|
| // Create animation
|
| blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blink::WebAnimation::TargetPropertyOpacity);
|
| @@ -1024,7 +1028,7 @@ TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative
|
|
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
|
| usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(3.0));
|
| - usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(true));
|
| + usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebAnimation::AlternateReverse));
|
|
|
| EXPECT_CALL(*mockAnimationPtr, delete_())
|
| .Times(1)
|
|
|