Index: Source/core/animation/KeyframeEffectTest.cpp |
diff --git a/Source/core/animation/AnimationTest.cpp b/Source/core/animation/KeyframeEffectTest.cpp |
similarity index 73% |
copy from Source/core/animation/AnimationTest.cpp |
copy to Source/core/animation/KeyframeEffectTest.cpp |
index d271e83b23bfc35c5f338f913aa73050d3d7fcd7..5fb86f7f4014de530fd4fcf28857f9a43b39aa8c 100644 |
--- a/Source/core/animation/AnimationTest.cpp |
+++ b/Source/core/animation/KeyframeEffectTest.cpp |
@@ -3,14 +3,14 @@ |
// found in the LICENSE file. |
#include "config.h" |
-#include "core/animation/Animation.h" |
+#include "core/animation/KeyframeEffect.h" |
#include "bindings/core/v8/Dictionary.h" |
#include "bindings/core/v8/UnionTypesCore.h" |
-#include "bindings/core/v8/V8AnimationTimingProperties.h" |
#include "bindings/core/v8/V8BindingForTesting.h" |
+#include "bindings/core/v8/V8KeyframeEffectOptions.h" |
#include "core/animation/AnimationClock.h" |
-#include "core/animation/AnimationNodeTiming.h" |
+#include "core/animation/AnimationEffectTiming.h" |
#include "core/animation/AnimationTestHelper.h" |
#include "core/animation/AnimationTimeline.h" |
#include "core/animation/KeyframeEffectModel.h" |
@@ -23,9 +23,9 @@ |
namespace blink { |
-class AnimationAnimationTest : public ::testing::Test { |
+class KeyframeEffectTest : public ::testing::Test { |
protected: |
- AnimationAnimationTest() |
+ KeyframeEffectTest() |
: pageHolder(DummyPageHolder::create()) |
, document(pageHolder->document()) |
, element(document.createElement("foo", ASSERT_NO_EXCEPTION)) |
@@ -40,22 +40,22 @@ protected: |
TrackExceptionState exceptionState; |
}; |
-class AnimationAnimationV8Test : public AnimationAnimationTest { |
+class AnimationKeyframeEffectV8Test : public KeyframeEffectTest { |
protected: |
- AnimationAnimationV8Test() |
+ AnimationKeyframeEffectV8Test() |
: m_isolate(v8::Isolate::GetCurrent()) |
, m_scope(m_isolate) |
{ |
} |
template<typename T> |
- static PassRefPtrWillBeRawPtr<Animation> createAnimation(Element* element, Vector<Dictionary> keyframeDictionaryVector, T timingInput, ExceptionState& exceptionState) |
+ static PassRefPtrWillBeRawPtr<KeyframeEffect> createAnimation(Element* element, Vector<Dictionary> keyframeDictionaryVector, T timingInput, ExceptionState& exceptionState) |
{ |
- return Animation::create(element, keyframeDictionaryVector, timingInput, exceptionState); |
+ return KeyframeEffect::create(element, keyframeDictionaryVector, timingInput, exceptionState); |
} |
- static PassRefPtrWillBeRawPtr<Animation> createAnimation(Element* element, Vector<Dictionary> keyframeDictionaryVector, ExceptionState& exceptionState) |
+ static PassRefPtrWillBeRawPtr<KeyframeEffect> createAnimation(Element* element, Vector<Dictionary> keyframeDictionaryVector, ExceptionState& exceptionState) |
{ |
- return Animation::create(element, keyframeDictionaryVector, exceptionState); |
+ return KeyframeEffect::create(element, keyframeDictionaryVector, exceptionState); |
} |
v8::Isolate* m_isolate; |
@@ -64,7 +64,7 @@ private: |
V8TestingScope m_scope; |
}; |
-TEST_F(AnimationAnimationV8Test, CanCreateAnAnimation) |
+TEST_F(AnimationKeyframeEffectV8Test, CanCreateAnAnimation) |
{ |
Vector<Dictionary> jsKeyframes; |
v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
@@ -88,7 +88,7 @@ TEST_F(AnimationAnimationV8Test, CanCreateAnAnimation) |
ASSERT_TRUE(DictionaryHelper::get(jsKeyframes[1], "width", value2)); |
ASSERT_EQ("0px", value2); |
- RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0, exceptionState); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get(), jsKeyframes, 0, exceptionState); |
Element* target = animation->target(); |
EXPECT_EQ(*element.get(), *target); |
@@ -110,31 +110,31 @@ TEST_F(AnimationAnimationV8Test, CanCreateAnAnimation) |
EXPECT_EQ(*(CubicBezierTimingFunction::create(1, 1, 0.3, 0.3).get()), keyframes[1]->easing()); |
} |
-TEST_F(AnimationAnimationV8Test, CanSetDuration) |
+TEST_F(AnimationKeyframeEffectV8Test, CanSetDuration) |
{ |
Vector<Dictionary, 0> jsKeyframes; |
double duration = 2000; |
- RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, duration, exceptionState); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get(), jsKeyframes, duration, exceptionState); |
EXPECT_EQ(duration / 1000, animation->specifiedTiming().iterationDuration); |
} |
-TEST_F(AnimationAnimationV8Test, CanOmitSpecifiedDuration) |
+TEST_F(AnimationKeyframeEffectV8Test, CanOmitSpecifiedDuration) |
{ |
Vector<Dictionary, 0> jsKeyframes; |
- RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, exceptionState); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get(), jsKeyframes, exceptionState); |
EXPECT_TRUE(std::isnan(animation->specifiedTiming().iterationDuration)); |
} |
-TEST_F(AnimationAnimationV8Test, NegativeDurationIsAuto) |
+TEST_F(AnimationKeyframeEffectV8Test, NegativeDurationIsAuto) |
{ |
Vector<Dictionary, 0> jsKeyframes; |
- RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, -2, exceptionState); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get(), jsKeyframes, -2, exceptionState); |
EXPECT_TRUE(std::isnan(animation->specifiedTiming().iterationDuration)); |
} |
-TEST_F(AnimationAnimationV8Test, MismatchedKeyframePropertyRaisesException) |
+TEST_F(AnimationKeyframeEffectV8Test, MismatchedKeyframePropertyRaisesException) |
{ |
Vector<Dictionary> jsKeyframes; |
v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
@@ -157,7 +157,7 @@ TEST_F(AnimationAnimationV8Test, MismatchedKeyframePropertyRaisesException) |
EXPECT_EQ(NotSupportedError, exceptionState.code()); |
} |
-TEST_F(AnimationAnimationV8Test, MissingOffsetZeroRaisesException) |
+TEST_F(AnimationKeyframeEffectV8Test, MissingOffsetZeroRaisesException) |
{ |
Vector<Dictionary> jsKeyframes; |
v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
@@ -177,7 +177,7 @@ TEST_F(AnimationAnimationV8Test, MissingOffsetZeroRaisesException) |
EXPECT_EQ(NotSupportedError, exceptionState.code()); |
} |
-TEST_F(AnimationAnimationV8Test, MissingOffsetOneRaisesException) |
+TEST_F(AnimationKeyframeEffectV8Test, MissingOffsetOneRaisesException) |
{ |
Vector<Dictionary> jsKeyframes; |
v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
@@ -197,7 +197,7 @@ TEST_F(AnimationAnimationV8Test, MissingOffsetOneRaisesException) |
EXPECT_EQ(NotSupportedError, exceptionState.code()); |
} |
-TEST_F(AnimationAnimationV8Test, MissingOffsetZeroAndOneRaisesException) |
+TEST_F(AnimationKeyframeEffectV8Test, MissingOffsetZeroAndOneRaisesException) |
{ |
Vector<Dictionary> jsKeyframes; |
v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
@@ -217,7 +217,7 @@ TEST_F(AnimationAnimationV8Test, MissingOffsetZeroAndOneRaisesException) |
EXPECT_EQ(NotSupportedError, exceptionState.code()); |
} |
-TEST_F(AnimationAnimationV8Test, SpecifiedGetters) |
+TEST_F(AnimationKeyframeEffectV8Test, SpecifiedGetters) |
{ |
Vector<Dictionary, 0> jsKeyframes; |
@@ -230,12 +230,12 @@ TEST_F(AnimationAnimationV8Test, SpecifiedGetters) |
setV8ObjectPropertyAsNumber(timingInput, "playbackRate", 2); |
setV8ObjectPropertyAsString(timingInput, "direction", "reverse"); |
setV8ObjectPropertyAsString(timingInput, "easing", "step-start"); |
- AnimationTimingProperties timingInputDictionary; |
- V8AnimationTimingProperties::toImpl(m_isolate, timingInput, timingInputDictionary, exceptionState); |
+ KeyframeEffectOptions timingInputDictionary; |
+ V8KeyframeEffectOptions::toImpl(m_isolate, timingInput, timingInputDictionary, exceptionState); |
- RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, timingInputDictionary, exceptionState); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get(), jsKeyframes, timingInputDictionary, exceptionState); |
- RefPtrWillBeRawPtr<AnimationNodeTiming> specified = animation->timing(); |
+ RefPtrWillBeRawPtr<AnimationEffectTiming> specified = animation->timing(); |
EXPECT_EQ(2, specified->delay()); |
EXPECT_EQ(0.5, specified->endDelay()); |
EXPECT_EQ("backwards", specified->fill()); |
@@ -246,18 +246,18 @@ TEST_F(AnimationAnimationV8Test, SpecifiedGetters) |
EXPECT_EQ("step-start", specified->easing()); |
} |
-TEST_F(AnimationAnimationV8Test, SpecifiedDurationGetter) |
+TEST_F(AnimationKeyframeEffectV8Test, SpecifiedDurationGetter) |
{ |
Vector<Dictionary, 0> jsKeyframes; |
v8::Local<v8::Object> timingInputWithDuration = v8::Object::New(m_isolate); |
setV8ObjectPropertyAsNumber(timingInputWithDuration, "duration", 2.5); |
- AnimationTimingProperties timingInputDictionaryWithDuration; |
- V8AnimationTimingProperties::toImpl(m_isolate, timingInputWithDuration, timingInputDictionaryWithDuration, exceptionState); |
+ KeyframeEffectOptions timingInputDictionaryWithDuration; |
+ V8KeyframeEffectOptions::toImpl(m_isolate, timingInputWithDuration, timingInputDictionaryWithDuration, exceptionState); |
- RefPtrWillBeRawPtr<Animation> animationWithDuration = createAnimation(element.get(), jsKeyframes, timingInputDictionaryWithDuration, exceptionState); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animationWithDuration = createAnimation(element.get(), jsKeyframes, timingInputDictionaryWithDuration, exceptionState); |
- RefPtrWillBeRawPtr<AnimationNodeTiming> specifiedWithDuration = animationWithDuration->timing(); |
+ RefPtrWillBeRawPtr<AnimationEffectTiming> specifiedWithDuration = animationWithDuration->timing(); |
UnrestrictedDoubleOrString duration; |
specifiedWithDuration->duration(duration); |
EXPECT_TRUE(duration.isUnrestrictedDouble()); |
@@ -266,12 +266,12 @@ TEST_F(AnimationAnimationV8Test, SpecifiedDurationGetter) |
v8::Local<v8::Object> timingInputNoDuration = v8::Object::New(m_isolate); |
- AnimationTimingProperties timingInputDictionaryNoDuration; |
- V8AnimationTimingProperties::toImpl(m_isolate, timingInputNoDuration, timingInputDictionaryNoDuration, exceptionState); |
+ KeyframeEffectOptions timingInputDictionaryNoDuration; |
+ V8KeyframeEffectOptions::toImpl(m_isolate, timingInputNoDuration, timingInputDictionaryNoDuration, exceptionState); |
- RefPtrWillBeRawPtr<Animation> animationNoDuration = createAnimation(element.get(), jsKeyframes, timingInputDictionaryNoDuration, exceptionState); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animationNoDuration = createAnimation(element.get(), jsKeyframes, timingInputDictionaryNoDuration, exceptionState); |
- RefPtrWillBeRawPtr<AnimationNodeTiming> specifiedNoDuration = animationNoDuration->timing(); |
+ RefPtrWillBeRawPtr<AnimationEffectTiming> specifiedNoDuration = animationNoDuration->timing(); |
UnrestrictedDoubleOrString duration2; |
specifiedNoDuration->duration(duration2); |
EXPECT_FALSE(duration2.isUnrestrictedDouble()); |
@@ -279,15 +279,15 @@ TEST_F(AnimationAnimationV8Test, SpecifiedDurationGetter) |
EXPECT_EQ("auto", duration2.getAsString()); |
} |
-TEST_F(AnimationAnimationV8Test, SpecifiedSetters) |
+TEST_F(AnimationKeyframeEffectV8Test, SpecifiedSetters) |
{ |
Vector<Dictionary, 0> jsKeyframes; |
v8::Local<v8::Object> timingInput = v8::Object::New(m_isolate); |
- AnimationTimingProperties timingInputDictionary; |
- V8AnimationTimingProperties::toImpl(m_isolate, timingInput, timingInputDictionary, exceptionState); |
- RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, timingInputDictionary, exceptionState); |
+ KeyframeEffectOptions timingInputDictionary; |
+ V8KeyframeEffectOptions::toImpl(m_isolate, timingInput, timingInputDictionary, exceptionState); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get(), jsKeyframes, timingInputDictionary, exceptionState); |
- RefPtrWillBeRawPtr<AnimationNodeTiming> specified = animation->timing(); |
+ RefPtrWillBeRawPtr<AnimationEffectTiming> specified = animation->timing(); |
EXPECT_EQ(0, specified->delay()); |
specified->setDelay(2); |
@@ -322,15 +322,15 @@ TEST_F(AnimationAnimationV8Test, SpecifiedSetters) |
EXPECT_EQ("step-start", specified->easing()); |
} |
-TEST_F(AnimationAnimationV8Test, SetSpecifiedDuration) |
+TEST_F(AnimationKeyframeEffectV8Test, SetSpecifiedDuration) |
{ |
Vector<Dictionary, 0> jsKeyframes; |
v8::Local<v8::Object> timingInput = v8::Object::New(m_isolate); |
- AnimationTimingProperties timingInputDictionary; |
- V8AnimationTimingProperties::toImpl(m_isolate, timingInput, timingInputDictionary, exceptionState); |
- RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, timingInputDictionary, exceptionState); |
+ KeyframeEffectOptions timingInputDictionary; |
+ V8KeyframeEffectOptions::toImpl(m_isolate, timingInput, timingInputDictionary, exceptionState); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get(), jsKeyframes, timingInputDictionary, exceptionState); |
- RefPtrWillBeRawPtr<AnimationNodeTiming> specified = animation->timing(); |
+ RefPtrWillBeRawPtr<AnimationEffectTiming> specified = animation->timing(); |
UnrestrictedDoubleOrString duration; |
specified->duration(duration); |
@@ -348,15 +348,15 @@ TEST_F(AnimationAnimationV8Test, SetSpecifiedDuration) |
EXPECT_FALSE(duration2.isString()); |
} |
-TEST_F(AnimationAnimationTest, TimeToEffectChange) |
+TEST_F(KeyframeEffectTest, TimeToEffectChange) |
{ |
Timing timing; |
timing.iterationDuration = 100; |
timing.startDelay = 100; |
timing.endDelay = 100; |
timing.fillMode = Timing::FillModeNone; |
- RefPtrWillBeRawPtr<Animation> animation = Animation::create(0, nullptr, timing); |
- RefPtrWillBeRawPtr<AnimationPlayer> player = document.timeline().play(animation.get()); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animation = KeyframeEffect::create(0, nullptr, timing); |
+ RefPtrWillBeRawPtr<Animation> player = document.timeline().play(animation.get()); |
double inf = std::numeric_limits<double>::infinity(); |
EXPECT_EQ(100, animation->timeToForwardsEffectChange()); |
@@ -380,7 +380,7 @@ TEST_F(AnimationAnimationTest, TimeToEffectChange) |
EXPECT_EQ(100, animation->timeToReverseEffectChange()); |
} |
-TEST_F(AnimationAnimationTest, TimeToEffectChangeWithPlaybackRate) |
+TEST_F(KeyframeEffectTest, TimeToEffectChangeWithPlaybackRate) |
{ |
Timing timing; |
timing.iterationDuration = 100; |
@@ -388,8 +388,8 @@ TEST_F(AnimationAnimationTest, TimeToEffectChangeWithPlaybackRate) |
timing.endDelay = 100; |
timing.playbackRate = 2; |
timing.fillMode = Timing::FillModeNone; |
- RefPtrWillBeRawPtr<Animation> animation = Animation::create(0, nullptr, timing); |
- RefPtrWillBeRawPtr<AnimationPlayer> player = document.timeline().play(animation.get()); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animation = KeyframeEffect::create(0, nullptr, timing); |
+ RefPtrWillBeRawPtr<Animation> player = document.timeline().play(animation.get()); |
double inf = std::numeric_limits<double>::infinity(); |
EXPECT_EQ(100, animation->timeToForwardsEffectChange()); |
@@ -413,7 +413,7 @@ TEST_F(AnimationAnimationTest, TimeToEffectChangeWithPlaybackRate) |
EXPECT_EQ(50, animation->timeToReverseEffectChange()); |
} |
-TEST_F(AnimationAnimationTest, TimeToEffectChangeWithNegativePlaybackRate) |
+TEST_F(KeyframeEffectTest, TimeToEffectChangeWithNegativePlaybackRate) |
{ |
Timing timing; |
timing.iterationDuration = 100; |
@@ -421,8 +421,8 @@ TEST_F(AnimationAnimationTest, TimeToEffectChangeWithNegativePlaybackRate) |
timing.endDelay = 100; |
timing.playbackRate = -2; |
timing.fillMode = Timing::FillModeNone; |
- RefPtrWillBeRawPtr<Animation> animation = Animation::create(0, nullptr, timing); |
- RefPtrWillBeRawPtr<AnimationPlayer> player = document.timeline().play(animation.get()); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animation = KeyframeEffect::create(0, nullptr, timing); |
+ RefPtrWillBeRawPtr<Animation> player = document.timeline().play(animation.get()); |
double inf = std::numeric_limits<double>::infinity(); |
EXPECT_EQ(100, animation->timeToForwardsEffectChange()); |
@@ -445,13 +445,13 @@ TEST_F(AnimationAnimationTest, TimeToEffectChangeWithNegativePlaybackRate) |
EXPECT_EQ(50, animation->timeToReverseEffectChange()); |
} |
-TEST_F(AnimationAnimationTest, ElementDestructorClearsAnimationTarget) |
+TEST_F(KeyframeEffectTest, ElementDestructorClearsAnimationTarget) |
{ |
// This test expects incorrect behaviour should be removed once Element |
- // and Animation are moved to Oilpan. See crbug.com/362404 for context. |
+ // and KeyframeEffect are moved to Oilpan. See crbug.com/362404 for context. |
Timing timing; |
timing.iterationDuration = 5; |
- RefPtrWillBeRawPtr<Animation> animation = Animation::create(element.get(), nullptr, timing); |
+ RefPtrWillBeRawPtr<KeyframeEffect> animation = KeyframeEffect::create(element.get(), nullptr, timing); |
EXPECT_EQ(element.get(), animation->target()); |
document.timeline().play(animation.get()); |
pageHolder.clear(); |