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

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

Issue 2509713002: binding: Makes Dictionary throw an exception (constructor). (Closed)
Patch Set: Addressed review comments. Created 4 years 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return KeyframeEffect::create( 60 return KeyframeEffect::create(
61 nullptr, element, 61 nullptr, element,
62 DictionarySequenceOrDictionary::fromDictionarySequence( 62 DictionarySequenceOrDictionary::fromDictionarySequence(
63 keyframeDictionaryVector), 63 keyframeDictionaryVector),
64 exceptionState); 64 exceptionState);
65 } 65 }
66 }; 66 };
67 67
68 TEST_F(AnimationKeyframeEffectV8Test, CanCreateAnAnimation) { 68 TEST_F(AnimationKeyframeEffectV8Test, CanCreateAnAnimation) {
69 V8TestingScope scope; 69 V8TestingScope scope;
70 NonThrowableExceptionState exceptionState;
71
70 Vector<Dictionary> jsKeyframes; 72 Vector<Dictionary> jsKeyframes;
71 v8::Local<v8::Object> keyframe1 = v8::Object::New(scope.isolate()); 73 v8::Local<v8::Object> keyframe1 = v8::Object::New(scope.isolate());
72 v8::Local<v8::Object> keyframe2 = v8::Object::New(scope.isolate()); 74 v8::Local<v8::Object> keyframe2 = v8::Object::New(scope.isolate());
73 75
74 setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "width", "100px"); 76 setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "width", "100px");
75 setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "offset", "0"); 77 setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "offset", "0");
76 setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "easing", 78 setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "easing",
77 "ease-in-out"); 79 "ease-in-out");
78 setV8ObjectPropertyAsString(scope.isolate(), keyframe2, "width", "0px"); 80 setV8ObjectPropertyAsString(scope.isolate(), keyframe2, "width", "0px");
79 setV8ObjectPropertyAsString(scope.isolate(), keyframe2, "offset", "1"); 81 setV8ObjectPropertyAsString(scope.isolate(), keyframe2, "offset", "1");
80 setV8ObjectPropertyAsString(scope.isolate(), keyframe2, "easing", 82 setV8ObjectPropertyAsString(scope.isolate(), keyframe2, "easing",
81 "cubic-bezier(1, 1, 0.3, 0.3)"); 83 "cubic-bezier(1, 1, 0.3, 0.3)");
82 84
83 jsKeyframes.append(Dictionary(scope.isolate(), keyframe1)); 85 jsKeyframes.append(Dictionary(scope.isolate(), keyframe1, exceptionState));
84 jsKeyframes.append(Dictionary(scope.isolate(), keyframe2)); 86 jsKeyframes.append(Dictionary(scope.isolate(), keyframe2, exceptionState));
85 87
86 String value1; 88 String value1;
87 ASSERT_TRUE(DictionaryHelper::get(jsKeyframes[0], "width", value1)); 89 ASSERT_TRUE(DictionaryHelper::get(jsKeyframes[0], "width", value1));
88 ASSERT_EQ("100px", value1); 90 ASSERT_EQ("100px", value1);
89 91
90 String value2; 92 String value2;
91 ASSERT_TRUE(DictionaryHelper::get(jsKeyframes[1], "width", value2)); 93 ASSERT_TRUE(DictionaryHelper::get(jsKeyframes[1], "width", value2));
92 ASSERT_EQ("0px", value2); 94 ASSERT_EQ("0px", value2);
93 95
94 KeyframeEffect* animation = createAnimation(element.get(), jsKeyframes, 0); 96 KeyframeEffect* animation = createAnimation(element.get(), jsKeyframes, 0);
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 timing.iterationDuration = 5; 399 timing.iterationDuration = 5;
398 KeyframeEffect* animation = 400 KeyframeEffect* animation =
399 KeyframeEffect::create(element.get(), nullptr, timing); 401 KeyframeEffect::create(element.get(), nullptr, timing);
400 EXPECT_EQ(element.get(), animation->target()); 402 EXPECT_EQ(element.get(), animation->target());
401 document().timeline().play(animation); 403 document().timeline().play(animation);
402 pageHolder.reset(); 404 pageHolder.reset();
403 element.clear(); 405 element.clear();
404 } 406 }
405 407
406 } // namespace blink 408 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/EffectInputTest.cpp ('k') | third_party/WebKit/Source/web/WebCryptoNormalize.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698