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