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

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

Issue 1120003002: [Oilpan] Migrate most classes under core/animations to Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 4 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
« no previous file with comments | « Source/core/animation/EffectInput.cpp ('k') | Source/core/animation/EffectModel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/EffectInput.h" 6 #include "core/animation/EffectInput.h"
7 7
8 #include "bindings/core/v8/Dictionary.h" 8 #include "bindings/core/v8/Dictionary.h"
9 #include "bindings/core/v8/V8BindingForTesting.h" 9 #include "bindings/core/v8/V8BindingForTesting.h"
10 #include "core/animation/AnimationTestHelper.h" 10 #include "core/animation/AnimationTestHelper.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); 45 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate);
46 46
47 setV8ObjectPropertyAsString(m_isolate, keyframe1, "width", "100px"); 47 setV8ObjectPropertyAsString(m_isolate, keyframe1, "width", "100px");
48 setV8ObjectPropertyAsString(m_isolate, keyframe1, "offset", "0"); 48 setV8ObjectPropertyAsString(m_isolate, keyframe1, "offset", "0");
49 setV8ObjectPropertyAsString(m_isolate, keyframe2, "width", "0px"); 49 setV8ObjectPropertyAsString(m_isolate, keyframe2, "width", "0px");
50 setV8ObjectPropertyAsString(m_isolate, keyframe2, "offset", "1"); 50 setV8ObjectPropertyAsString(m_isolate, keyframe2, "offset", "1");
51 51
52 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); 52 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState));
53 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); 53 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState));
54 54
55 RefPtrWillBeRawPtr<EffectModel> animationEffect = EffectInput::convert(eleme nt.get(), jsKeyframes, exceptionState); 55 EffectModel* animationEffect = EffectInput::convert(element.get(), jsKeyfram es, exceptionState);
56 EXPECT_FALSE(exceptionState.hadException()); 56 EXPECT_FALSE(exceptionState.hadException());
57 const KeyframeEffectModelBase& keyframeEffect = *toKeyframeEffectModelBase(a nimationEffect.get()); 57 const KeyframeEffectModelBase& keyframeEffect = *toKeyframeEffectModelBase(a nimationEffect);
58 EXPECT_EQ(1.0, keyframeEffect.getFrames()[1]->offset()); 58 EXPECT_EQ(1.0, keyframeEffect.getFrames()[1]->offset());
59 } 59 }
60 60
61 TEST_F(AnimationEffectInputTest, UnsortedOffsets) 61 TEST_F(AnimationEffectInputTest, UnsortedOffsets)
62 { 62 {
63 Vector<Dictionary> jsKeyframes; 63 Vector<Dictionary> jsKeyframes;
64 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); 64 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate);
65 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); 65 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate);
66 66
67 setV8ObjectPropertyAsString(m_isolate, keyframe1, "width", "0px"); 67 setV8ObjectPropertyAsString(m_isolate, keyframe1, "width", "0px");
(...skipping 19 matching lines...) Expand all
87 setV8ObjectPropertyAsString(m_isolate, keyframe1, "width", "100px"); 87 setV8ObjectPropertyAsString(m_isolate, keyframe1, "width", "100px");
88 setV8ObjectPropertyAsString(m_isolate, keyframe1, "offset", "0"); 88 setV8ObjectPropertyAsString(m_isolate, keyframe1, "offset", "0");
89 setV8ObjectPropertyAsString(m_isolate, keyframe2, "width", "200px"); 89 setV8ObjectPropertyAsString(m_isolate, keyframe2, "width", "200px");
90 setV8ObjectPropertyAsString(m_isolate, keyframe3, "width", "0px"); 90 setV8ObjectPropertyAsString(m_isolate, keyframe3, "width", "0px");
91 setV8ObjectPropertyAsString(m_isolate, keyframe3, "offset", "1"); 91 setV8ObjectPropertyAsString(m_isolate, keyframe3, "offset", "1");
92 92
93 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); 93 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState));
94 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); 94 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState));
95 jsKeyframes.append(Dictionary(keyframe3, m_isolate, exceptionState)); 95 jsKeyframes.append(Dictionary(keyframe3, m_isolate, exceptionState));
96 96
97 RefPtrWillBeRawPtr<EffectModel> animationEffect = EffectInput::convert(eleme nt.get(), jsKeyframes, exceptionState); 97 EffectModel* animationEffect = EffectInput::convert(element.get(), jsKeyfram es, exceptionState);
98 EXPECT_FALSE(exceptionState.hadException()); 98 EXPECT_FALSE(exceptionState.hadException());
99 const KeyframeEffectModelBase& keyframeEffect = *toKeyframeEffectModelBase(a nimationEffect.get()); 99 const KeyframeEffectModelBase& keyframeEffect = *toKeyframeEffectModelBase(a nimationEffect);
100 EXPECT_EQ(1, keyframeEffect.getFrames()[2]->offset()); 100 EXPECT_EQ(1, keyframeEffect.getFrames()[2]->offset());
101 } 101 }
102 102
103 TEST_F(AnimationEffectInputTest, OutOfOrderWithNullOffsets) 103 TEST_F(AnimationEffectInputTest, OutOfOrderWithNullOffsets)
104 { 104 {
105 Vector<Dictionary> jsKeyframes; 105 Vector<Dictionary> jsKeyframes;
106 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate); 106 v8::Local<v8::Object> keyframe1 = v8::Object::New(m_isolate);
107 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate); 107 v8::Local<v8::Object> keyframe2 = v8::Object::New(m_isolate);
108 v8::Local<v8::Object> keyframe3 = v8::Object::New(m_isolate); 108 v8::Local<v8::Object> keyframe3 = v8::Object::New(m_isolate);
109 v8::Local<v8::Object> keyframe4 = v8::Object::New(m_isolate); 109 v8::Local<v8::Object> keyframe4 = v8::Object::New(m_isolate);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState)); 142 jsKeyframes.append(Dictionary(keyframe1, m_isolate, exceptionState));
143 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState)); 143 jsKeyframes.append(Dictionary(keyframe2, m_isolate, exceptionState));
144 jsKeyframes.append(Dictionary(keyframe3, m_isolate, exceptionState)); 144 jsKeyframes.append(Dictionary(keyframe3, m_isolate, exceptionState));
145 145
146 EffectInput::convert(element.get(), jsKeyframes, exceptionState); 146 EffectInput::convert(element.get(), jsKeyframes, exceptionState);
147 EXPECT_TRUE(exceptionState.hadException()); 147 EXPECT_TRUE(exceptionState.hadException());
148 EXPECT_EQ(InvalidModificationError, exceptionState.code()); 148 EXPECT_EQ(InvalidModificationError, exceptionState.code());
149 } 149 }
150 150
151 } // namespace blink 151 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/EffectInput.cpp ('k') | Source/core/animation/EffectModel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698