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

Side by Side Diff: Source/core/animation/TimingInputTest.cpp

Issue 1113173003: Web Animations: Update naming to reflect spec changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: No, really. Created 5 years, 7 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 | Annotate | Revision Log
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 "config.h" 5 #include "config.h"
6 #include "core/animation/TimingInput.h" 6 #include "core/animation/TimingInput.h"
7 7
8 #include "bindings/core/v8/V8AnimationTimingProperties.h"
9 #include "bindings/core/v8/V8BindingForTesting.h" 8 #include "bindings/core/v8/V8BindingForTesting.h"
10 #include "core/animation/AnimationNodeTiming.h" 9 #include "bindings/core/v8/V8KeyframeEffectOptions.h"
10 #include "core/animation/AnimationEffectTiming.h"
11 #include "core/animation/AnimationTestHelper.h" 11 #include "core/animation/AnimationTestHelper.h"
12 #include <gtest/gtest.h> 12 #include <gtest/gtest.h>
13 #include <v8.h> 13 #include <v8.h>
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class AnimationTimingInputTest : public ::testing::Test { 17 class AnimationTimingInputTest : public ::testing::Test {
18 protected: 18 protected:
19 AnimationTimingInputTest() 19 AnimationTimingInputTest()
20 : m_isolate(v8::Isolate::GetCurrent()) 20 : m_isolate(v8::Isolate::GetCurrent())
21 , m_scope(m_isolate) 21 , m_scope(m_isolate)
22 { 22 {
23 } 23 }
24 24
25 Timing applyTimingInputNumber(String timingProperty, double timingPropertyVa lue) 25 Timing applyTimingInputNumber(String timingProperty, double timingPropertyVa lue)
26 { 26 {
27 v8::Local<v8::Object> timingInput = v8::Object::New(m_isolate); 27 v8::Local<v8::Object> timingInput = v8::Object::New(m_isolate);
28 setV8ObjectPropertyAsNumber(timingInput, timingProperty, timingPropertyV alue); 28 setV8ObjectPropertyAsNumber(timingInput, timingProperty, timingPropertyV alue);
29 AnimationTimingProperties timingInputDictionary; 29 KeyframeEffectOptions timingInputDictionary;
30 V8AnimationTimingProperties::toImpl(m_isolate, timingInput, timingInputD ictionary, exceptionState); 30 V8KeyframeEffectOptions::toImpl(m_isolate, timingInput, timingInputDicti onary, exceptionState);
31 return TimingInput::convert(timingInputDictionary); 31 return TimingInput::convert(timingInputDictionary);
32 } 32 }
33 33
34 Timing applyTimingInputString(String timingProperty, String timingPropertyVa lue) 34 Timing applyTimingInputString(String timingProperty, String timingPropertyVa lue)
35 { 35 {
36 v8::Local<v8::Object> timingInput = v8::Object::New(m_isolate); 36 v8::Local<v8::Object> timingInput = v8::Object::New(m_isolate);
37 setV8ObjectPropertyAsString(timingInput, timingProperty, timingPropertyV alue); 37 setV8ObjectPropertyAsString(timingInput, timingProperty, timingPropertyV alue);
38 AnimationTimingProperties timingInputDictionary; 38 KeyframeEffectOptions timingInputDictionary;
39 V8AnimationTimingProperties::toImpl(m_isolate, timingInput, timingInputD ictionary, exceptionState); 39 V8KeyframeEffectOptions::toImpl(m_isolate, timingInput, timingInputDicti onary, exceptionState);
40 return TimingInput::convert(timingInputDictionary); 40 return TimingInput::convert(timingInputDictionary);
41 } 41 }
42 42
43 v8::Isolate* m_isolate; 43 v8::Isolate* m_isolate;
44 TrackExceptionState exceptionState; 44 TrackExceptionState exceptionState;
45 45
46 private: 46 private:
47 V8TestingScope m_scope; 47 V8TestingScope m_scope;
48 }; 48 };
49 49
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 EXPECT_EQ(*defaultTimingFunction, *applyTimingInputString("easing", "steps(5 .6, end)").timingFunction); 160 EXPECT_EQ(*defaultTimingFunction, *applyTimingInputString("easing", "steps(5 .6, end)").timingFunction);
161 EXPECT_EQ(*defaultTimingFunction, *applyTimingInputString("easing", "cubic-b ezier(2, 2, 0.3, 0.3)").timingFunction); 161 EXPECT_EQ(*defaultTimingFunction, *applyTimingInputString("easing", "cubic-b ezier(2, 2, 0.3, 0.3)").timingFunction);
162 EXPECT_EQ(*defaultTimingFunction, *applyTimingInputString("easing", "rubbish ").timingFunction); 162 EXPECT_EQ(*defaultTimingFunction, *applyTimingInputString("easing", "rubbish ").timingFunction);
163 EXPECT_EQ(*defaultTimingFunction, *applyTimingInputNumber("easing", 2).timin gFunction); 163 EXPECT_EQ(*defaultTimingFunction, *applyTimingInputNumber("easing", 2).timin gFunction);
164 EXPECT_EQ(*defaultTimingFunction, *applyTimingInputString("easing", "initial ").timingFunction); 164 EXPECT_EQ(*defaultTimingFunction, *applyTimingInputString("easing", "initial ").timingFunction);
165 } 165 }
166 166
167 TEST_F(AnimationTimingInputTest, TimingInputEmpty) 167 TEST_F(AnimationTimingInputTest, TimingInputEmpty)
168 { 168 {
169 Timing controlTiming; 169 Timing controlTiming;
170 Timing updatedTiming = TimingInput::convert(AnimationTimingProperties()); 170 Timing updatedTiming = TimingInput::convert(KeyframeEffectOptions());
171 171
172 EXPECT_EQ(controlTiming.startDelay, updatedTiming.startDelay); 172 EXPECT_EQ(controlTiming.startDelay, updatedTiming.startDelay);
173 EXPECT_EQ(controlTiming.fillMode, updatedTiming.fillMode); 173 EXPECT_EQ(controlTiming.fillMode, updatedTiming.fillMode);
174 EXPECT_EQ(controlTiming.iterationStart, updatedTiming.iterationStart); 174 EXPECT_EQ(controlTiming.iterationStart, updatedTiming.iterationStart);
175 EXPECT_EQ(controlTiming.iterationCount, updatedTiming.iterationCount); 175 EXPECT_EQ(controlTiming.iterationCount, updatedTiming.iterationCount);
176 EXPECT_TRUE(std::isnan(updatedTiming.iterationDuration)); 176 EXPECT_TRUE(std::isnan(updatedTiming.iterationDuration));
177 EXPECT_EQ(controlTiming.playbackRate, updatedTiming.playbackRate); 177 EXPECT_EQ(controlTiming.playbackRate, updatedTiming.playbackRate);
178 EXPECT_EQ(controlTiming.direction, updatedTiming.direction); 178 EXPECT_EQ(controlTiming.direction, updatedTiming.direction);
179 EXPECT_EQ(*controlTiming.timingFunction, *updatedTiming.timingFunction); 179 EXPECT_EQ(*controlTiming.timingFunction, *updatedTiming.timingFunction);
180 } 180 }
181 181
182 } // namespace blink 182 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/TimingInput.cpp ('k') | Source/core/animation/animatable/AnimatableValueKeyframe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698