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

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

Issue 2330283004: Fix serialization of step timing functions (Closed)
Patch Set: Update step timing function parsing in devtools Created 4 years, 3 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/DictionarySequenceOrDictionary.h" 8 #include "bindings/core/v8/DictionarySequenceOrDictionary.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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 V8TestingScope scope; 122 V8TestingScope scope;
123 Vector<Dictionary, 0> jsKeyframes; 123 Vector<Dictionary, 0> jsKeyframes;
124 124
125 v8::Local<v8::Object> timingInput = v8::Object::New(scope.isolate()); 125 v8::Local<v8::Object> timingInput = v8::Object::New(scope.isolate());
126 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "delay", 2); 126 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "delay", 2);
127 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "endDelay", 0.5); 127 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "endDelay", 0.5);
128 setV8ObjectPropertyAsString(scope.isolate(), timingInput, "fill", "backwards "); 128 setV8ObjectPropertyAsString(scope.isolate(), timingInput, "fill", "backwards ");
129 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "iterationStart", 2); 129 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "iterationStart", 2);
130 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "iterations", 10); 130 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "iterations", 10);
131 setV8ObjectPropertyAsString(scope.isolate(), timingInput, "direction", "reve rse"); 131 setV8ObjectPropertyAsString(scope.isolate(), timingInput, "direction", "reve rse");
132 setV8ObjectPropertyAsString(scope.isolate(), timingInput, "easing", "step-st art"); 132 setV8ObjectPropertyAsString(scope.isolate(), timingInput, "easing", "ease-in -out");
133 KeyframeEffectOptions timingInputDictionary; 133 KeyframeEffectOptions timingInputDictionary;
134 TrackExceptionState exceptionState; 134 TrackExceptionState exceptionState;
135 V8KeyframeEffectOptions::toImpl(scope.isolate(), timingInput, timingInputDic tionary, exceptionState); 135 V8KeyframeEffectOptions::toImpl(scope.isolate(), timingInput, timingInputDic tionary, exceptionState);
136 EXPECT_FALSE(exceptionState.hadException()); 136 EXPECT_FALSE(exceptionState.hadException());
137 137
138 KeyframeEffect* animation = createAnimation(element.get(), jsKeyframes, timi ngInputDictionary); 138 KeyframeEffect* animation = createAnimation(element.get(), jsKeyframes, timi ngInputDictionary);
139 139
140 AnimationEffectTiming* specified = animation->timing(); 140 AnimationEffectTiming* specified = animation->timing();
141 EXPECT_EQ(2, specified->delay()); 141 EXPECT_EQ(2, specified->delay());
142 EXPECT_EQ(0.5, specified->endDelay()); 142 EXPECT_EQ(0.5, specified->endDelay());
143 EXPECT_EQ("backwards", specified->fill()); 143 EXPECT_EQ("backwards", specified->fill());
144 EXPECT_EQ(2, specified->iterationStart()); 144 EXPECT_EQ(2, specified->iterationStart());
145 EXPECT_EQ(10, specified->iterations()); 145 EXPECT_EQ(10, specified->iterations());
146 EXPECT_EQ("reverse", specified->direction()); 146 EXPECT_EQ("reverse", specified->direction());
147 EXPECT_EQ("step-start", specified->easing()); 147 EXPECT_EQ("ease-in-out", specified->easing());
148 } 148 }
149 149
150 TEST_F(AnimationKeyframeEffectV8Test, SpecifiedDurationGetter) 150 TEST_F(AnimationKeyframeEffectV8Test, SpecifiedDurationGetter)
151 { 151 {
152 V8TestingScope scope; 152 V8TestingScope scope;
153 Vector<Dictionary, 0> jsKeyframes; 153 Vector<Dictionary, 0> jsKeyframes;
154 154
155 v8::Local<v8::Object> timingInputWithDuration = v8::Object::New(scope.isolat e()); 155 v8::Local<v8::Object> timingInputWithDuration = v8::Object::New(scope.isolat e());
156 setV8ObjectPropertyAsNumber(scope.isolate(), timingInputWithDuration, "durat ion", 2.5); 156 setV8ObjectPropertyAsNumber(scope.isolate(), timingInputWithDuration, "durat ion", 2.5);
157 KeyframeEffectOptions timingInputDictionaryWithDuration; 157 KeyframeEffectOptions timingInputDictionaryWithDuration;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 EXPECT_EQ(1, specified->playbackRate()); 222 EXPECT_EQ(1, specified->playbackRate());
223 specified->setPlaybackRate(2); 223 specified->setPlaybackRate(2);
224 EXPECT_EQ(2, specified->playbackRate()); 224 EXPECT_EQ(2, specified->playbackRate());
225 225
226 EXPECT_EQ("normal", specified->direction()); 226 EXPECT_EQ("normal", specified->direction());
227 specified->setDirection("reverse"); 227 specified->setDirection("reverse");
228 EXPECT_EQ("reverse", specified->direction()); 228 EXPECT_EQ("reverse", specified->direction());
229 229
230 EXPECT_EQ("linear", specified->easing()); 230 EXPECT_EQ("linear", specified->easing());
231 specified->setEasing("step-start", exceptionState); 231 specified->setEasing("ease-in-out", exceptionState);
232 ASSERT_FALSE(exceptionState.hadException()); 232 ASSERT_FALSE(exceptionState.hadException());
233 EXPECT_EQ("step-start", specified->easing()); 233 EXPECT_EQ("ease-in-out", specified->easing());
234 } 234 }
235 235
236 TEST_F(AnimationKeyframeEffectV8Test, SetSpecifiedDuration) 236 TEST_F(AnimationKeyframeEffectV8Test, SetSpecifiedDuration)
237 { 237 {
238 V8TestingScope scope; 238 V8TestingScope scope;
239 Vector<Dictionary, 0> jsKeyframes; 239 Vector<Dictionary, 0> jsKeyframes;
240 v8::Local<v8::Object> timingInput = v8::Object::New(scope.isolate()); 240 v8::Local<v8::Object> timingInput = v8::Object::New(scope.isolate());
241 KeyframeEffectOptions timingInputDictionary; 241 KeyframeEffectOptions timingInputDictionary;
242 TrackExceptionState exceptionState; 242 TrackExceptionState exceptionState;
243 V8KeyframeEffectOptions::toImpl(scope.isolate(), timingInput, timingInputDic tionary, exceptionState); 243 V8KeyframeEffectOptions::toImpl(scope.isolate(), timingInput, timingInputDic tionary, exceptionState);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 Timing timing; 367 Timing timing;
368 timing.iterationDuration = 5; 368 timing.iterationDuration = 5;
369 KeyframeEffect* animation = KeyframeEffect::create(element.get(), nullptr, t iming); 369 KeyframeEffect* animation = KeyframeEffect::create(element.get(), nullptr, t iming);
370 EXPECT_EQ(element.get(), animation->target()); 370 EXPECT_EQ(element.get(), animation->target());
371 document().timeline().play(animation); 371 document().timeline().play(animation);
372 pageHolder.reset(); 372 pageHolder.reset();
373 element.clear(); 373 element.clear();
374 } 374 }
375 375
376 } // namespace blink 376 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698