Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: third_party/WebKit/Source/core/animation/KeyframeEffectTest.cpp

Issue 1906463002: Web Animations: Throw TypeErrors for invalid timing parameters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "core/animation/KeyframeEffect.h" 5 #include "core/animation/KeyframeEffect.h"
6 6
7 #include "bindings/core/v8/Dictionary.h" 7 #include "bindings/core/v8/Dictionary.h"
8 #include "bindings/core/v8/UnionTypesCore.h" 8 #include "bindings/core/v8/UnionTypesCore.h"
9 #include "bindings/core/v8/V8BindingForTesting.h" 9 #include "bindings/core/v8/V8BindingForTesting.h"
10 #include "bindings/core/v8/V8KeyframeEffectOptions.h" 10 #include "bindings/core/v8/V8KeyframeEffectOptions.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 EXPECT_EQ(0, specified->endDelay()); 214 EXPECT_EQ(0, specified->endDelay());
215 specified->setEndDelay(0.5); 215 specified->setEndDelay(0.5);
216 EXPECT_EQ(0.5, specified->endDelay()); 216 EXPECT_EQ(0.5, specified->endDelay());
217 217
218 EXPECT_EQ("auto", specified->fill()); 218 EXPECT_EQ("auto", specified->fill());
219 specified->setFill("backwards"); 219 specified->setFill("backwards");
220 EXPECT_EQ("backwards", specified->fill()); 220 EXPECT_EQ("backwards", specified->fill());
221 221
222 EXPECT_EQ(0, specified->iterationStart()); 222 EXPECT_EQ(0, specified->iterationStart());
223 specified->setIterationStart(2); 223 specified->setIterationStart(2, exceptionState);
224 ASSERT_FALSE(exceptionState.hadException());
224 EXPECT_EQ(2, specified->iterationStart()); 225 EXPECT_EQ(2, specified->iterationStart());
225 226
226 EXPECT_EQ(1, specified->iterations()); 227 EXPECT_EQ(1, specified->iterations());
227 specified->setIterations(10); 228 specified->setIterations(10, exceptionState);
229 ASSERT_FALSE(exceptionState.hadException());
228 EXPECT_EQ(10, specified->iterations()); 230 EXPECT_EQ(10, specified->iterations());
229 231
230 EXPECT_EQ(1, specified->playbackRate()); 232 EXPECT_EQ(1, specified->playbackRate());
231 specified->setPlaybackRate(2); 233 specified->setPlaybackRate(2);
232 EXPECT_EQ(2, specified->playbackRate()); 234 EXPECT_EQ(2, specified->playbackRate());
233 235
234 EXPECT_EQ("normal", specified->direction()); 236 EXPECT_EQ("normal", specified->direction());
235 specified->setDirection("reverse"); 237 specified->setDirection("reverse");
236 EXPECT_EQ("reverse", specified->direction()); 238 EXPECT_EQ("reverse", specified->direction());
237 239
(...skipping 14 matching lines...) Expand all
252 AnimationEffectTiming* specified = animation->timing(); 254 AnimationEffectTiming* specified = animation->timing();
253 255
254 UnrestrictedDoubleOrString duration; 256 UnrestrictedDoubleOrString duration;
255 specified->duration(duration); 257 specified->duration(duration);
256 EXPECT_FALSE(duration.isUnrestrictedDouble()); 258 EXPECT_FALSE(duration.isUnrestrictedDouble());
257 EXPECT_TRUE(duration.isString()); 259 EXPECT_TRUE(duration.isString());
258 EXPECT_EQ("auto", duration.getAsString()); 260 EXPECT_EQ("auto", duration.getAsString());
259 261
260 UnrestrictedDoubleOrString inDuration; 262 UnrestrictedDoubleOrString inDuration;
261 inDuration.setUnrestrictedDouble(2.5); 263 inDuration.setUnrestrictedDouble(2.5);
262 specified->setDuration(inDuration); 264 specified->setDuration(inDuration, exceptionState);
265 ASSERT_FALSE(exceptionState.hadException());
263 UnrestrictedDoubleOrString duration2; 266 UnrestrictedDoubleOrString duration2;
264 specified->duration(duration2); 267 specified->duration(duration2);
265 EXPECT_TRUE(duration2.isUnrestrictedDouble()); 268 EXPECT_TRUE(duration2.isUnrestrictedDouble());
266 EXPECT_EQ(2.5, duration2.getAsUnrestrictedDouble()); 269 EXPECT_EQ(2.5, duration2.getAsUnrestrictedDouble());
267 EXPECT_FALSE(duration2.isString()); 270 EXPECT_FALSE(duration2.isString());
268 } 271 }
269 272
270 TEST_F(KeyframeEffectTest, TimeToEffectChange) 273 TEST_F(KeyframeEffectTest, TimeToEffectChange)
271 { 274 {
272 Timing timing; 275 Timing timing;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 Timing timing; 374 Timing timing;
372 timing.iterationDuration = 5; 375 timing.iterationDuration = 5;
373 KeyframeEffect* animation = KeyframeEffect::create(element.get(), nullptr, t iming); 376 KeyframeEffect* animation = KeyframeEffect::create(element.get(), nullptr, t iming);
374 EXPECT_EQ(element.get(), animation->target()); 377 EXPECT_EQ(element.get(), animation->target());
375 document().timeline().play(animation); 378 document().timeline().play(animation);
376 pageHolder.clear(); 379 pageHolder.clear();
377 element.clear(); 380 element.clear();
378 } 381 }
379 382
380 } // namespace blink 383 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698