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, MissingOffsetZero) |
| 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_FALSE(exceptionState.hadException()); |
| 177 } |
| 178 |
| 179 TEST_F(AnimationAnimationV8Test, MissingOffsetOne) |
| 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_FALSE(exceptionState.hadException()); |
| 196 } |
| 197 |
| 198 TEST_F(AnimationAnimationV8Test, MissingOffsetZeroAndOne) |
| 199 { |
| 200 Vector<Dictionary> jsKeyframes; |
| 201 v8::Handle<v8::Object> keyframe1 = v8::Object::New(m_isolate); |
| 202 v8::Handle<v8::Object> keyframe2 = v8::Object::New(m_isolate); |
| 203 |
| 204 setV8ObjectPropertyAsString(keyframe1, "width", "100px"); |
| 205 setV8ObjectPropertyAsString(keyframe1, "offset", "0.1"); |
| 206 setV8ObjectPropertyAsString(keyframe2, "width", "0px"); |
| 207 setV8ObjectPropertyAsString(keyframe2, "offset", "0.2"); |
| 208 |
| 209 jsKeyframes.append(Dictionary(keyframe1, m_isolate)); |
| 210 jsKeyframes.append(Dictionary(keyframe2, m_isolate)); |
| 211 |
| 212 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0,
exceptionState); |
| 213 |
| 214 EXPECT_FALSE(exceptionState.hadException()); |
| 215 } |
| 216 |
134 TEST_F(AnimationAnimationV8Test, SpecifiedGetters) | 217 TEST_F(AnimationAnimationV8Test, SpecifiedGetters) |
135 { | 218 { |
136 Vector<Dictionary, 0> jsKeyframes; | 219 Vector<Dictionary, 0> jsKeyframes; |
137 | 220 |
138 v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate); | 221 v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate); |
139 setV8ObjectPropertyAsNumber(timingInput, "delay", 2); | 222 setV8ObjectPropertyAsNumber(timingInput, "delay", 2); |
140 setV8ObjectPropertyAsNumber(timingInput, "endDelay", 0.5); | 223 setV8ObjectPropertyAsNumber(timingInput, "endDelay", 0.5); |
141 setV8ObjectPropertyAsString(timingInput, "fill", "backwards"); | 224 setV8ObjectPropertyAsString(timingInput, "fill", "backwards"); |
142 setV8ObjectPropertyAsNumber(timingInput, "iterationStart", 2); | 225 setV8ObjectPropertyAsNumber(timingInput, "iterationStart", 2); |
143 setV8ObjectPropertyAsNumber(timingInput, "iterations", 10); | 226 setV8ObjectPropertyAsNumber(timingInput, "iterations", 10); |
144 setV8ObjectPropertyAsNumber(timingInput, "playbackRate", 2); | 227 setV8ObjectPropertyAsNumber(timingInput, "playbackRate", 2); |
145 setV8ObjectPropertyAsString(timingInput, "direction", "reverse"); | 228 setV8ObjectPropertyAsString(timingInput, "direction", "reverse"); |
146 setV8ObjectPropertyAsString(timingInput, "easing", "step-start"); | 229 setV8ObjectPropertyAsString(timingInput, "easing", "step-start"); |
147 Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(ti
mingInput), m_isolate); | 230 Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(ti
mingInput), m_isolate); |
148 | 231 |
149 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ti
mingInputDictionary); | 232 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ti
mingInputDictionary, exceptionState); |
150 | 233 |
151 RefPtr<TimedItemTiming> specified = animation->specified(); | 234 RefPtr<TimedItemTiming> specified = animation->specified(); |
152 EXPECT_EQ(2, specified->delay()); | 235 EXPECT_EQ(2, specified->delay()); |
153 EXPECT_EQ(0.5, specified->endDelay()); | 236 EXPECT_EQ(0.5, specified->endDelay()); |
154 EXPECT_EQ("backwards", specified->fill()); | 237 EXPECT_EQ("backwards", specified->fill()); |
155 EXPECT_EQ(2, specified->iterationStart()); | 238 EXPECT_EQ(2, specified->iterationStart()); |
156 EXPECT_EQ(10, specified->iterations()); | 239 EXPECT_EQ(10, specified->iterations()); |
157 EXPECT_EQ(2, specified->playbackRate()); | 240 EXPECT_EQ(2, specified->playbackRate()); |
158 EXPECT_EQ("reverse", specified->direction()); | 241 EXPECT_EQ("reverse", specified->direction()); |
159 EXPECT_EQ("step-start", specified->easing()); | 242 EXPECT_EQ("step-start", specified->easing()); |
160 } | 243 } |
161 | 244 |
162 TEST_F(AnimationAnimationV8Test, SpecifiedDurationGetter) | 245 TEST_F(AnimationAnimationV8Test, SpecifiedDurationGetter) |
163 { | 246 { |
164 Vector<Dictionary, 0> jsKeyframes; | 247 Vector<Dictionary, 0> jsKeyframes; |
165 | 248 |
166 v8::Handle<v8::Object> timingInputWithDuration = v8::Object::New(m_isolate); | 249 v8::Handle<v8::Object> timingInputWithDuration = v8::Object::New(m_isolate); |
167 setV8ObjectPropertyAsNumber(timingInputWithDuration, "duration", 2.5); | 250 setV8ObjectPropertyAsNumber(timingInputWithDuration, "duration", 2.5); |
168 Dictionary timingInputDictionaryWithDuration = Dictionary(v8::Handle<v8::Val
ue>::Cast(timingInputWithDuration), m_isolate); | 251 Dictionary timingInputDictionaryWithDuration = Dictionary(v8::Handle<v8::Val
ue>::Cast(timingInputWithDuration), m_isolate); |
169 | 252 |
170 RefPtr<Animation> animationWithDuration = createAnimation(element.get(), jsK
eyframes, timingInputDictionaryWithDuration); | 253 RefPtr<Animation> animationWithDuration = createAnimation(element.get(), jsK
eyframes, timingInputDictionaryWithDuration, exceptionState); |
171 | 254 |
172 RefPtr<TimedItemTiming> specifiedWithDuration = animationWithDuration->speci
fied(); | 255 RefPtr<TimedItemTiming> specifiedWithDuration = animationWithDuration->speci
fied(); |
173 bool isNumber = false; | 256 bool isNumber = false; |
174 double numberDuration = std::numeric_limits<double>::quiet_NaN(); | 257 double numberDuration = std::numeric_limits<double>::quiet_NaN(); |
175 bool isString = false; | 258 bool isString = false; |
176 String stringDuration = ""; | 259 String stringDuration = ""; |
177 specifiedWithDuration->getDuration("duration", isNumber, numberDuration, isS
tring, stringDuration); | 260 specifiedWithDuration->getDuration("duration", isNumber, numberDuration, isS
tring, stringDuration); |
178 EXPECT_TRUE(isNumber); | 261 EXPECT_TRUE(isNumber); |
179 EXPECT_EQ(2.5, numberDuration); | 262 EXPECT_EQ(2.5, numberDuration); |
180 EXPECT_FALSE(isString); | 263 EXPECT_FALSE(isString); |
181 EXPECT_EQ("", stringDuration); | 264 EXPECT_EQ("", stringDuration); |
182 | 265 |
183 | 266 |
184 v8::Handle<v8::Object> timingInputNoDuration = v8::Object::New(m_isolate); | 267 v8::Handle<v8::Object> timingInputNoDuration = v8::Object::New(m_isolate); |
185 Dictionary timingInputDictionaryNoDuration = Dictionary(v8::Handle<v8::Value
>::Cast(timingInputNoDuration), m_isolate); | 268 Dictionary timingInputDictionaryNoDuration = Dictionary(v8::Handle<v8::Value
>::Cast(timingInputNoDuration), m_isolate); |
186 | 269 |
187 RefPtr<Animation> animationNoDuration = createAnimation(element.get(), jsKey
frames, timingInputDictionaryNoDuration); | 270 RefPtr<Animation> animationNoDuration = createAnimation(element.get(), jsKey
frames, timingInputDictionaryNoDuration, exceptionState); |
188 | 271 |
189 RefPtr<TimedItemTiming> specifiedNoDuration = animationNoDuration->specified
(); | 272 RefPtr<TimedItemTiming> specifiedNoDuration = animationNoDuration->specified
(); |
190 isNumber = false; | 273 isNumber = false; |
191 numberDuration = std::numeric_limits<double>::quiet_NaN(); | 274 numberDuration = std::numeric_limits<double>::quiet_NaN(); |
192 isString = false; | 275 isString = false; |
193 stringDuration = ""; | 276 stringDuration = ""; |
194 specifiedNoDuration->getDuration("duration", isNumber, numberDuration, isStr
ing, stringDuration); | 277 specifiedNoDuration->getDuration("duration", isNumber, numberDuration, isStr
ing, stringDuration); |
195 EXPECT_FALSE(isNumber); | 278 EXPECT_FALSE(isNumber); |
196 EXPECT_TRUE(std::isnan(numberDuration)); | 279 EXPECT_TRUE(std::isnan(numberDuration)); |
197 EXPECT_TRUE(isString); | 280 EXPECT_TRUE(isString); |
198 EXPECT_EQ("auto", stringDuration); | 281 EXPECT_EQ("auto", stringDuration); |
199 } | 282 } |
200 | 283 |
201 TEST_F(AnimationAnimationV8Test, SpecifiedSetters) | 284 TEST_F(AnimationAnimationV8Test, SpecifiedSetters) |
202 { | 285 { |
203 Vector<Dictionary, 0> jsKeyframes; | 286 Vector<Dictionary, 0> jsKeyframes; |
204 v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate); | 287 v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate); |
205 Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(ti
mingInput), m_isolate); | 288 Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(ti
mingInput), m_isolate); |
206 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ti
mingInputDictionary); | 289 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ti
mingInputDictionary, exceptionState); |
207 | 290 |
208 RefPtr<TimedItemTiming> specified = animation->specified(); | 291 RefPtr<TimedItemTiming> specified = animation->specified(); |
209 | 292 |
210 EXPECT_EQ(0, specified->delay()); | 293 EXPECT_EQ(0, specified->delay()); |
211 specified->setDelay(2); | 294 specified->setDelay(2); |
212 EXPECT_EQ(2, specified->delay()); | 295 EXPECT_EQ(2, specified->delay()); |
213 | 296 |
214 EXPECT_EQ(0, specified->endDelay()); | 297 EXPECT_EQ(0, specified->endDelay()); |
215 specified->setEndDelay(0.5); | 298 specified->setEndDelay(0.5); |
216 EXPECT_EQ(0.5, specified->endDelay()); | 299 EXPECT_EQ(0.5, specified->endDelay()); |
(...skipping 21 matching lines...) Expand all Loading... |
238 EXPECT_EQ("linear", specified->easing()); | 321 EXPECT_EQ("linear", specified->easing()); |
239 specified->setEasing("step-start"); | 322 specified->setEasing("step-start"); |
240 EXPECT_EQ("step-start", specified->easing()); | 323 EXPECT_EQ("step-start", specified->easing()); |
241 } | 324 } |
242 | 325 |
243 TEST_F(AnimationAnimationV8Test, SetSpecifiedDuration) | 326 TEST_F(AnimationAnimationV8Test, SetSpecifiedDuration) |
244 { | 327 { |
245 Vector<Dictionary, 0> jsKeyframes; | 328 Vector<Dictionary, 0> jsKeyframes; |
246 v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate); | 329 v8::Handle<v8::Object> timingInput = v8::Object::New(m_isolate); |
247 Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(ti
mingInput), m_isolate); | 330 Dictionary timingInputDictionary = Dictionary(v8::Handle<v8::Value>::Cast(ti
mingInput), m_isolate); |
248 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ti
mingInputDictionary); | 331 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, ti
mingInputDictionary, exceptionState); |
249 | 332 |
250 RefPtr<TimedItemTiming> specified = animation->specified(); | 333 RefPtr<TimedItemTiming> specified = animation->specified(); |
251 | 334 |
252 bool isNumber = false; | 335 bool isNumber = false; |
253 double numberDuration = std::numeric_limits<double>::quiet_NaN(); | 336 double numberDuration = std::numeric_limits<double>::quiet_NaN(); |
254 bool isString = false; | 337 bool isString = false; |
255 String stringDuration = ""; | 338 String stringDuration = ""; |
256 specified->getDuration("duration", isNumber, numberDuration, isString, strin
gDuration); | 339 specified->getDuration("duration", isNumber, numberDuration, isString, strin
gDuration); |
257 EXPECT_FALSE(isNumber); | 340 EXPECT_FALSE(isNumber); |
258 EXPECT_TRUE(std::isnan(numberDuration)); | 341 EXPECT_TRUE(std::isnan(numberDuration)); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 player->setCurrentTime(150); | 445 player->setCurrentTime(150); |
363 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 446 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
364 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 447 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
365 | 448 |
366 player->setCurrentTime(200); | 449 player->setCurrentTime(200); |
367 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 450 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
368 EXPECT_EQ(50, animation->timeToReverseEffectChange()); | 451 EXPECT_EQ(50, animation->timeToReverseEffectChange()); |
369 } | 452 } |
370 | 453 |
371 } // namespace WebCore | 454 } // namespace WebCore |
OLD | NEW |