| 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 "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/EffectModelOrDictionarySequenceOrDictionary.h" | 8 #include "bindings/core/v8/EffectModelOrDictionarySequenceOrDictionary.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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 { | 120 { |
| 121 V8TestingScope scope; | 121 V8TestingScope scope; |
| 122 Vector<Dictionary, 0> jsKeyframes; | 122 Vector<Dictionary, 0> jsKeyframes; |
| 123 | 123 |
| 124 v8::Local<v8::Object> timingInput = v8::Object::New(scope.isolate()); | 124 v8::Local<v8::Object> timingInput = v8::Object::New(scope.isolate()); |
| 125 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "delay", 2); | 125 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "delay", 2); |
| 126 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "endDelay", 0.5); | 126 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "endDelay", 0.5); |
| 127 setV8ObjectPropertyAsString(scope.isolate(), timingInput, "fill", "backwards
"); | 127 setV8ObjectPropertyAsString(scope.isolate(), timingInput, "fill", "backwards
"); |
| 128 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "iterationStart",
2); | 128 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "iterationStart",
2); |
| 129 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "iterations", 10); | 129 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "iterations", 10); |
| 130 setV8ObjectPropertyAsNumber(scope.isolate(), timingInput, "playbackRate", 2)
; | |
| 131 setV8ObjectPropertyAsString(scope.isolate(), timingInput, "direction", "reve
rse"); | 130 setV8ObjectPropertyAsString(scope.isolate(), timingInput, "direction", "reve
rse"); |
| 132 setV8ObjectPropertyAsString(scope.isolate(), timingInput, "easing", "step-st
art"); | 131 setV8ObjectPropertyAsString(scope.isolate(), timingInput, "easing", "step-st
art"); |
| 133 KeyframeEffectOptions timingInputDictionary; | 132 KeyframeEffectOptions timingInputDictionary; |
| 134 V8KeyframeEffectOptions::toImpl(scope.isolate(), timingInput, timingInputDic
tionary, exceptionState); | 133 V8KeyframeEffectOptions::toImpl(scope.isolate(), timingInput, timingInputDic
tionary, exceptionState); |
| 135 | 134 |
| 136 KeyframeEffect* animation = createAnimation(element.get(), jsKeyframes, timi
ngInputDictionary, exceptionState); | 135 KeyframeEffect* animation = createAnimation(element.get(), jsKeyframes, timi
ngInputDictionary, exceptionState); |
| 137 | 136 |
| 138 AnimationEffectTiming* specified = animation->timing(); | 137 AnimationEffectTiming* specified = animation->timing(); |
| 139 EXPECT_EQ(2, specified->delay()); | 138 EXPECT_EQ(2, specified->delay()); |
| 140 EXPECT_EQ(0.5, specified->endDelay()); | 139 EXPECT_EQ(0.5, specified->endDelay()); |
| 141 EXPECT_EQ("backwards", specified->fill()); | 140 EXPECT_EQ("backwards", specified->fill()); |
| 142 EXPECT_EQ(2, specified->iterationStart()); | 141 EXPECT_EQ(2, specified->iterationStart()); |
| 143 EXPECT_EQ(10, specified->iterations()); | 142 EXPECT_EQ(10, specified->iterations()); |
| 144 EXPECT_EQ(2, specified->playbackRate()); | |
| 145 EXPECT_EQ("reverse", specified->direction()); | 143 EXPECT_EQ("reverse", specified->direction()); |
| 146 EXPECT_EQ("step-start", specified->easing()); | 144 EXPECT_EQ("step-start", specified->easing()); |
| 147 } | 145 } |
| 148 | 146 |
| 149 TEST_F(AnimationKeyframeEffectV8Test, SpecifiedDurationGetter) | 147 TEST_F(AnimationKeyframeEffectV8Test, SpecifiedDurationGetter) |
| 150 { | 148 { |
| 151 V8TestingScope scope; | 149 V8TestingScope scope; |
| 152 Vector<Dictionary, 0> jsKeyframes; | 150 Vector<Dictionary, 0> jsKeyframes; |
| 153 | 151 |
| 154 v8::Local<v8::Object> timingInputWithDuration = v8::Object::New(scope.isolat
e()); | 152 v8::Local<v8::Object> timingInputWithDuration = v8::Object::New(scope.isolat
e()); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 Timing timing; | 357 Timing timing; |
| 360 timing.iterationDuration = 5; | 358 timing.iterationDuration = 5; |
| 361 KeyframeEffect* animation = KeyframeEffect::create(element.get(), nullptr, t
iming); | 359 KeyframeEffect* animation = KeyframeEffect::create(element.get(), nullptr, t
iming); |
| 362 EXPECT_EQ(element.get(), animation->target()); | 360 EXPECT_EQ(element.get(), animation->target()); |
| 363 document().timeline().play(animation); | 361 document().timeline().play(animation); |
| 364 pageHolder.reset(); | 362 pageHolder.reset(); |
| 365 element.clear(); | 363 element.clear(); |
| 366 } | 364 } |
| 367 | 365 |
| 368 } // namespace blink | 366 } // namespace blink |
| OLD | NEW |