| 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/Animation.h" |
| 7 | 7 |
| 8 #include "bindings/v8/Dictionary.h" | 8 #include "bindings/v8/Dictionary.h" |
| 9 #include "core/animation/AnimatableLength.h" | 9 #include "core/animation/AnimatableLength.h" |
| 10 #include "core/animation/AnimationClock.h" | 10 #include "core/animation/AnimationClock.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 : document(Document::create()) | 24 : document(Document::create()) |
| 25 , element(document->createElement("foo", ASSERT_NO_EXCEPTION)) | 25 , element(document->createElement("foo", ASSERT_NO_EXCEPTION)) |
| 26 { | 26 { |
| 27 document->animationClock().resetTimeForTesting(); | 27 document->animationClock().resetTimeForTesting(); |
| 28 document->timeline().setZeroTime(0); | 28 document->timeline().setZeroTime(0); |
| 29 EXPECT_EQ(0, document->timeline().currentTime()); | 29 EXPECT_EQ(0, document->timeline().currentTime()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 RefPtr<Document> document; | 32 RefPtr<Document> document; |
| 33 RefPtr<Element> element; | 33 RefPtr<Element> element; |
| 34 TrackExceptionState exceptionState; |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 class AnimationAnimationV8Test : public AnimationAnimationTest { | 37 class AnimationAnimationV8Test : public AnimationAnimationTest { |
| 37 protected: | 38 protected: |
| 38 AnimationAnimationV8Test() | 39 AnimationAnimationV8Test() |
| 39 : m_isolate(v8::Isolate::GetCurrent()) | 40 : m_isolate(v8::Isolate::GetCurrent()) |
| 40 , m_scope(V8BindingTestScope::create(m_isolate)) | 41 , m_scope(V8BindingTestScope::create(m_isolate)) |
| 41 { | 42 { |
| 42 } | 43 } |
| 43 | 44 |
| 44 template<typename T> | 45 template<typename T> |
| 45 static PassRefPtr<Animation> createAnimation(Element* element, Vector<Dictio
nary> keyframeDictionaryVector, T timingInput) | 46 static PassRefPtr<Animation> createAnimation(Element* element, Vector<Dictio
nary> keyframeDictionaryVector, T timingInput, ExceptionState& exceptionState) |
| 46 { | 47 { |
| 47 return Animation::create(element, EffectInput::convert(element, keyframe
DictionaryVector, true), timingInput); | 48 return Animation::create(element, EffectInput::convert(element, keyframe
DictionaryVector, exceptionState, true), timingInput); |
| 48 } | 49 } |
| 49 static PassRefPtr<Animation> createAnimation(Element* element, Vector<Dictio
nary> keyframeDictionaryVector) | 50 static PassRefPtr<Animation> createAnimation(Element* element, Vector<Dictio
nary> keyframeDictionaryVector, ExceptionState& exceptionState) |
| 50 { | 51 { |
| 51 return Animation::create(element, EffectInput::convert(element, keyframe
DictionaryVector, true)); | 52 return Animation::create(element, EffectInput::convert(element, keyframe
DictionaryVector, exceptionState, true)); |
| 52 } | 53 } |
| 53 | 54 |
| 54 v8::Isolate* m_isolate; | 55 v8::Isolate* m_isolate; |
| 55 | 56 |
| 56 private: | 57 private: |
| 57 OwnPtr<V8BindingTestScope> m_scope; | 58 OwnPtr<V8BindingTestScope> m_scope; |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 TEST_F(AnimationAnimationV8Test, CanCreateAnAnimation) | 61 TEST_F(AnimationAnimationV8Test, CanCreateAnAnimation) |
| 61 { | 62 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 74 jsKeyframes.append(Dictionary(keyframe2, m_isolate)); | 75 jsKeyframes.append(Dictionary(keyframe2, m_isolate)); |
| 75 | 76 |
| 76 String value1; | 77 String value1; |
| 77 ASSERT_TRUE(jsKeyframes[0].get("width", value1)); | 78 ASSERT_TRUE(jsKeyframes[0].get("width", value1)); |
| 78 ASSERT_EQ("100px", value1); | 79 ASSERT_EQ("100px", value1); |
| 79 | 80 |
| 80 String value2; | 81 String value2; |
| 81 ASSERT_TRUE(jsKeyframes[1].get("width", value2)); | 82 ASSERT_TRUE(jsKeyframes[1].get("width", value2)); |
| 82 ASSERT_EQ("0px", value2); | 83 ASSERT_EQ("0px", value2); |
| 83 | 84 |
| 84 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0)
; | 85 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0,
exceptionState); |
| 86 |
| 87 EXPECT_FALSE(exceptionState.hadException()); |
| 85 | 88 |
| 86 Element* target = animation->target(); | 89 Element* target = animation->target(); |
| 87 EXPECT_EQ(*element.get(), *target); | 90 EXPECT_EQ(*element.get(), *target); |
| 88 | 91 |
| 89 const KeyframeEffectModel::KeyframeVector keyframes = | 92 const KeyframeEffectModel::KeyframeVector keyframes = |
| 90 toKeyframeEffectModel(animation->effect())->getFrames(); | 93 toKeyframeEffectModel(animation->effect())->getFrames(); |
| 91 | 94 |
| 92 EXPECT_EQ(0, keyframes[0]->offset()); | 95 EXPECT_EQ(0, keyframes[0]->offset()); |
| 93 EXPECT_EQ(1, keyframes[1]->offset()); | 96 EXPECT_EQ(1, keyframes[1]->offset()); |
| 94 | 97 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 105 | 108 |
| 106 EXPECT_EQ(*(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Eas
eInOut)), *keyframes[0]->easing()); | 109 EXPECT_EQ(*(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Eas
eInOut)), *keyframes[0]->easing()); |
| 107 EXPECT_EQ(*(CubicBezierTimingFunction::create(1, 1, 0.3, 0.3).get()), *keyfr
ames[1]->easing()); | 110 EXPECT_EQ(*(CubicBezierTimingFunction::create(1, 1, 0.3, 0.3).get()), *keyfr
ames[1]->easing()); |
| 108 } | 111 } |
| 109 | 112 |
| 110 TEST_F(AnimationAnimationV8Test, CanSetDuration) | 113 TEST_F(AnimationAnimationV8Test, CanSetDuration) |
| 111 { | 114 { |
| 112 Vector<Dictionary, 0> jsKeyframes; | 115 Vector<Dictionary, 0> jsKeyframes; |
| 113 double duration = 2; | 116 double duration = 2; |
| 114 | 117 |
| 115 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, du
ration); | 118 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, du
ration, exceptionState); |
| 116 | 119 |
| 117 EXPECT_EQ(duration, animation->specifiedTiming().iterationDuration); | 120 EXPECT_EQ(duration, animation->specifiedTiming().iterationDuration); |
| 118 } | 121 } |
| 119 | 122 |
| 120 TEST_F(AnimationAnimationV8Test, CanOmitSpecifiedDuration) | 123 TEST_F(AnimationAnimationV8Test, CanOmitSpecifiedDuration) |
| 121 { | 124 { |
| 122 Vector<Dictionary, 0> jsKeyframes; | 125 Vector<Dictionary, 0> jsKeyframes; |
| 123 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes); | 126 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ex
ceptionState); |
| 124 EXPECT_TRUE(std::isnan(animation->specifiedTiming().iterationDuration)); | 127 EXPECT_TRUE(std::isnan(animation->specifiedTiming().iterationDuration)); |
| 125 } | 128 } |
| 126 | 129 |
| 127 TEST_F(AnimationAnimationV8Test, NegativeDurationIsAuto) | 130 TEST_F(AnimationAnimationV8Test, NegativeDurationIsAuto) |
| 128 { | 131 { |
| 129 Vector<Dictionary, 0> jsKeyframes; | 132 Vector<Dictionary, 0> jsKeyframes; |
| 130 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, -2
); | 133 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, -2
, exceptionState); |
| 131 EXPECT_TRUE(std::isnan(animation->specifiedTiming().iterationDuration)); | 134 EXPECT_TRUE(std::isnan(animation->specifiedTiming().iterationDuration)); |
| 132 } | 135 } |
| 133 | 136 |
| 137 TEST_F(AnimationAnimationV8Test, MismatchedKeyframePropertyRaisesException) |
| 138 { |
| 139 Vector<Dictionary> jsKeyframes; |
| 140 v8::Handle<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
| 141 v8::Handle<v8::Object> keyframe2 = v8::Object::New(m_isolate); |
| 142 |
| 143 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); |
| 144 setV8ObjectPropertyAsString(keyframe1, "offset", "0"); |
| 145 |
| 146 // Height property appears only in keyframe2 |
| 147 setV8ObjectPropertyAsString(keyframe2, "height", "100px"); |
| 148 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); |
| 149 setV8ObjectPropertyAsString(keyframe2, "offset", "1"); |
| 150 |
| 151 jsKeyframes.append(Dictionary(keyframe1, m_isolate)); |
| 152 jsKeyframes.append(Dictionary(keyframe2, m_isolate)); |
| 153 |
| 154 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0,
exceptionState); |
| 155 |
| 156 EXPECT_TRUE(exceptionState.hadException()); |
| 157 EXPECT_EQ(NotSupportedError, exceptionState.code()); |
| 158 } |
| 159 |
| 160 TEST_F(AnimationAnimationV8Test, MissingOffsetZeroRaisesException) |
| 161 { |
| 162 Vector<Dictionary> jsKeyframes; |
| 163 v8::Handle<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
| 164 v8::Handle<v8::Object> keyframe2 = v8::Object::New(m_isolate); |
| 165 |
| 166 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); |
| 167 setV8ObjectPropertyAsString(keyframe1, "offset", "0.1"); |
| 168 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); |
| 169 setV8ObjectPropertyAsString(keyframe2, "offset", "1"); |
| 170 |
| 171 jsKeyframes.append(Dictionary(keyframe1, m_isolate)); |
| 172 jsKeyframes.append(Dictionary(keyframe2, m_isolate)); |
| 173 |
| 174 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0,
exceptionState); |
| 175 |
| 176 EXPECT_TRUE(exceptionState.hadException()); |
| 177 EXPECT_EQ(NotSupportedError, exceptionState.code()); |
| 178 } |
| 179 |
| 180 TEST_F(AnimationAnimationV8Test, MissingOffsetOneRaisesException) |
| 181 { |
| 182 Vector<Dictionary> jsKeyframes; |
| 183 v8::Handle<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
| 184 v8::Handle<v8::Object> keyframe2 = v8::Object::New(m_isolate); |
| 185 |
| 186 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); |
| 187 setV8ObjectPropertyAsString(keyframe1, "offset", "0"); |
| 188 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); |
| 189 setV8ObjectPropertyAsString(keyframe2, "offset", "0.1"); |
| 190 |
| 191 jsKeyframes.append(Dictionary(keyframe1, m_isolate)); |
| 192 jsKeyframes.append(Dictionary(keyframe2, m_isolate)); |
| 193 |
| 194 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0,
exceptionState); |
| 195 |
| 196 EXPECT_TRUE(exceptionState.hadException()); |
| 197 EXPECT_EQ(NotSupportedError, exceptionState.code()); |
| 198 } |
| 199 |
| 200 TEST_F(AnimationAnimationV8Test, MissingOffsetZeroAndOneRaisesException) |
| 201 { |
| 202 Vector<Dictionary> jsKeyframes; |
| 203 v8::Handle<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
| 204 v8::Handle<v8::Object> keyframe2 = v8::Object::New(m_isolate); |
| 205 |
| 206 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); |
| 207 setV8ObjectPropertyAsString(keyframe1, "offset", "0.1"); |
| 208 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); |
| 209 setV8ObjectPropertyAsString(keyframe2, "offset", "0.2"); |
| 210 |
| 211 jsKeyframes.append(Dictionary(keyframe1, m_isolate)); |
| 212 jsKeyframes.append(Dictionary(keyframe2, m_isolate)); |
| 213 |
| 214 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0,
exceptionState); |
| 215 |
| 216 EXPECT_TRUE(exceptionState.hadException()); |
| 217 EXPECT_EQ(NotSupportedError, exceptionState.code()); |
| 218 } |
| 219 |
| 134 TEST_F(AnimationAnimationV8Test, SpecifiedGetters) | 220 TEST_F(AnimationAnimationV8Test, SpecifiedGetters) |
| 135 { | 221 { |
| 136 Vector<Dictionary, 0> jsKeyframes; | 222 Vector<Dictionary, 0> jsKeyframes; |
| 137 | 223 |
| 138 v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate); | 224 v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate); |
| 139 setV8ObjectPropertyAsNumber(timingInput, "delay", 2); | 225 setV8ObjectPropertyAsNumber(timingInput, "delay", 2); |
| 140 setV8ObjectPropertyAsNumber(timingInput, "endDelay", 0.5); | 226 setV8ObjectPropertyAsNumber(timingInput, "endDelay", 0.5); |
| 141 setV8ObjectPropertyAsString(timingInput, "fill", "backwards"); | 227 setV8ObjectPropertyAsString(timingInput, "fill", "backwards"); |
| 142 setV8ObjectPropertyAsNumber(timingInput, "iterationStart", 2); | 228 setV8ObjectPropertyAsNumber(timingInput, "iterationStart", 2); |
| 143 setV8ObjectPropertyAsNumber(timingInput, "iterations", 10); | 229 setV8ObjectPropertyAsNumber(timingInput, "iterations", 10); |
| 144 setV8ObjectPropertyAsNumber(timingInput, "playbackRate", 2); | 230 setV8ObjectPropertyAsNumber(timingInput, "playbackRate", 2); |
| 145 setV8ObjectPropertyAsString(timingInput, "direction", "reverse"); | 231 setV8ObjectPropertyAsString(timingInput, "direction", "reverse"); |
| 146 setV8ObjectPropertyAsString(timingInput, "easing", "step-start"); | 232 setV8ObjectPropertyAsString(timingInput, "easing", "step-start"); |
| 147 Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(ti
mingInput), m_isolate); | 233 Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(ti
mingInput), m_isolate); |
| 148 | 234 |
| 149 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ti
mingInputDictionary); | 235 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ti
mingInputDictionary, exceptionState); |
| 150 | 236 |
| 151 RefPtr<TimedItemTiming> specified = animation->specified(); | 237 RefPtr<TimedItemTiming> specified = animation->specified(); |
| 152 EXPECT_EQ(2, specified->delay()); | 238 EXPECT_EQ(2, specified->delay()); |
| 153 EXPECT_EQ(0.5, specified->endDelay()); | 239 EXPECT_EQ(0.5, specified->endDelay()); |
| 154 EXPECT_EQ("backwards", specified->fill()); | 240 EXPECT_EQ("backwards", specified->fill()); |
| 155 EXPECT_EQ(2, specified->iterationStart()); | 241 EXPECT_EQ(2, specified->iterationStart()); |
| 156 EXPECT_EQ(10, specified->iterations()); | 242 EXPECT_EQ(10, specified->iterations()); |
| 157 EXPECT_EQ(2, specified->playbackRate()); | 243 EXPECT_EQ(2, specified->playbackRate()); |
| 158 EXPECT_EQ("reverse", specified->direction()); | 244 EXPECT_EQ("reverse", specified->direction()); |
| 159 EXPECT_EQ("step-start", specified->easing()); | 245 EXPECT_EQ("step-start", specified->easing()); |
| 160 } | 246 } |
| 161 | 247 |
| 162 TEST_F(AnimationAnimationV8Test, SpecifiedDurationGetter) | 248 TEST_F(AnimationAnimationV8Test, SpecifiedDurationGetter) |
| 163 { | 249 { |
| 164 Vector<Dictionary, 0> jsKeyframes; | 250 Vector<Dictionary, 0> jsKeyframes; |
| 165 | 251 |
| 166 v8::Handle<v8::Object> timingInputWithDuration = v8::Object::New(m_isolate); | 252 v8::Handle<v8::Object> timingInputWithDuration = v8::Object::New(m_isolate); |
| 167 setV8ObjectPropertyAsNumber(timingInputWithDuration, "duration", 2.5); | 253 setV8ObjectPropertyAsNumber(timingInputWithDuration, "duration", 2.5); |
| 168 Dictionary timingInputDictionaryWithDuration = Dictionary(v8::Handle<v8::Val
ue>::Cast(timingInputWithDuration), m_isolate); | 254 Dictionary timingInputDictionaryWithDuration = Dictionary(v8::Handle<v8::Val
ue>::Cast(timingInputWithDuration), m_isolate); |
| 169 | 255 |
| 170 RefPtr<Animation> animationWithDuration = createAnimation(element.get(), jsK
eyframes, timingInputDictionaryWithDuration); | 256 RefPtr<Animation> animationWithDuration = createAnimation(element.get(), jsK
eyframes, timingInputDictionaryWithDuration, exceptionState); |
| 171 | 257 |
| 172 RefPtr<TimedItemTiming> specifiedWithDuration = animationWithDuration->speci
fied(); | 258 RefPtr<TimedItemTiming> specifiedWithDuration = animationWithDuration->speci
fied(); |
| 173 bool isNumber = false; | 259 bool isNumber = false; |
| 174 double numberDuration = std::numeric_limits<double>::quiet_NaN(); | 260 double numberDuration = std::numeric_limits<double>::quiet_NaN(); |
| 175 bool isString = false; | 261 bool isString = false; |
| 176 String stringDuration = ""; | 262 String stringDuration = ""; |
| 177 specifiedWithDuration->getDuration("duration", isNumber, numberDuration, isS
tring, stringDuration); | 263 specifiedWithDuration->getDuration("duration", isNumber, numberDuration, isS
tring, stringDuration); |
| 178 EXPECT_TRUE(isNumber); | 264 EXPECT_TRUE(isNumber); |
| 179 EXPECT_EQ(2.5, numberDuration); | 265 EXPECT_EQ(2.5, numberDuration); |
| 180 EXPECT_FALSE(isString); | 266 EXPECT_FALSE(isString); |
| 181 EXPECT_EQ("", stringDuration); | 267 EXPECT_EQ("", stringDuration); |
| 182 | 268 |
| 183 | 269 |
| 184 v8::Handle<v8::Object> timingInputNoDuration = v8::Object::New(m_isolate); | 270 v8::Handle<v8::Object> timingInputNoDuration = v8::Object::New(m_isolate); |
| 185 Dictionary timingInputDictionaryNoDuration = Dictionary(v8::Handle<v8::Value
>::Cast(timingInputNoDuration), m_isolate); | 271 Dictionary timingInputDictionaryNoDuration = Dictionary(v8::Handle<v8::Value
>::Cast(timingInputNoDuration), m_isolate); |
| 186 | 272 |
| 187 RefPtr<Animation> animationNoDuration = createAnimation(element.get(), jsKey
frames, timingInputDictionaryNoDuration); | 273 RefPtr<Animation> animationNoDuration = createAnimation(element.get(), jsKey
frames, timingInputDictionaryNoDuration, exceptionState); |
| 188 | 274 |
| 189 RefPtr<TimedItemTiming> specifiedNoDuration = animationNoDuration->specified
(); | 275 RefPtr<TimedItemTiming> specifiedNoDuration = animationNoDuration->specified
(); |
| 190 isNumber = false; | 276 isNumber = false; |
| 191 numberDuration = std::numeric_limits<double>::quiet_NaN(); | 277 numberDuration = std::numeric_limits<double>::quiet_NaN(); |
| 192 isString = false; | 278 isString = false; |
| 193 stringDuration = ""; | 279 stringDuration = ""; |
| 194 specifiedNoDuration->getDuration("duration", isNumber, numberDuration, isStr
ing, stringDuration); | 280 specifiedNoDuration->getDuration("duration", isNumber, numberDuration, isStr
ing, stringDuration); |
| 195 EXPECT_FALSE(isNumber); | 281 EXPECT_FALSE(isNumber); |
| 196 EXPECT_TRUE(std::isnan(numberDuration)); | 282 EXPECT_TRUE(std::isnan(numberDuration)); |
| 197 EXPECT_TRUE(isString); | 283 EXPECT_TRUE(isString); |
| 198 EXPECT_EQ("auto", stringDuration); | 284 EXPECT_EQ("auto", stringDuration); |
| 199 } | 285 } |
| 200 | 286 |
| 201 TEST_F(AnimationAnimationV8Test, SpecifiedSetters) | 287 TEST_F(AnimationAnimationV8Test, SpecifiedSetters) |
| 202 { | 288 { |
| 203 Vector<Dictionary, 0> jsKeyframes; | 289 Vector<Dictionary, 0> jsKeyframes; |
| 204 v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate); | 290 v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate); |
| 205 Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(ti
mingInput), m_isolate); | 291 Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(ti
mingInput), m_isolate); |
| 206 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ti
mingInputDictionary); | 292 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ti
mingInputDictionary, exceptionState); |
| 207 | 293 |
| 208 RefPtr<TimedItemTiming> specified = animation->specified(); | 294 RefPtr<TimedItemTiming> specified = animation->specified(); |
| 209 | 295 |
| 210 EXPECT_EQ(0, specified->delay()); | 296 EXPECT_EQ(0, specified->delay()); |
| 211 specified->setDelay(2); | 297 specified->setDelay(2); |
| 212 EXPECT_EQ(2, specified->delay()); | 298 EXPECT_EQ(2, specified->delay()); |
| 213 | 299 |
| 214 EXPECT_EQ(0, specified->endDelay()); | 300 EXPECT_EQ(0, specified->endDelay()); |
| 215 specified->setEndDelay(0.5); | 301 specified->setEndDelay(0.5); |
| 216 EXPECT_EQ(0.5, specified->endDelay()); | 302 EXPECT_EQ(0.5, specified->endDelay()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 238 EXPECT_EQ("linear", specified->easing()); | 324 EXPECT_EQ("linear", specified->easing()); |
| 239 specified->setEasing("step-start"); | 325 specified->setEasing("step-start"); |
| 240 EXPECT_EQ("step-start", specified->easing()); | 326 EXPECT_EQ("step-start", specified->easing()); |
| 241 } | 327 } |
| 242 | 328 |
| 243 TEST_F(AnimationAnimationV8Test, SetSpecifiedDuration) | 329 TEST_F(AnimationAnimationV8Test, SetSpecifiedDuration) |
| 244 { | 330 { |
| 245 Vector<Dictionary, 0> jsKeyframes; | 331 Vector<Dictionary, 0> jsKeyframes; |
| 246 v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate); | 332 v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate); |
| 247 Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(ti
mingInput), m_isolate); | 333 Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(ti
mingInput), m_isolate); |
| 248 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ti
mingInputDictionary); | 334 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ti
mingInputDictionary, exceptionState); |
| 249 | 335 |
| 250 RefPtr<TimedItemTiming> specified = animation->specified(); | 336 RefPtr<TimedItemTiming> specified = animation->specified(); |
| 251 | 337 |
| 252 bool isNumber = false; | 338 bool isNumber = false; |
| 253 double numberDuration = std::numeric_limits<double>::quiet_NaN(); | 339 double numberDuration = std::numeric_limits<double>::quiet_NaN(); |
| 254 bool isString = false; | 340 bool isString = false; |
| 255 String stringDuration = ""; | 341 String stringDuration = ""; |
| 256 specified->getDuration("duration", isNumber, numberDuration, isString, strin
gDuration); | 342 specified->getDuration("duration", isNumber, numberDuration, isString, strin
gDuration); |
| 257 EXPECT_FALSE(isNumber); | 343 EXPECT_FALSE(isNumber); |
| 258 EXPECT_TRUE(std::isnan(numberDuration)); | 344 EXPECT_TRUE(std::isnan(numberDuration)); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 player->setCurrentTime(150); | 448 player->setCurrentTime(150); |
| 363 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 449 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
| 364 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 450 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
| 365 | 451 |
| 366 player->setCurrentTime(200); | 452 player->setCurrentTime(200); |
| 367 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 453 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
| 368 EXPECT_EQ(50, animation->timeToReverseEffectChange()); | 454 EXPECT_EQ(50, animation->timeToReverseEffectChange()); |
| 369 } | 455 } |
| 370 | 456 |
| 371 } // namespace WebCore | 457 } // namespace WebCore |
| OLD | NEW |