| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/Animation.h" | 6 #include "core/animation/KeyframeEffect.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" |
| 9 #include "bindings/core/v8/UnionTypesCore.h" | 9 #include "bindings/core/v8/UnionTypesCore.h" |
| 10 #include "bindings/core/v8/V8AnimationTimingProperties.h" | |
| 11 #include "bindings/core/v8/V8BindingForTesting.h" | 10 #include "bindings/core/v8/V8BindingForTesting.h" |
| 11 #include "bindings/core/v8/V8KeyframeEffectOptions.h" |
| 12 #include "core/animation/AnimationClock.h" | 12 #include "core/animation/AnimationClock.h" |
| 13 #include "core/animation/AnimationNodeTiming.h" | 13 #include "core/animation/AnimationEffectTiming.h" |
| 14 #include "core/animation/AnimationTestHelper.h" | 14 #include "core/animation/AnimationTestHelper.h" |
| 15 #include "core/animation/AnimationTimeline.h" | 15 #include "core/animation/AnimationTimeline.h" |
| 16 #include "core/animation/KeyframeEffectModel.h" | 16 #include "core/animation/KeyframeEffectModel.h" |
| 17 #include "core/animation/Timing.h" | 17 #include "core/animation/Timing.h" |
| 18 #include "core/dom/Document.h" | 18 #include "core/dom/Document.h" |
| 19 #include "core/dom/ExceptionCode.h" | 19 #include "core/dom/ExceptionCode.h" |
| 20 #include "core/testing/DummyPageHolder.h" | 20 #include "core/testing/DummyPageHolder.h" |
| 21 #include <gtest/gtest.h> | 21 #include <gtest/gtest.h> |
| 22 #include <v8.h> | 22 #include <v8.h> |
| 23 | 23 |
| 24 namespace blink { | 24 namespace blink { |
| 25 | 25 |
| 26 class AnimationAnimationTest : public ::testing::Test { | 26 class KeyframeEffectTest : public ::testing::Test { |
| 27 protected: | 27 protected: |
| 28 AnimationAnimationTest() | 28 KeyframeEffectTest() |
| 29 : pageHolder(DummyPageHolder::create()) | 29 : pageHolder(DummyPageHolder::create()) |
| 30 , document(pageHolder->document()) | 30 , document(pageHolder->document()) |
| 31 , element(document.createElement("foo", ASSERT_NO_EXCEPTION)) | 31 , element(document.createElement("foo", ASSERT_NO_EXCEPTION)) |
| 32 { | 32 { |
| 33 document.animationClock().resetTimeForTesting(document.timeline().zeroTi
me()); | 33 document.animationClock().resetTimeForTesting(document.timeline().zeroTi
me()); |
| 34 EXPECT_EQ(0, document.timeline().currentTime()); | 34 EXPECT_EQ(0, document.timeline().currentTime()); |
| 35 } | 35 } |
| 36 | 36 |
| 37 OwnPtr<DummyPageHolder> pageHolder; | 37 OwnPtr<DummyPageHolder> pageHolder; |
| 38 Document& document; | 38 Document& document; |
| 39 RefPtrWillBePersistent<Element> element; | 39 RefPtrWillBePersistent<Element> element; |
| 40 TrackExceptionState exceptionState; | 40 TrackExceptionState exceptionState; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 class AnimationAnimationV8Test : public AnimationAnimationTest { | 43 class AnimationKeyframeEffectV8Test : public KeyframeEffectTest { |
| 44 protected: | 44 protected: |
| 45 AnimationAnimationV8Test() | 45 AnimationKeyframeEffectV8Test() |
| 46 : m_isolate(v8::Isolate::GetCurrent()) | 46 : m_isolate(v8::Isolate::GetCurrent()) |
| 47 , m_scope(m_isolate) | 47 , m_scope(m_isolate) |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 template<typename T> | 51 template<typename T> |
| 52 static PassRefPtrWillBeRawPtr<Animation> createAnimation(Element* element, V
ector<Dictionary> keyframeDictionaryVector, T timingInput, ExceptionState& excep
tionState) | 52 static PassRefPtrWillBeRawPtr<KeyframeEffect> createAnimation(Element* eleme
nt, Vector<Dictionary> keyframeDictionaryVector, T timingInput, ExceptionState&
exceptionState) |
| 53 { | 53 { |
| 54 return Animation::create(element, keyframeDictionaryVector, timingInput,
exceptionState); | 54 return KeyframeEffect::create(element, keyframeDictionaryVector, timingI
nput, exceptionState); |
| 55 } | 55 } |
| 56 static PassRefPtrWillBeRawPtr<Animation> createAnimation(Element* element, V
ector<Dictionary> keyframeDictionaryVector, ExceptionState& exceptionState) | 56 static PassRefPtrWillBeRawPtr<KeyframeEffect> createAnimation(Element* eleme
nt, Vector<Dictionary> keyframeDictionaryVector, ExceptionState& exceptionState) |
| 57 { | 57 { |
| 58 return Animation::create(element, keyframeDictionaryVector, exceptionSta
te); | 58 return KeyframeEffect::create(element, keyframeDictionaryVector, excepti
onState); |
| 59 } | 59 } |
| 60 | 60 |
| 61 v8::Isolate* m_isolate; | 61 v8::Isolate* m_isolate; |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 V8TestingScope m_scope; | 64 V8TestingScope m_scope; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 TEST_F(AnimationAnimationV8Test, CanCreateAnAnimation) | 67 TEST_F(AnimationKeyframeEffectV8Test, CanCreateAnAnimation) |
| 68 { | 68 { |
| 69 Vector<Dictionary> jsKeyframes; | 69 Vector<Dictionary> jsKeyframes; |
| 70 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); | 70 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
| 71 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); | 71 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); |
| 72 | 72 |
| 73 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); | 73 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); |
| 74 setV8ObjectPropertyAsString(keyframe1, "offset", "0"); | 74 setV8ObjectPropertyAsString(keyframe1, "offset", "0"); |
| 75 setV8ObjectPropertyAsString(keyframe1, "easing", "ease-in-out"); | 75 setV8ObjectPropertyAsString(keyframe1, "easing", "ease-in-out"); |
| 76 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); | 76 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); |
| 77 setV8ObjectPropertyAsString(keyframe2, "offset", "1"); | 77 setV8ObjectPropertyAsString(keyframe2, "offset", "1"); |
| 78 setV8ObjectPropertyAsString(keyframe2, "easing", "cubic-bezier(1, 1, 0.3, 0.
3)"); | 78 setV8ObjectPropertyAsString(keyframe2, "easing", "cubic-bezier(1, 1, 0.3, 0.
3)"); |
| 79 | 79 |
| 80 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); | 80 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); |
| 81 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); | 81 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); |
| 82 | 82 |
| 83 String value1; | 83 String value1; |
| 84 ASSERT_TRUE(DictionaryHelper::get(jsKeyframes[0], "width", value1)); | 84 ASSERT_TRUE(DictionaryHelper::get(jsKeyframes[0], "width", value1)); |
| 85 ASSERT_EQ("100px", value1); | 85 ASSERT_EQ("100px", value1); |
| 86 | 86 |
| 87 String value2; | 87 String value2; |
| 88 ASSERT_TRUE(DictionaryHelper::get(jsKeyframes[1], "width", value2)); | 88 ASSERT_TRUE(DictionaryHelper::get(jsKeyframes[1], "width", value2)); |
| 89 ASSERT_EQ("0px", value2); | 89 ASSERT_EQ("0px", value2); |
| 90 | 90 |
| 91 RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsK
eyframes, 0, exceptionState); | 91 RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get()
, jsKeyframes, 0, exceptionState); |
| 92 | 92 |
| 93 Element* target = animation->target(); | 93 Element* target = animation->target(); |
| 94 EXPECT_EQ(*element.get(), *target); | 94 EXPECT_EQ(*element.get(), *target); |
| 95 | 95 |
| 96 const KeyframeVector keyframes = toKeyframeEffectModelBase(animation->effect
())->getFrames(); | 96 const KeyframeVector keyframes = toKeyframeEffectModelBase(animation->effect
())->getFrames(); |
| 97 | 97 |
| 98 EXPECT_EQ(0, keyframes[0]->offset()); | 98 EXPECT_EQ(0, keyframes[0]->offset()); |
| 99 EXPECT_EQ(1, keyframes[1]->offset()); | 99 EXPECT_EQ(1, keyframes[1]->offset()); |
| 100 | 100 |
| 101 const CSSValue* keyframe1Width = toStringKeyframe(keyframes[0].get())->cssPr
opertyValue(CSSPropertyWidth); | 101 const CSSValue* keyframe1Width = toStringKeyframe(keyframes[0].get())->cssPr
opertyValue(CSSPropertyWidth); |
| 102 const CSSValue* keyframe2Width = toStringKeyframe(keyframes[1].get())->cssPr
opertyValue(CSSPropertyWidth); | 102 const CSSValue* keyframe2Width = toStringKeyframe(keyframes[1].get())->cssPr
opertyValue(CSSPropertyWidth); |
| 103 ASSERT(keyframe1Width); | 103 ASSERT(keyframe1Width); |
| 104 ASSERT(keyframe2Width); | 104 ASSERT(keyframe2Width); |
| 105 | 105 |
| 106 EXPECT_EQ("100px", keyframe1Width->cssText()); | 106 EXPECT_EQ("100px", keyframe1Width->cssText()); |
| 107 EXPECT_EQ("0px", keyframe2Width->cssText()); | 107 EXPECT_EQ("0px", keyframe2Width->cssText()); |
| 108 | 108 |
| 109 EXPECT_EQ(*(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Eas
eInOut)), keyframes[0]->easing()); | 109 EXPECT_EQ(*(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Eas
eInOut)), keyframes[0]->easing()); |
| 110 EXPECT_EQ(*(CubicBezierTimingFunction::create(1, 1, 0.3, 0.3).get()), keyfra
mes[1]->easing()); | 110 EXPECT_EQ(*(CubicBezierTimingFunction::create(1, 1, 0.3, 0.3).get()), keyfra
mes[1]->easing()); |
| 111 } | 111 } |
| 112 | 112 |
| 113 TEST_F(AnimationAnimationV8Test, CanSetDuration) | 113 TEST_F(AnimationKeyframeEffectV8Test, CanSetDuration) |
| 114 { | 114 { |
| 115 Vector<Dictionary, 0> jsKeyframes; | 115 Vector<Dictionary, 0> jsKeyframes; |
| 116 double duration = 2000; | 116 double duration = 2000; |
| 117 | 117 |
| 118 RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsK
eyframes, duration, exceptionState); | 118 RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get()
, jsKeyframes, duration, exceptionState); |
| 119 | 119 |
| 120 EXPECT_EQ(duration / 1000, animation->specifiedTiming().iterationDuration); | 120 EXPECT_EQ(duration / 1000, animation->specifiedTiming().iterationDuration); |
| 121 } | 121 } |
| 122 | 122 |
| 123 TEST_F(AnimationAnimationV8Test, CanOmitSpecifiedDuration) | 123 TEST_F(AnimationKeyframeEffectV8Test, CanOmitSpecifiedDuration) |
| 124 { | 124 { |
| 125 Vector<Dictionary, 0> jsKeyframes; | 125 Vector<Dictionary, 0> jsKeyframes; |
| 126 RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsK
eyframes, exceptionState); | 126 RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get()
, jsKeyframes, exceptionState); |
| 127 EXPECT_TRUE(std::isnan(animation->specifiedTiming().iterationDuration)); | 127 EXPECT_TRUE(std::isnan(animation->specifiedTiming().iterationDuration)); |
| 128 } | 128 } |
| 129 | 129 |
| 130 TEST_F(AnimationAnimationV8Test, NegativeDurationIsAuto) | 130 TEST_F(AnimationKeyframeEffectV8Test, NegativeDurationIsAuto) |
| 131 { | 131 { |
| 132 Vector<Dictionary, 0> jsKeyframes; | 132 Vector<Dictionary, 0> jsKeyframes; |
| 133 RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsK
eyframes, -2, exceptionState); | 133 RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get()
, jsKeyframes, -2, exceptionState); |
| 134 EXPECT_TRUE(std::isnan(animation->specifiedTiming().iterationDuration)); | 134 EXPECT_TRUE(std::isnan(animation->specifiedTiming().iterationDuration)); |
| 135 } | 135 } |
| 136 | 136 |
| 137 TEST_F(AnimationAnimationV8Test, MismatchedKeyframePropertyRaisesException) | 137 TEST_F(AnimationKeyframeEffectV8Test, MismatchedKeyframePropertyRaisesException) |
| 138 { | 138 { |
| 139 Vector<Dictionary> jsKeyframes; | 139 Vector<Dictionary> jsKeyframes; |
| 140 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); | 140 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
| 141 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); | 141 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); |
| 142 | 142 |
| 143 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); | 143 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); |
| 144 setV8ObjectPropertyAsString(keyframe1, "offset", "0"); | 144 setV8ObjectPropertyAsString(keyframe1, "offset", "0"); |
| 145 | 145 |
| 146 // Height property appears only in keyframe2 | 146 // Height property appears only in keyframe2 |
| 147 setV8ObjectPropertyAsString(keyframe2, "height", "100px"); | 147 setV8ObjectPropertyAsString(keyframe2, "height", "100px"); |
| 148 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); | 148 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); |
| 149 setV8ObjectPropertyAsString(keyframe2, "offset", "1"); | 149 setV8ObjectPropertyAsString(keyframe2, "offset", "1"); |
| 150 | 150 |
| 151 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); | 151 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); |
| 152 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); | 152 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); |
| 153 | 153 |
| 154 createAnimation(element.get(), jsKeyframes, 0, exceptionState); | 154 createAnimation(element.get(), jsKeyframes, 0, exceptionState); |
| 155 | 155 |
| 156 EXPECT_TRUE(exceptionState.hadException()); | 156 EXPECT_TRUE(exceptionState.hadException()); |
| 157 EXPECT_EQ(NotSupportedError, exceptionState.code()); | 157 EXPECT_EQ(NotSupportedError, exceptionState.code()); |
| 158 } | 158 } |
| 159 | 159 |
| 160 TEST_F(AnimationAnimationV8Test, MissingOffsetZeroRaisesException) | 160 TEST_F(AnimationKeyframeEffectV8Test, MissingOffsetZeroRaisesException) |
| 161 { | 161 { |
| 162 Vector<Dictionary> jsKeyframes; | 162 Vector<Dictionary> jsKeyframes; |
| 163 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); | 163 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
| 164 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); | 164 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); |
| 165 | 165 |
| 166 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); | 166 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); |
| 167 setV8ObjectPropertyAsString(keyframe1, "offset", "0.1"); | 167 setV8ObjectPropertyAsString(keyframe1, "offset", "0.1"); |
| 168 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); | 168 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); |
| 169 setV8ObjectPropertyAsString(keyframe2, "offset", "1"); | 169 setV8ObjectPropertyAsString(keyframe2, "offset", "1"); |
| 170 | 170 |
| 171 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); | 171 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); |
| 172 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); | 172 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); |
| 173 | 173 |
| 174 createAnimation(element.get(), jsKeyframes, 0, exceptionState); | 174 createAnimation(element.get(), jsKeyframes, 0, exceptionState); |
| 175 | 175 |
| 176 EXPECT_TRUE(exceptionState.hadException()); | 176 EXPECT_TRUE(exceptionState.hadException()); |
| 177 EXPECT_EQ(NotSupportedError, exceptionState.code()); | 177 EXPECT_EQ(NotSupportedError, exceptionState.code()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 TEST_F(AnimationAnimationV8Test, MissingOffsetOneRaisesException) | 180 TEST_F(AnimationKeyframeEffectV8Test, MissingOffsetOneRaisesException) |
| 181 { | 181 { |
| 182 Vector<Dictionary> jsKeyframes; | 182 Vector<Dictionary> jsKeyframes; |
| 183 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); | 183 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
| 184 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); | 184 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); |
| 185 | 185 |
| 186 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); | 186 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); |
| 187 setV8ObjectPropertyAsString(keyframe1, "offset", "0"); | 187 setV8ObjectPropertyAsString(keyframe1, "offset", "0"); |
| 188 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); | 188 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); |
| 189 setV8ObjectPropertyAsString(keyframe2, "offset", "0.1"); | 189 setV8ObjectPropertyAsString(keyframe2, "offset", "0.1"); |
| 190 | 190 |
| 191 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); | 191 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); |
| 192 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); | 192 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); |
| 193 | 193 |
| 194 createAnimation(element.get(), jsKeyframes, 0, exceptionState); | 194 createAnimation(element.get(), jsKeyframes, 0, exceptionState); |
| 195 | 195 |
| 196 EXPECT_TRUE(exceptionState.hadException()); | 196 EXPECT_TRUE(exceptionState.hadException()); |
| 197 EXPECT_EQ(NotSupportedError, exceptionState.code()); | 197 EXPECT_EQ(NotSupportedError, exceptionState.code()); |
| 198 } | 198 } |
| 199 | 199 |
| 200 TEST_F(AnimationAnimationV8Test, MissingOffsetZeroAndOneRaisesException) | 200 TEST_F(AnimationKeyframeEffectV8Test, MissingOffsetZeroAndOneRaisesException) |
| 201 { | 201 { |
| 202 Vector<Dictionary> jsKeyframes; | 202 Vector<Dictionary> jsKeyframes; |
| 203 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); | 203 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
| 204 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); | 204 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); |
| 205 | 205 |
| 206 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); | 206 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); |
| 207 setV8ObjectPropertyAsString(keyframe1, "offset", "0.1"); | 207 setV8ObjectPropertyAsString(keyframe1, "offset", "0.1"); |
| 208 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); | 208 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); |
| 209 setV8ObjectPropertyAsString(keyframe2, "offset", "0.2"); | 209 setV8ObjectPropertyAsString(keyframe2, "offset", "0.2"); |
| 210 | 210 |
| 211 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); | 211 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); |
| 212 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); | 212 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); |
| 213 | 213 |
| 214 createAnimation(element.get(), jsKeyframes, 0, exceptionState); | 214 createAnimation(element.get(), jsKeyframes, 0, exceptionState); |
| 215 | 215 |
| 216 EXPECT_TRUE(exceptionState.hadException()); | 216 EXPECT_TRUE(exceptionState.hadException()); |
| 217 EXPECT_EQ(NotSupportedError, exceptionState.code()); | 217 EXPECT_EQ(NotSupportedError, exceptionState.code()); |
| 218 } | 218 } |
| 219 | 219 |
| 220 TEST_F(AnimationAnimationV8Test, SpecifiedGetters) | 220 TEST_F(AnimationKeyframeEffectV8Test, SpecifiedGetters) |
| 221 { | 221 { |
| 222 Vector<Dictionary, 0> jsKeyframes; | 222 Vector<Dictionary, 0> jsKeyframes; |
| 223 | 223 |
| 224 v8::Local<v8::Object> timingInput = v8::Object::New(m_isolate); | 224 v8::Local<v8::Object> timingInput = v8::Object::New(m_isolate); |
| 225 setV8ObjectPropertyAsNumber(timingInput, "delay", 2); | 225 setV8ObjectPropertyAsNumber(timingInput, "delay", 2); |
| 226 setV8ObjectPropertyAsNumber(timingInput, "endDelay", 0.5); | 226 setV8ObjectPropertyAsNumber(timingInput, "endDelay", 0.5); |
| 227 setV8ObjectPropertyAsString(timingInput, "fill", "backwards"); | 227 setV8ObjectPropertyAsString(timingInput, "fill", "backwards"); |
| 228 setV8ObjectPropertyAsNumber(timingInput, "iterationStart", 2); | 228 setV8ObjectPropertyAsNumber(timingInput, "iterationStart", 2); |
| 229 setV8ObjectPropertyAsNumber(timingInput, "iterations", 10); | 229 setV8ObjectPropertyAsNumber(timingInput, "iterations", 10); |
| 230 setV8ObjectPropertyAsNumber(timingInput, "playbackRate", 2); | 230 setV8ObjectPropertyAsNumber(timingInput, "playbackRate", 2); |
| 231 setV8ObjectPropertyAsString(timingInput, "direction", "reverse"); | 231 setV8ObjectPropertyAsString(timingInput, "direction", "reverse"); |
| 232 setV8ObjectPropertyAsString(timingInput, "easing", "step-start"); | 232 setV8ObjectPropertyAsString(timingInput, "easing", "step-start"); |
| 233 AnimationTimingProperties timingInputDictionary; | 233 KeyframeEffectOptions timingInputDictionary; |
| 234 V8AnimationTimingProperties::toImpl(m_isolate, timingInput, timingInputDicti
onary, exceptionState); | 234 V8KeyframeEffectOptions::toImpl(m_isolate, timingInput, timingInputDictionar
y, exceptionState); |
| 235 | 235 |
| 236 RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsK
eyframes, timingInputDictionary, exceptionState); | 236 RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get()
, jsKeyframes, timingInputDictionary, exceptionState); |
| 237 | 237 |
| 238 RefPtrWillBeRawPtr<AnimationNodeTiming> specified = animation->timing(); | 238 RefPtrWillBeRawPtr<AnimationEffectTiming> specified = animation->timing(); |
| 239 EXPECT_EQ(2, specified->delay()); | 239 EXPECT_EQ(2, specified->delay()); |
| 240 EXPECT_EQ(0.5, specified->endDelay()); | 240 EXPECT_EQ(0.5, specified->endDelay()); |
| 241 EXPECT_EQ("backwards", specified->fill()); | 241 EXPECT_EQ("backwards", specified->fill()); |
| 242 EXPECT_EQ(2, specified->iterationStart()); | 242 EXPECT_EQ(2, specified->iterationStart()); |
| 243 EXPECT_EQ(10, specified->iterations()); | 243 EXPECT_EQ(10, specified->iterations()); |
| 244 EXPECT_EQ(2, specified->playbackRate()); | 244 EXPECT_EQ(2, specified->playbackRate()); |
| 245 EXPECT_EQ("reverse", specified->direction()); | 245 EXPECT_EQ("reverse", specified->direction()); |
| 246 EXPECT_EQ("step-start", specified->easing()); | 246 EXPECT_EQ("step-start", specified->easing()); |
| 247 } | 247 } |
| 248 | 248 |
| 249 TEST_F(AnimationAnimationV8Test, SpecifiedDurationGetter) | 249 TEST_F(AnimationKeyframeEffectV8Test, SpecifiedDurationGetter) |
| 250 { | 250 { |
| 251 Vector<Dictionary, 0> jsKeyframes; | 251 Vector<Dictionary, 0> jsKeyframes; |
| 252 | 252 |
| 253 v8::Local<v8::Object> timingInputWithDuration = v8::Object::New(m_isolate); | 253 v8::Local<v8::Object> timingInputWithDuration = v8::Object::New(m_isolate); |
| 254 setV8ObjectPropertyAsNumber(timingInputWithDuration, "duration", 2.5); | 254 setV8ObjectPropertyAsNumber(timingInputWithDuration, "duration", 2.5); |
| 255 AnimationTimingProperties timingInputDictionaryWithDuration; | 255 KeyframeEffectOptions timingInputDictionaryWithDuration; |
| 256 V8AnimationTimingProperties::toImpl(m_isolate, timingInputWithDuration, timi
ngInputDictionaryWithDuration, exceptionState); | 256 V8KeyframeEffectOptions::toImpl(m_isolate, timingInputWithDuration, timingIn
putDictionaryWithDuration, exceptionState); |
| 257 | 257 |
| 258 RefPtrWillBeRawPtr<Animation> animationWithDuration = createAnimation(elemen
t.get(), jsKeyframes, timingInputDictionaryWithDuration, exceptionState); | 258 RefPtrWillBeRawPtr<KeyframeEffect> animationWithDuration = createAnimation(e
lement.get(), jsKeyframes, timingInputDictionaryWithDuration, exceptionState); |
| 259 | 259 |
| 260 RefPtrWillBeRawPtr<AnimationNodeTiming> specifiedWithDuration = animationWit
hDuration->timing(); | 260 RefPtrWillBeRawPtr<AnimationEffectTiming> specifiedWithDuration = animationW
ithDuration->timing(); |
| 261 UnrestrictedDoubleOrString duration; | 261 UnrestrictedDoubleOrString duration; |
| 262 specifiedWithDuration->duration(duration); | 262 specifiedWithDuration->duration(duration); |
| 263 EXPECT_TRUE(duration.isUnrestrictedDouble()); | 263 EXPECT_TRUE(duration.isUnrestrictedDouble()); |
| 264 EXPECT_EQ(2.5, duration.getAsUnrestrictedDouble()); | 264 EXPECT_EQ(2.5, duration.getAsUnrestrictedDouble()); |
| 265 EXPECT_FALSE(duration.isString()); | 265 EXPECT_FALSE(duration.isString()); |
| 266 | 266 |
| 267 | 267 |
| 268 v8::Local<v8::Object> timingInputNoDuration = v8::Object::New(m_isolate); | 268 v8::Local<v8::Object> timingInputNoDuration = v8::Object::New(m_isolate); |
| 269 AnimationTimingProperties timingInputDictionaryNoDuration; | 269 KeyframeEffectOptions timingInputDictionaryNoDuration; |
| 270 V8AnimationTimingProperties::toImpl(m_isolate, timingInputNoDuration, timing
InputDictionaryNoDuration, exceptionState); | 270 V8KeyframeEffectOptions::toImpl(m_isolate, timingInputNoDuration, timingInpu
tDictionaryNoDuration, exceptionState); |
| 271 | 271 |
| 272 RefPtrWillBeRawPtr<Animation> animationNoDuration = createAnimation(element.
get(), jsKeyframes, timingInputDictionaryNoDuration, exceptionState); | 272 RefPtrWillBeRawPtr<KeyframeEffect> animationNoDuration = createAnimation(ele
ment.get(), jsKeyframes, timingInputDictionaryNoDuration, exceptionState); |
| 273 | 273 |
| 274 RefPtrWillBeRawPtr<AnimationNodeTiming> specifiedNoDuration = animationNoDur
ation->timing(); | 274 RefPtrWillBeRawPtr<AnimationEffectTiming> specifiedNoDuration = animationNoD
uration->timing(); |
| 275 UnrestrictedDoubleOrString duration2; | 275 UnrestrictedDoubleOrString duration2; |
| 276 specifiedNoDuration->duration(duration2); | 276 specifiedNoDuration->duration(duration2); |
| 277 EXPECT_FALSE(duration2.isUnrestrictedDouble()); | 277 EXPECT_FALSE(duration2.isUnrestrictedDouble()); |
| 278 EXPECT_TRUE(duration2.isString()); | 278 EXPECT_TRUE(duration2.isString()); |
| 279 EXPECT_EQ("auto", duration2.getAsString()); | 279 EXPECT_EQ("auto", duration2.getAsString()); |
| 280 } | 280 } |
| 281 | 281 |
| 282 TEST_F(AnimationAnimationV8Test, SpecifiedSetters) | 282 TEST_F(AnimationKeyframeEffectV8Test, SpecifiedSetters) |
| 283 { | 283 { |
| 284 Vector<Dictionary, 0> jsKeyframes; | 284 Vector<Dictionary, 0> jsKeyframes; |
| 285 v8::Local<v8::Object> timingInput = v8::Object::New(m_isolate); | 285 v8::Local<v8::Object> timingInput = v8::Object::New(m_isolate); |
| 286 AnimationTimingProperties timingInputDictionary; | 286 KeyframeEffectOptions timingInputDictionary; |
| 287 V8AnimationTimingProperties::toImpl(m_isolate, timingInput, timingInputDicti
onary, exceptionState); | 287 V8KeyframeEffectOptions::toImpl(m_isolate, timingInput, timingInputDictionar
y, exceptionState); |
| 288 RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsK
eyframes, timingInputDictionary, exceptionState); | 288 RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get()
, jsKeyframes, timingInputDictionary, exceptionState); |
| 289 | 289 |
| 290 RefPtrWillBeRawPtr<AnimationNodeTiming> specified = animation->timing(); | 290 RefPtrWillBeRawPtr<AnimationEffectTiming> specified = animation->timing(); |
| 291 | 291 |
| 292 EXPECT_EQ(0, specified->delay()); | 292 EXPECT_EQ(0, specified->delay()); |
| 293 specified->setDelay(2); | 293 specified->setDelay(2); |
| 294 EXPECT_EQ(2, specified->delay()); | 294 EXPECT_EQ(2, specified->delay()); |
| 295 | 295 |
| 296 EXPECT_EQ(0, specified->endDelay()); | 296 EXPECT_EQ(0, specified->endDelay()); |
| 297 specified->setEndDelay(0.5); | 297 specified->setEndDelay(0.5); |
| 298 EXPECT_EQ(0.5, specified->endDelay()); | 298 EXPECT_EQ(0.5, specified->endDelay()); |
| 299 | 299 |
| 300 EXPECT_EQ("auto", specified->fill()); | 300 EXPECT_EQ("auto", specified->fill()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 315 | 315 |
| 316 EXPECT_EQ("normal", specified->direction()); | 316 EXPECT_EQ("normal", specified->direction()); |
| 317 specified->setDirection("reverse"); | 317 specified->setDirection("reverse"); |
| 318 EXPECT_EQ("reverse", specified->direction()); | 318 EXPECT_EQ("reverse", specified->direction()); |
| 319 | 319 |
| 320 EXPECT_EQ("linear", specified->easing()); | 320 EXPECT_EQ("linear", specified->easing()); |
| 321 specified->setEasing("step-start"); | 321 specified->setEasing("step-start"); |
| 322 EXPECT_EQ("step-start", specified->easing()); | 322 EXPECT_EQ("step-start", specified->easing()); |
| 323 } | 323 } |
| 324 | 324 |
| 325 TEST_F(AnimationAnimationV8Test, SetSpecifiedDuration) | 325 TEST_F(AnimationKeyframeEffectV8Test, SetSpecifiedDuration) |
| 326 { | 326 { |
| 327 Vector<Dictionary, 0> jsKeyframes; | 327 Vector<Dictionary, 0> jsKeyframes; |
| 328 v8::Local<v8::Object> timingInput = v8::Object::New(m_isolate); | 328 v8::Local<v8::Object> timingInput = v8::Object::New(m_isolate); |
| 329 AnimationTimingProperties timingInputDictionary; | 329 KeyframeEffectOptions timingInputDictionary; |
| 330 V8AnimationTimingProperties::toImpl(m_isolate, timingInput, timingInputDicti
onary, exceptionState); | 330 V8KeyframeEffectOptions::toImpl(m_isolate, timingInput, timingInputDictionar
y, exceptionState); |
| 331 RefPtrWillBeRawPtr<Animation> animation = createAnimation(element.get(), jsK
eyframes, timingInputDictionary, exceptionState); | 331 RefPtrWillBeRawPtr<KeyframeEffect> animation = createAnimation(element.get()
, jsKeyframes, timingInputDictionary, exceptionState); |
| 332 | 332 |
| 333 RefPtrWillBeRawPtr<AnimationNodeTiming> specified = animation->timing(); | 333 RefPtrWillBeRawPtr<AnimationEffectTiming> specified = animation->timing(); |
| 334 | 334 |
| 335 UnrestrictedDoubleOrString duration; | 335 UnrestrictedDoubleOrString duration; |
| 336 specified->duration(duration); | 336 specified->duration(duration); |
| 337 EXPECT_FALSE(duration.isUnrestrictedDouble()); | 337 EXPECT_FALSE(duration.isUnrestrictedDouble()); |
| 338 EXPECT_TRUE(duration.isString()); | 338 EXPECT_TRUE(duration.isString()); |
| 339 EXPECT_EQ("auto", duration.getAsString()); | 339 EXPECT_EQ("auto", duration.getAsString()); |
| 340 | 340 |
| 341 UnrestrictedDoubleOrString inDuration; | 341 UnrestrictedDoubleOrString inDuration; |
| 342 inDuration.setUnrestrictedDouble(2.5); | 342 inDuration.setUnrestrictedDouble(2.5); |
| 343 specified->setDuration(inDuration); | 343 specified->setDuration(inDuration); |
| 344 UnrestrictedDoubleOrString duration2; | 344 UnrestrictedDoubleOrString duration2; |
| 345 specified->duration(duration2); | 345 specified->duration(duration2); |
| 346 EXPECT_TRUE(duration2.isUnrestrictedDouble()); | 346 EXPECT_TRUE(duration2.isUnrestrictedDouble()); |
| 347 EXPECT_EQ(2.5, duration2.getAsUnrestrictedDouble()); | 347 EXPECT_EQ(2.5, duration2.getAsUnrestrictedDouble()); |
| 348 EXPECT_FALSE(duration2.isString()); | 348 EXPECT_FALSE(duration2.isString()); |
| 349 } | 349 } |
| 350 | 350 |
| 351 TEST_F(AnimationAnimationTest, TimeToEffectChange) | 351 TEST_F(KeyframeEffectTest, TimeToEffectChange) |
| 352 { | 352 { |
| 353 Timing timing; | 353 Timing timing; |
| 354 timing.iterationDuration = 100; | 354 timing.iterationDuration = 100; |
| 355 timing.startDelay = 100; | 355 timing.startDelay = 100; |
| 356 timing.endDelay = 100; | 356 timing.endDelay = 100; |
| 357 timing.fillMode = Timing::FillModeNone; | 357 timing.fillMode = Timing::FillModeNone; |
| 358 RefPtrWillBeRawPtr<Animation> animation = Animation::create(0, nullptr, timi
ng); | 358 RefPtrWillBeRawPtr<KeyframeEffect> animation = KeyframeEffect::create(0, nul
lptr, timing); |
| 359 RefPtrWillBeRawPtr<AnimationPlayer> player = document.timeline().play(animat
ion.get()); | 359 RefPtrWillBeRawPtr<Animation> player = document.timeline().play(animation.ge
t()); |
| 360 double inf = std::numeric_limits<double>::infinity(); | 360 double inf = std::numeric_limits<double>::infinity(); |
| 361 | 361 |
| 362 EXPECT_EQ(100, animation->timeToForwardsEffectChange()); | 362 EXPECT_EQ(100, animation->timeToForwardsEffectChange()); |
| 363 EXPECT_EQ(inf, animation->timeToReverseEffectChange()); | 363 EXPECT_EQ(inf, animation->timeToReverseEffectChange()); |
| 364 | 364 |
| 365 player->setCurrentTimeInternal(100); | 365 player->setCurrentTimeInternal(100); |
| 366 EXPECT_EQ(100, animation->timeToForwardsEffectChange()); | 366 EXPECT_EQ(100, animation->timeToForwardsEffectChange()); |
| 367 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 367 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
| 368 | 368 |
| 369 player->setCurrentTimeInternal(199); | 369 player->setCurrentTimeInternal(199); |
| 370 EXPECT_EQ(1, animation->timeToForwardsEffectChange()); | 370 EXPECT_EQ(1, animation->timeToForwardsEffectChange()); |
| 371 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 371 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
| 372 | 372 |
| 373 player->setCurrentTimeInternal(200); | 373 player->setCurrentTimeInternal(200); |
| 374 // End-exclusive. | 374 // End-exclusive. |
| 375 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 375 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
| 376 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 376 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
| 377 | 377 |
| 378 player->setCurrentTimeInternal(300); | 378 player->setCurrentTimeInternal(300); |
| 379 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 379 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
| 380 EXPECT_EQ(100, animation->timeToReverseEffectChange()); | 380 EXPECT_EQ(100, animation->timeToReverseEffectChange()); |
| 381 } | 381 } |
| 382 | 382 |
| 383 TEST_F(AnimationAnimationTest, TimeToEffectChangeWithPlaybackRate) | 383 TEST_F(KeyframeEffectTest, TimeToEffectChangeWithPlaybackRate) |
| 384 { | 384 { |
| 385 Timing timing; | 385 Timing timing; |
| 386 timing.iterationDuration = 100; | 386 timing.iterationDuration = 100; |
| 387 timing.startDelay = 100; | 387 timing.startDelay = 100; |
| 388 timing.endDelay = 100; | 388 timing.endDelay = 100; |
| 389 timing.playbackRate = 2; | 389 timing.playbackRate = 2; |
| 390 timing.fillMode = Timing::FillModeNone; | 390 timing.fillMode = Timing::FillModeNone; |
| 391 RefPtrWillBeRawPtr<Animation> animation = Animation::create(0, nullptr, timi
ng); | 391 RefPtrWillBeRawPtr<KeyframeEffect> animation = KeyframeEffect::create(0, nul
lptr, timing); |
| 392 RefPtrWillBeRawPtr<AnimationPlayer> player = document.timeline().play(animat
ion.get()); | 392 RefPtrWillBeRawPtr<Animation> player = document.timeline().play(animation.ge
t()); |
| 393 double inf = std::numeric_limits<double>::infinity(); | 393 double inf = std::numeric_limits<double>::infinity(); |
| 394 | 394 |
| 395 EXPECT_EQ(100, animation->timeToForwardsEffectChange()); | 395 EXPECT_EQ(100, animation->timeToForwardsEffectChange()); |
| 396 EXPECT_EQ(inf, animation->timeToReverseEffectChange()); | 396 EXPECT_EQ(inf, animation->timeToReverseEffectChange()); |
| 397 | 397 |
| 398 player->setCurrentTimeInternal(100); | 398 player->setCurrentTimeInternal(100); |
| 399 EXPECT_EQ(50, animation->timeToForwardsEffectChange()); | 399 EXPECT_EQ(50, animation->timeToForwardsEffectChange()); |
| 400 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 400 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
| 401 | 401 |
| 402 player->setCurrentTimeInternal(149); | 402 player->setCurrentTimeInternal(149); |
| 403 EXPECT_EQ(1, animation->timeToForwardsEffectChange()); | 403 EXPECT_EQ(1, animation->timeToForwardsEffectChange()); |
| 404 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 404 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
| 405 | 405 |
| 406 player->setCurrentTimeInternal(150); | 406 player->setCurrentTimeInternal(150); |
| 407 // End-exclusive. | 407 // End-exclusive. |
| 408 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 408 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
| 409 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 409 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
| 410 | 410 |
| 411 player->setCurrentTimeInternal(200); | 411 player->setCurrentTimeInternal(200); |
| 412 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 412 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
| 413 EXPECT_EQ(50, animation->timeToReverseEffectChange()); | 413 EXPECT_EQ(50, animation->timeToReverseEffectChange()); |
| 414 } | 414 } |
| 415 | 415 |
| 416 TEST_F(AnimationAnimationTest, TimeToEffectChangeWithNegativePlaybackRate) | 416 TEST_F(KeyframeEffectTest, TimeToEffectChangeWithNegativePlaybackRate) |
| 417 { | 417 { |
| 418 Timing timing; | 418 Timing timing; |
| 419 timing.iterationDuration = 100; | 419 timing.iterationDuration = 100; |
| 420 timing.startDelay = 100; | 420 timing.startDelay = 100; |
| 421 timing.endDelay = 100; | 421 timing.endDelay = 100; |
| 422 timing.playbackRate = -2; | 422 timing.playbackRate = -2; |
| 423 timing.fillMode = Timing::FillModeNone; | 423 timing.fillMode = Timing::FillModeNone; |
| 424 RefPtrWillBeRawPtr<Animation> animation = Animation::create(0, nullptr, timi
ng); | 424 RefPtrWillBeRawPtr<KeyframeEffect> animation = KeyframeEffect::create(0, nul
lptr, timing); |
| 425 RefPtrWillBeRawPtr<AnimationPlayer> player = document.timeline().play(animat
ion.get()); | 425 RefPtrWillBeRawPtr<Animation> player = document.timeline().play(animation.ge
t()); |
| 426 double inf = std::numeric_limits<double>::infinity(); | 426 double inf = std::numeric_limits<double>::infinity(); |
| 427 | 427 |
| 428 EXPECT_EQ(100, animation->timeToForwardsEffectChange()); | 428 EXPECT_EQ(100, animation->timeToForwardsEffectChange()); |
| 429 EXPECT_EQ(inf, animation->timeToReverseEffectChange()); | 429 EXPECT_EQ(inf, animation->timeToReverseEffectChange()); |
| 430 | 430 |
| 431 player->setCurrentTimeInternal(100); | 431 player->setCurrentTimeInternal(100); |
| 432 EXPECT_EQ(50, animation->timeToForwardsEffectChange()); | 432 EXPECT_EQ(50, animation->timeToForwardsEffectChange()); |
| 433 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 433 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
| 434 | 434 |
| 435 player->setCurrentTimeInternal(149); | 435 player->setCurrentTimeInternal(149); |
| 436 EXPECT_EQ(1, animation->timeToForwardsEffectChange()); | 436 EXPECT_EQ(1, animation->timeToForwardsEffectChange()); |
| 437 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 437 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
| 438 | 438 |
| 439 player->setCurrentTimeInternal(150); | 439 player->setCurrentTimeInternal(150); |
| 440 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 440 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
| 441 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 441 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
| 442 | 442 |
| 443 player->setCurrentTimeInternal(200); | 443 player->setCurrentTimeInternal(200); |
| 444 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 444 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
| 445 EXPECT_EQ(50, animation->timeToReverseEffectChange()); | 445 EXPECT_EQ(50, animation->timeToReverseEffectChange()); |
| 446 } | 446 } |
| 447 | 447 |
| 448 TEST_F(AnimationAnimationTest, ElementDestructorClearsAnimationTarget) | 448 TEST_F(KeyframeEffectTest, ElementDestructorClearsAnimationTarget) |
| 449 { | 449 { |
| 450 // This test expects incorrect behaviour should be removed once Element | 450 // This test expects incorrect behaviour should be removed once Element |
| 451 // and Animation are moved to Oilpan. See crbug.com/362404 for context. | 451 // and KeyframeEffect are moved to Oilpan. See crbug.com/362404 for context. |
| 452 Timing timing; | 452 Timing timing; |
| 453 timing.iterationDuration = 5; | 453 timing.iterationDuration = 5; |
| 454 RefPtrWillBeRawPtr<Animation> animation = Animation::create(element.get(), n
ullptr, timing); | 454 RefPtrWillBeRawPtr<KeyframeEffect> animation = KeyframeEffect::create(elemen
t.get(), nullptr, timing); |
| 455 EXPECT_EQ(element.get(), animation->target()); | 455 EXPECT_EQ(element.get(), animation->target()); |
| 456 document.timeline().play(animation.get()); | 456 document.timeline().play(animation.get()); |
| 457 pageHolder.clear(); | 457 pageHolder.clear(); |
| 458 element.clear(); | 458 element.clear(); |
| 459 #if !ENABLE(OILPAN) | 459 #if !ENABLE(OILPAN) |
| 460 EXPECT_EQ(0, animation->target()); | 460 EXPECT_EQ(0, animation->target()); |
| 461 #endif | 461 #endif |
| 462 } | 462 } |
| 463 | 463 |
| 464 } // namespace blink | 464 } // namespace blink |
| OLD | NEW |