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

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

Issue 2814523002: Web Animations: Coalesce constructors where possible. (Closed)
Patch Set: Rebase Created 3 years, 8 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 <memory> 7 #include <memory>
8 8
9 #include "bindings/core/v8/Dictionary.h" 9 #include "bindings/core/v8/Dictionary.h"
10 #include "bindings/core/v8/DictionarySequenceOrDictionary.h" 10 #include "bindings/core/v8/DictionarySequenceOrDictionary.h"
11 #include "bindings/core/v8/UnrestrictedDoubleOrKeyframeEffectOptions.h"
11 #include "bindings/core/v8/V8BindingForTesting.h" 12 #include "bindings/core/v8/V8BindingForTesting.h"
12 #include "bindings/core/v8/V8KeyframeEffectOptions.h" 13 #include "bindings/core/v8/V8KeyframeEffectOptions.h"
13 #include "core/animation/AnimationClock.h" 14 #include "core/animation/AnimationClock.h"
14 #include "core/animation/AnimationEffectTiming.h" 15 #include "core/animation/AnimationEffectTiming.h"
15 #include "core/animation/AnimationTestHelper.h" 16 #include "core/animation/AnimationTestHelper.h"
16 #include "core/animation/DocumentTimeline.h" 17 #include "core/animation/DocumentTimeline.h"
17 #include "core/animation/KeyframeEffectModel.h" 18 #include "core/animation/KeyframeEffectModel.h"
18 #include "core/animation/Timing.h" 19 #include "core/animation/Timing.h"
19 #include "core/dom/Document.h" 20 #include "core/dom/Document.h"
20 #include "core/testing/DummyPageHolder.h" 21 #include "core/testing/DummyPageHolder.h"
(...skipping 14 matching lines...) Expand all
35 } 36 }
36 37
37 Document& GetDocument() const { return page_holder->GetDocument(); } 38 Document& GetDocument() const { return page_holder->GetDocument(); }
38 39
39 std::unique_ptr<DummyPageHolder> page_holder; 40 std::unique_ptr<DummyPageHolder> page_holder;
40 Persistent<Element> element; 41 Persistent<Element> element;
41 }; 42 };
42 43
43 class AnimationKeyframeEffectV8Test : public KeyframeEffectTest { 44 class AnimationKeyframeEffectV8Test : public KeyframeEffectTest {
44 protected: 45 protected:
45 template <typename T>
46 static KeyframeEffect* CreateAnimation( 46 static KeyframeEffect* CreateAnimation(
47 Element* element, 47 Element* element,
48 Vector<Dictionary> keyframe_dictionary_vector, 48 Vector<Dictionary> keyframe_dictionary_vector,
49 T timing_input) { 49 double timing_input) {
50 NonThrowableExceptionState exception_state; 50 NonThrowableExceptionState exception_state;
51 return KeyframeEffect::Create( 51 return KeyframeEffect::Create(
52 nullptr, element, 52 nullptr, element,
53 DictionarySequenceOrDictionary::fromDictionarySequence( 53 DictionarySequenceOrDictionary::fromDictionarySequence(
54 keyframe_dictionary_vector), 54 keyframe_dictionary_vector),
55 timing_input, exception_state); 55 UnrestrictedDoubleOrKeyframeEffectOptions::fromUnrestrictedDouble(
56 timing_input),
57 exception_state);
56 } 58 }
57 static KeyframeEffect* CreateAnimation( 59 static KeyframeEffect* CreateAnimation(
58 Element* element, 60 Element* element,
61 Vector<Dictionary> keyframe_dictionary_vector,
62 const KeyframeEffectOptions& timing_input) {
63 NonThrowableExceptionState exception_state;
64 return KeyframeEffect::Create(
65 nullptr, element,
66 DictionarySequenceOrDictionary::fromDictionarySequence(
67 keyframe_dictionary_vector),
68 UnrestrictedDoubleOrKeyframeEffectOptions::fromKeyframeEffectOptions(
69 timing_input),
70 exception_state);
71 }
72 static KeyframeEffect* CreateAnimation(
73 Element* element,
59 Vector<Dictionary> keyframe_dictionary_vector) { 74 Vector<Dictionary> keyframe_dictionary_vector) {
60 NonThrowableExceptionState exception_state; 75 NonThrowableExceptionState exception_state;
61 return KeyframeEffect::Create( 76 return KeyframeEffect::Create(
62 nullptr, element, 77 nullptr, element,
63 DictionarySequenceOrDictionary::fromDictionarySequence( 78 DictionarySequenceOrDictionary::fromDictionarySequence(
64 keyframe_dictionary_vector), 79 keyframe_dictionary_vector),
65 exception_state); 80 exception_state);
66 } 81 }
67 }; 82 };
68 83
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 timing.iteration_duration = 5; 420 timing.iteration_duration = 5;
406 KeyframeEffect* animation = 421 KeyframeEffect* animation =
407 KeyframeEffect::Create(element.Get(), nullptr, timing); 422 KeyframeEffect::Create(element.Get(), nullptr, timing);
408 EXPECT_EQ(element.Get(), animation->Target()); 423 EXPECT_EQ(element.Get(), animation->Target());
409 GetDocument().Timeline().Play(animation); 424 GetDocument().Timeline().Play(animation);
410 page_holder.reset(); 425 page_holder.reset();
411 element.Clear(); 426 element.Clear();
412 } 427 }
413 428
414 } // namespace blink 429 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698