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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "platform/animation/CompositorAnimation.h" 46 #include "platform/animation/CompositorAnimation.h"
47 #include "platform/animation/CompositorFloatAnimationCurve.h" 47 #include "platform/animation/CompositorFloatAnimationCurve.h"
48 #include "platform/animation/CompositorFloatKeyframe.h" 48 #include "platform/animation/CompositorFloatKeyframe.h"
49 #include "platform/geometry/FloatBox.h" 49 #include "platform/geometry/FloatBox.h"
50 #include "platform/geometry/IntSize.h" 50 #include "platform/geometry/IntSize.h"
51 #include "platform/graphics/filters/FilterOperations.h" 51 #include "platform/graphics/filters/FilterOperations.h"
52 #include "platform/transforms/TransformOperations.h" 52 #include "platform/transforms/TransformOperations.h"
53 #include "platform/transforms/TranslateTransformOperation.h" 53 #include "platform/transforms/TranslateTransformOperation.h"
54 #include "testing/gtest/include/gtest/gtest.h" 54 #include "testing/gtest/include/gtest/gtest.h"
55 #include "wtf/HashFunctions.h" 55 #include "wtf/HashFunctions.h"
56 #include "wtf/OwnPtr.h"
57 #include "wtf/PassOwnPtr.h"
56 #include "wtf/PassRefPtr.h" 58 #include "wtf/PassRefPtr.h"
57 #include "wtf/PtrUtil.h"
58 #include "wtf/RefPtr.h" 59 #include "wtf/RefPtr.h"
59 #include <memory>
60 60
61 namespace blink { 61 namespace blink {
62 62
63 class AnimationCompositorAnimationsTest : public ::testing::Test { 63 class AnimationCompositorAnimationsTest : public ::testing::Test {
64 protected: 64 protected:
65 RefPtr<TimingFunction> m_linearTimingFunction; 65 RefPtr<TimingFunction> m_linearTimingFunction;
66 RefPtr<TimingFunction> m_cubicEaseTimingFunction; 66 RefPtr<TimingFunction> m_cubicEaseTimingFunction;
67 RefPtr<TimingFunction> m_cubicCustomTimingFunction; 67 RefPtr<TimingFunction> m_cubicCustomTimingFunction;
68 RefPtr<TimingFunction> m_stepTimingFunction; 68 RefPtr<TimingFunction> m_stepTimingFunction;
69 69
70 Timing m_timing; 70 Timing m_timing;
71 CompositorAnimations::CompositorTiming m_compositorTiming; 71 CompositorAnimations::CompositorTiming m_compositorTiming;
72 std::unique_ptr<AnimatableValueKeyframeVector> m_keyframeVector2; 72 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2;
73 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2; 73 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2;
74 std::unique_ptr<AnimatableValueKeyframeVector> m_keyframeVector5; 74 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5;
75 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5; 75 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5;
76 76
77 Persistent<Document> m_document; 77 Persistent<Document> m_document;
78 Persistent<Element> m_element; 78 Persistent<Element> m_element;
79 Persistent<AnimationTimeline> m_timeline; 79 Persistent<AnimationTimeline> m_timeline;
80 std::unique_ptr<DummyPageHolder> m_pageHolder; 80 OwnPtr<DummyPageHolder> m_pageHolder;
81 81
82 void SetUp() override 82 void SetUp() override
83 { 83 {
84 m_linearTimingFunction = LinearTimingFunction::shared(); 84 m_linearTimingFunction = LinearTimingFunction::shared();
85 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::EaseType::EASE); 85 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::EaseType::EASE);
86 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3, 4); 86 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3, 4);
87 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio n::StepPosition::END); 87 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio n::StepPosition::END);
88 88
89 m_timing = createCompositableTiming(); 89 m_timing = createCompositableTiming();
90 m_compositorTiming = CompositorAnimations::CompositorTiming(); 90 m_compositorTiming = CompositorAnimations::CompositorTiming();
(...skipping 18 matching lines...) Expand all
109 109
110 public: 110 public:
111 bool convertTimingForCompositor(const Timing& t, CompositorAnimations::Compo sitorTiming& out) 111 bool convertTimingForCompositor(const Timing& t, CompositorAnimations::Compo sitorTiming& out)
112 { 112 {
113 return CompositorAnimations::convertTimingForCompositor(t, 0, out, 1); 113 return CompositorAnimations::convertTimingForCompositor(t, 0, out, 1);
114 } 114 }
115 bool isCandidateForAnimationOnCompositor(const Timing& timing, const EffectM odel& effect) 115 bool isCandidateForAnimationOnCompositor(const Timing& timing, const EffectM odel& effect)
116 { 116 {
117 return CompositorAnimations::isCandidateForAnimationOnCompositor(timing, *m_element.get(), nullptr, effect, 1); 117 return CompositorAnimations::isCandidateForAnimationOnCompositor(timing, *m_element.get(), nullptr, effect, 1);
118 } 118 }
119 void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectM odel& effect, Vector<std::unique_ptr<CompositorAnimation>>& animations) 119 void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectM odel& effect, Vector<OwnPtr<CompositorAnimation>>& animations)
120 { 120 {
121 getAnimationOnCompositor(timing, effect, animations, 1); 121 getAnimationOnCompositor(timing, effect, animations, 1);
122 } 122 }
123 void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectM odel& effect, Vector<std::unique_ptr<CompositorAnimation>>& animations, double p layerPlaybackRate) 123 void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectM odel& effect, Vector<OwnPtr<CompositorAnimation>>& animations, double playerPlay backRate)
124 { 124 {
125 CompositorAnimations::getAnimationOnCompositor(timing, 0, std::numeric_l imits<double>::quiet_NaN(), 0, effect, animations, playerPlaybackRate); 125 CompositorAnimations::getAnimationOnCompositor(timing, 0, std::numeric_l imits<double>::quiet_NaN(), 0, effect, animations, playerPlaybackRate);
126 } 126 }
127 bool getAnimationBounds(FloatBox& boundingBox, const EffectModel& effect, do uble minValue, double maxValue) 127 bool getAnimationBounds(FloatBox& boundingBox, const EffectModel& effect, do uble minValue, double maxValue)
128 { 128 {
129 return CompositorAnimations::getAnimatedBoundingBox(boundingBox, effect, minValue, maxValue); 129 return CompositorAnimations::getAnimatedBoundingBox(boundingBox, effect, minValue, maxValue);
130 } 130 }
131 131
132 bool duplicateSingleKeyframeAndTestIsCandidateOnResult(AnimatableValueKeyfra me* frame) 132 bool duplicateSingleKeyframeAndTestIsCandidateOnResult(AnimatableValueKeyfra me* frame)
133 { 133 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if (id == CSSPropertyTransform) 173 if (id == CSSPropertyTransform)
174 value = AnimatableTransform::create(TransformOperations(), 1); 174 value = AnimatableTransform::create(TransformOperations(), 1);
175 else 175 else
176 value = AnimatableDouble::create(10.0); 176 value = AnimatableDouble::create(10.0);
177 177
178 RefPtr<AnimatableValueKeyframe> keyframe = createReplaceOpKeyframe(id, v alue.get(), offset); 178 RefPtr<AnimatableValueKeyframe> keyframe = createReplaceOpKeyframe(id, v alue.get(), offset);
179 keyframe->setComposite(op); 179 keyframe->setComposite(op);
180 return keyframe; 180 return keyframe;
181 } 181 }
182 182
183 std::unique_ptr<AnimatableValueKeyframeVector> createCompositableFloatKeyfra meVector(size_t n) 183 PassOwnPtr<AnimatableValueKeyframeVector> createCompositableFloatKeyframeVec tor(size_t n)
184 { 184 {
185 Vector<double> values; 185 Vector<double> values;
186 for (size_t i = 0; i < n; i++) { 186 for (size_t i = 0; i < n; i++) {
187 values.append(static_cast<double>(i)); 187 values.append(static_cast<double>(i));
188 } 188 }
189 return createCompositableFloatKeyframeVector(values); 189 return createCompositableFloatKeyframeVector(values);
190 } 190 }
191 191
192 std::unique_ptr<AnimatableValueKeyframeVector> createCompositableFloatKeyfra meVector(Vector<double>& values) 192 PassOwnPtr<AnimatableValueKeyframeVector> createCompositableFloatKeyframeVec tor(Vector<double>& values)
193 { 193 {
194 std::unique_ptr<AnimatableValueKeyframeVector> frames = wrapUnique(new A nimatableValueKeyframeVector); 194 OwnPtr<AnimatableValueKeyframeVector> frames = adoptPtr(new AnimatableVa lueKeyframeVector);
195 for (size_t i = 0; i < values.size(); i++) { 195 for (size_t i = 0; i < values.size(); i++) {
196 double offset = 1.0 / (values.size() - 1) * i; 196 double offset = 1.0 / (values.size() - 1) * i;
197 RefPtr<AnimatableDouble> value = AnimatableDouble::create(values[i]) ; 197 RefPtr<AnimatableDouble> value = AnimatableDouble::create(values[i]) ;
198 frames->append(createReplaceOpKeyframe(CSSPropertyOpacity, value.get (), offset).get()); 198 frames->append(createReplaceOpKeyframe(CSSPropertyOpacity, value.get (), offset).get());
199 } 199 }
200 return frames; 200 return frames;
201 } 201 }
202 202
203 std::unique_ptr<AnimatableValueKeyframeVector> createCompositableTransformKe yframeVector(const Vector<TransformOperations>& values) 203 PassOwnPtr<AnimatableValueKeyframeVector> createCompositableTransformKeyfram eVector(const Vector<TransformOperations>& values)
204 { 204 {
205 std::unique_ptr<AnimatableValueKeyframeVector> frames = wrapUnique(new A nimatableValueKeyframeVector); 205 OwnPtr<AnimatableValueKeyframeVector> frames = adoptPtr(new AnimatableVa lueKeyframeVector);
206 for (size_t i = 0; i < values.size(); ++i) { 206 for (size_t i = 0; i < values.size(); ++i) {
207 double offset = 1.0f / (values.size() - 1) * i; 207 double offset = 1.0f / (values.size() - 1) * i;
208 RefPtr<AnimatableTransform> value = AnimatableTransform::create(valu es[i], 1); 208 RefPtr<AnimatableTransform> value = AnimatableTransform::create(valu es[i], 1);
209 frames->append(createReplaceOpKeyframe(CSSPropertyTransform, value.g et(), offset).get()); 209 frames->append(createReplaceOpKeyframe(CSSPropertyTransform, value.g et(), offset).get());
210 } 210 }
211 return frames; 211 return frames;
212 } 212 }
213 213
214 AnimatableValueKeyframeEffectModel* createKeyframeEffectModel(PassRefPtr<Ani matableValueKeyframe> prpFrom, PassRefPtr<AnimatableValueKeyframe> prpTo, PassRe fPtr<AnimatableValueKeyframe> prpC = nullptr, PassRefPtr<AnimatableValueKeyframe > prpD = nullptr) 214 AnimatableValueKeyframeEffectModel* createKeyframeEffectModel(PassRefPtr<Ani matableValueKeyframe> prpFrom, PassRefPtr<AnimatableValueKeyframe> prpTo, PassRe fPtr<AnimatableValueKeyframe> prpC = nullptr, PassRefPtr<AnimatableValueKeyframe > prpD = nullptr)
215 { 215 {
(...skipping 24 matching lines...) Expand all
240 return nullptr; 240 return nullptr;
241 } 241 }
242 242
243 void simulateFrame(double time) 243 void simulateFrame(double time)
244 { 244 {
245 m_document->animationClock().updateTime(time); 245 m_document->animationClock().updateTime(time);
246 m_document->compositorPendingAnimations().update(false); 246 m_document->compositorPendingAnimations().update(false);
247 m_timeline->serviceAnimations(TimingUpdateForAnimationFrame); 247 m_timeline->serviceAnimations(TimingUpdateForAnimationFrame);
248 } 248 }
249 249
250 std::unique_ptr<CompositorAnimation> convertToCompositorAnimation(Animatable ValueKeyframeEffectModel& effect, double playerPlaybackRate) 250 PassOwnPtr<CompositorAnimation> convertToCompositorAnimation(AnimatableValue KeyframeEffectModel& effect, double playerPlaybackRate)
251 { 251 {
252 Vector<std::unique_ptr<CompositorAnimation>> result; 252 Vector<OwnPtr<CompositorAnimation>> result;
253 getAnimationOnCompositor(m_timing, effect, result, playerPlaybackRate); 253 getAnimationOnCompositor(m_timing, effect, result, playerPlaybackRate);
254 DCHECK_EQ(1U, result.size()); 254 DCHECK_EQ(1U, result.size());
255 return std::move(result[0]); 255 return std::move(result[0]);
256 } 256 }
257 257
258 std::unique_ptr<CompositorAnimation> convertToCompositorAnimation(Animatable ValueKeyframeEffectModel& effect) 258 PassOwnPtr<CompositorAnimation> convertToCompositorAnimation(AnimatableValue KeyframeEffectModel& effect)
259 { 259 {
260 return convertToCompositorAnimation(effect, 1.0); 260 return convertToCompositorAnimation(effect, 1.0);
261 } 261 }
262 }; 262 };
263 263
264 class LayoutObjectProxy : public LayoutObject { 264 class LayoutObjectProxy : public LayoutObject {
265 public: 265 public:
266 static LayoutObjectProxy* create(Node* node) 266 static LayoutObjectProxy* create(Node* node)
267 { 267 {
268 return new LayoutObjectProxy(node); 268 return new LayoutObjectProxy(node);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK eyframeEffectModel::create(framesMixedProperties))); 341 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK eyframeEffectModel::create(framesMixedProperties)));
342 } 342 }
343 343
344 TEST_F(AnimationCompositorAnimationsTest, AnimatedBoundingBox) 344 TEST_F(AnimationCompositorAnimationsTest, AnimatedBoundingBox)
345 { 345 {
346 Vector<TransformOperations> transformVector; 346 Vector<TransformOperations> transformVector;
347 transformVector.append(TransformOperations()); 347 transformVector.append(TransformOperations());
348 transformVector.last().operations().append(TranslateTransformOperation::crea te(Length(0, Fixed), Length(0, Fixed), 0.0, TransformOperation::Translate3D)); 348 transformVector.last().operations().append(TranslateTransformOperation::crea te(Length(0, Fixed), Length(0, Fixed), 0.0, TransformOperation::Translate3D));
349 transformVector.append(TransformOperations()); 349 transformVector.append(TransformOperations());
350 transformVector.last().operations().append(TranslateTransformOperation::crea te(Length(200, Fixed), Length(200, Fixed), 0.0, TransformOperation::Translate3D) ); 350 transformVector.last().operations().append(TranslateTransformOperation::crea te(Length(200, Fixed), Length(200, Fixed), 0.0, TransformOperation::Translate3D) );
351 std::unique_ptr<AnimatableValueKeyframeVector> frames = createCompositableTr ansformKeyframeVector(transformVector); 351 OwnPtr<AnimatableValueKeyframeVector> frames = createCompositableTransformKe yframeVector(transformVector);
352 FloatBox bounds; 352 FloatBox bounds;
353 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel:: create(*frames), 0, 1)); 353 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel:: create(*frames), 0, 1));
354 EXPECT_EQ(FloatBox(0.0f, 0.f, 0.0f, 200.0f, 200.0f, 0.0f), bounds); 354 EXPECT_EQ(FloatBox(0.0f, 0.f, 0.0f, 200.0f, 200.0f, 0.0f), bounds);
355 bounds = FloatBox(); 355 bounds = FloatBox();
356 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel:: create(*frames), -1, 1)); 356 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel:: create(*frames), -1, 1));
357 EXPECT_EQ(FloatBox(-200.0f, -200.0, 0.0, 400.0f, 400.0f, 0.0f), bounds); 357 EXPECT_EQ(FloatBox(-200.0f, -200.0, 0.0, 400.0f, 400.0f, 0.0f), bounds);
358 transformVector.append(TransformOperations()); 358 transformVector.append(TransformOperations());
359 transformVector.last().operations().append(TranslateTransformOperation::crea te(Length(-300, Fixed), Length(-400, Fixed), 1.0f, TransformOperation::Translate 3D)); 359 transformVector.last().operations().append(TranslateTransformOperation::crea te(Length(-300, Fixed), Length(-400, Fixed), 1.0f, TransformOperation::Translate 3D));
360 bounds = FloatBox(); 360 bounds = FloatBox();
361 frames = createCompositableTransformKeyframeVector(transformVector); 361 frames = createCompositableTransformKeyframeVector(transformVector);
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 // ----------------------------------------------------------------------- 639 // -----------------------------------------------------------------------
640 // ----------------------------------------------------------------------- 640 // -----------------------------------------------------------------------
641 641
642 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation) 642 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation)
643 { 643 {
644 // KeyframeEffect to convert 644 // KeyframeEffect to convert
645 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 645 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
646 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 646 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
647 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 647 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
648 648
649 std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimatio n(*effect); 649 OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect );
650 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); 650 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty());
651 EXPECT_EQ(1.0, animation->iterations()); 651 EXPECT_EQ(1.0, animation->iterations());
652 EXPECT_EQ(0, animation->timeOffset()); 652 EXPECT_EQ(0, animation->timeOffset());
653 EXPECT_EQ(CompositorAnimation::Direction::NORMAL, animation->getDirection()) ; 653 EXPECT_EQ(CompositorAnimation::Direction::NORMAL, animation->getDirection()) ;
654 EXPECT_EQ(1.0, animation->playbackRate()); 654 EXPECT_EQ(1.0, animation->playbackRate());
655 655
656 std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animati on->floatCurveForTesting(); 656 OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->float CurveForTesting();
657 657
658 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting(); 658 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting();
659 ASSERT_EQ(2UL, keyframes.size()); 659 ASSERT_EQ(2UL, keyframes.size());
660 660
661 EXPECT_EQ(0, keyframes[0].time); 661 EXPECT_EQ(0, keyframes[0].time);
662 EXPECT_EQ(2.0f, keyframes[0].value); 662 EXPECT_EQ(2.0f, keyframes[0].value);
663 EXPECT_TRUE(keyframedFloatCurve->keyframeHasLinearTimingFunctionForTesting(0 )); 663 EXPECT_TRUE(keyframedFloatCurve->keyframeHasLinearTimingFunctionForTesting(0 ));
664 664
665 EXPECT_EQ(1.0, keyframes[1].time); 665 EXPECT_EQ(1.0, keyframes[1].time);
666 EXPECT_EQ(5.0f, keyframes[1].value); 666 EXPECT_EQ(5.0f, keyframes[1].value);
667 EXPECT_EQ(CubicBezierTimingFunction::EaseType::EASE, keyframedFloatCurve->ge tKeyframeEaseTypeForTesting(1)); 667 EXPECT_EQ(CubicBezierTimingFunction::EaseType::EASE, keyframedFloatCurve->ge tKeyframeEaseTypeForTesting(1));
668 } 668 }
669 669
670 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration) 670 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration)
671 { 671 {
672 // KeyframeEffect to convert 672 // KeyframeEffect to convert
673 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 673 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
674 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 674 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
675 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 675 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
676 676
677 const double duration = 10.0; 677 const double duration = 10.0;
678 m_timing.iterationDuration = duration; 678 m_timing.iterationDuration = duration;
679 679
680 std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimatio n(*effect); 680 OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect );
681 std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animati on->floatCurveForTesting(); 681 OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->float CurveForTesting();
682 682
683 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting(); 683 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting();
684 ASSERT_EQ(2UL, keyframes.size()); 684 ASSERT_EQ(2UL, keyframes.size());
685 685
686 EXPECT_EQ(duration, keyframes[1].time); 686 EXPECT_EQ(duration, keyframes[1].time);
687 } 687 }
688 688
689 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Linear) 689 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Linear)
690 { 690 {
691 // KeyframeEffect to convert 691 // KeyframeEffect to convert
692 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 692 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
693 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 693 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
694 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1. 0).get(), 0.25), 694 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1. 0).get(), 0.25),
695 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20. 0).get(), 0.5), 695 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20. 0).get(), 0.5),
696 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 696 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
697 697
698 m_timing.iterationCount = 5; 698 m_timing.iterationCount = 5;
699 m_timing.direction = Timing::PlaybackDirectionAlternate; 699 m_timing.direction = Timing::PlaybackDirectionAlternate;
700 m_timing.playbackRate = 2.0; 700 m_timing.playbackRate = 2.0;
701 701
702 std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimatio n(*effect); 702 OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect );
703 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); 703 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty());
704 EXPECT_EQ(5.0, animation->iterations()); 704 EXPECT_EQ(5.0, animation->iterations());
705 EXPECT_EQ(0, animation->timeOffset()); 705 EXPECT_EQ(0, animation->timeOffset());
706 EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_NORMAL, animation->getDi rection()); 706 EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_NORMAL, animation->getDi rection());
707 EXPECT_EQ(2.0, animation->playbackRate()); 707 EXPECT_EQ(2.0, animation->playbackRate());
708 708
709 std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animati on->floatCurveForTesting(); 709 OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->float CurveForTesting();
710 710
711 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting(); 711 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting();
712 ASSERT_EQ(4UL, keyframes.size()); 712 ASSERT_EQ(4UL, keyframes.size());
713 713
714 EXPECT_EQ(0, keyframes[0].time); 714 EXPECT_EQ(0, keyframes[0].time);
715 EXPECT_EQ(2.0f, keyframes[0].value); 715 EXPECT_EQ(2.0f, keyframes[0].value);
716 EXPECT_TRUE(keyframedFloatCurve->keyframeHasLinearTimingFunctionForTesting(0 )); 716 EXPECT_TRUE(keyframedFloatCurve->keyframeHasLinearTimingFunctionForTesting(0 ));
717 717
718 EXPECT_EQ(0.25, keyframes[1].time); 718 EXPECT_EQ(0.25, keyframes[1].time);
719 EXPECT_EQ(-1.0f, keyframes[1].value); 719 EXPECT_EQ(-1.0f, keyframes[1].value);
(...skipping 14 matching lines...) Expand all
734 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 734 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
735 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 735 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
736 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 736 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
737 737
738 const double startDelay = 3.25; 738 const double startDelay = 3.25;
739 739
740 m_timing.iterationCount = 5.0; 740 m_timing.iterationCount = 5.0;
741 m_timing.iterationDuration = 1.75; 741 m_timing.iterationDuration = 1.75;
742 m_timing.startDelay = startDelay; 742 m_timing.startDelay = startDelay;
743 743
744 std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimatio n(*effect); 744 OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect );
745 745
746 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); 746 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty());
747 EXPECT_EQ(5.0, animation->iterations()); 747 EXPECT_EQ(5.0, animation->iterations());
748 EXPECT_EQ(-startDelay, animation->timeOffset()); 748 EXPECT_EQ(-startDelay, animation->timeOffset());
749 749
750 std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animati on->floatCurveForTesting(); 750 OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->float CurveForTesting();
751 751
752 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting(); 752 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting();
753 ASSERT_EQ(2UL, keyframes.size()); 753 ASSERT_EQ(2UL, keyframes.size());
754 754
755 EXPECT_EQ(1.75, keyframes[1].time); 755 EXPECT_EQ(1.75, keyframes[1].time);
756 EXPECT_EQ(5.0f, keyframes[1].value); 756 EXPECT_EQ(5.0f, keyframes[1].value);
757 } 757 }
758 758
759 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Chained) 759 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Chained)
760 { 760 {
761 // KeyframeEffect to convert 761 // KeyframeEffect to convert
762 AnimatableValueKeyframeVector frames; 762 AnimatableValueKeyframeVector frames;
763 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(2.0).get(), 0)); 763 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(2.0).get(), 0));
764 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(-1.0).get(), 0.25)); 764 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(-1.0).get(), 0.25));
765 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(20.0).get(), 0.5)); 765 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(20.0).get(), 0.5));
766 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(5.0).get(), 1.0)); 766 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(5.0).get(), 1.0));
767 frames[0]->setEasing(m_cubicEaseTimingFunction.get()); 767 frames[0]->setEasing(m_cubicEaseTimingFunction.get());
768 frames[1]->setEasing(m_linearTimingFunction.get()); 768 frames[1]->setEasing(m_linearTimingFunction.get());
769 frames[2]->setEasing(m_cubicCustomTimingFunction.get()); 769 frames[2]->setEasing(m_cubicCustomTimingFunction.get());
770 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(frames); 770 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(frames);
771 771
772 m_timing.timingFunction = m_linearTimingFunction.get(); 772 m_timing.timingFunction = m_linearTimingFunction.get();
773 m_timing.iterationDuration = 2.0; 773 m_timing.iterationDuration = 2.0;
774 m_timing.iterationCount = 10; 774 m_timing.iterationCount = 10;
775 m_timing.direction = Timing::PlaybackDirectionAlternate; 775 m_timing.direction = Timing::PlaybackDirectionAlternate;
776 776
777 std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimatio n(*effect); 777 OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect );
778 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); 778 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty());
779 EXPECT_EQ(10.0, animation->iterations()); 779 EXPECT_EQ(10.0, animation->iterations());
780 EXPECT_EQ(0, animation->timeOffset()); 780 EXPECT_EQ(0, animation->timeOffset());
781 EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_NORMAL, animation->getDi rection()); 781 EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_NORMAL, animation->getDi rection());
782 EXPECT_EQ(1.0, animation->playbackRate()); 782 EXPECT_EQ(1.0, animation->playbackRate());
783 783
784 std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animati on->floatCurveForTesting(); 784 OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->float CurveForTesting();
785 785
786 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting(); 786 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting();
787 ASSERT_EQ(4UL, keyframes.size()); 787 ASSERT_EQ(4UL, keyframes.size());
788 788
789 EXPECT_EQ(0, keyframes[0].time); 789 EXPECT_EQ(0, keyframes[0].time);
790 EXPECT_EQ(2.0f, keyframes[0].value); 790 EXPECT_EQ(2.0f, keyframes[0].value);
791 EXPECT_EQ(CubicBezierTimingFunction::EaseType::EASE, keyframedFloatCurve->ge tKeyframeEaseTypeForTesting(0)); 791 EXPECT_EQ(CubicBezierTimingFunction::EaseType::EASE, keyframedFloatCurve->ge tKeyframeEaseTypeForTesting(0));
792 792
793 EXPECT_EQ(0.5, keyframes[1].time); 793 EXPECT_EQ(0.5, keyframes[1].time);
794 EXPECT_EQ(-1.0f, keyframes[1].value); 794 EXPECT_EQ(-1.0f, keyframes[1].value);
(...skipping 20 matching lines...) Expand all
815 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(5.0).get(), 1.0)); 815 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(5.0).get(), 1.0));
816 frames[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingFunc tion::EaseType::EASE_IN)); 816 frames[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingFunc tion::EaseType::EASE_IN));
817 frames[1]->setEasing(m_linearTimingFunction.get()); 817 frames[1]->setEasing(m_linearTimingFunction.get());
818 frames[2]->setEasing(cubicEasyFlipTimingFunction.get()); 818 frames[2]->setEasing(cubicEasyFlipTimingFunction.get());
819 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(frames); 819 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(frames);
820 820
821 m_timing.timingFunction = m_linearTimingFunction.get(); 821 m_timing.timingFunction = m_linearTimingFunction.get();
822 m_timing.iterationCount = 10; 822 m_timing.iterationCount = 10;
823 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; 823 m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
824 824
825 std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimatio n(*effect); 825 OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect );
826 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); 826 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty());
827 EXPECT_EQ(10.0, animation->iterations()); 827 EXPECT_EQ(10.0, animation->iterations());
828 EXPECT_EQ(0, animation->timeOffset()); 828 EXPECT_EQ(0, animation->timeOffset());
829 EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_REVERSE, animation->getD irection()); 829 EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_REVERSE, animation->getD irection());
830 EXPECT_EQ(1.0, animation->playbackRate()); 830 EXPECT_EQ(1.0, animation->playbackRate());
831 831
832 std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animati on->floatCurveForTesting(); 832 OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->float CurveForTesting();
833 833
834 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting(); 834 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting();
835 ASSERT_EQ(4UL, keyframes.size()); 835 ASSERT_EQ(4UL, keyframes.size());
836 836
837 EXPECT_TRUE(keyframedFloatCurve->curveHasLinearTimingFunctionForTesting()); 837 EXPECT_TRUE(keyframedFloatCurve->curveHasLinearTimingFunctionForTesting());
838 838
839 EXPECT_EQ(0, keyframes[0].time); 839 EXPECT_EQ(0, keyframes[0].time);
840 EXPECT_EQ(2.0f, keyframes[0].value); 840 EXPECT_EQ(2.0f, keyframes[0].value);
841 EXPECT_EQ(CubicBezierTimingFunction::EaseType::EASE_IN, keyframedFloatCurve- >getKeyframeEaseTypeForTesting(0)); 841 EXPECT_EQ(CubicBezierTimingFunction::EaseType::EASE_IN, keyframedFloatCurve- >getKeyframeEaseTypeForTesting(0));
842 842
(...skipping 17 matching lines...) Expand all
860 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 860 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
861 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 861 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
862 862
863 const double negativeStartDelay = -3; 863 const double negativeStartDelay = -3;
864 864
865 m_timing.iterationCount = 5.0; 865 m_timing.iterationCount = 5.0;
866 m_timing.iterationDuration = 1.5; 866 m_timing.iterationDuration = 1.5;
867 m_timing.startDelay = negativeStartDelay; 867 m_timing.startDelay = negativeStartDelay;
868 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; 868 m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
869 869
870 std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimatio n(*effect); 870 OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect );
871 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); 871 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty());
872 EXPECT_EQ(5.0, animation->iterations()); 872 EXPECT_EQ(5.0, animation->iterations());
873 EXPECT_EQ(-negativeStartDelay, animation->timeOffset()); 873 EXPECT_EQ(-negativeStartDelay, animation->timeOffset());
874 EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_REVERSE, animation->getD irection()); 874 EXPECT_EQ(CompositorAnimation::Direction::ALTERNATE_REVERSE, animation->getD irection());
875 EXPECT_EQ(1.0, animation->playbackRate()); 875 EXPECT_EQ(1.0, animation->playbackRate());
876 876
877 std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animati on->floatCurveForTesting(); 877 OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->float CurveForTesting();
878 878
879 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting(); 879 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting();
880 ASSERT_EQ(2UL, keyframes.size()); 880 ASSERT_EQ(2UL, keyframes.size());
881 } 881 }
882 882
883 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationPlaybackRa tes) 883 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationPlaybackRa tes)
884 { 884 {
885 // KeyframeEffect to convert 885 // KeyframeEffect to convert
886 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 886 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
887 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 887 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
888 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 888 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
889 889
890 const double playbackRate = 2; 890 const double playbackRate = 2;
891 const double playerPlaybackRate = -1.5; 891 const double playerPlaybackRate = -1.5;
892 892
893 m_timing.playbackRate = playbackRate; 893 m_timing.playbackRate = playbackRate;
894 894
895 std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimatio n(*effect, playerPlaybackRate); 895 OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect , playerPlaybackRate);
896 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); 896 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty());
897 EXPECT_EQ(1.0, animation->iterations()); 897 EXPECT_EQ(1.0, animation->iterations());
898 EXPECT_EQ(0, animation->timeOffset()); 898 EXPECT_EQ(0, animation->timeOffset());
899 EXPECT_EQ(CompositorAnimation::Direction::NORMAL, animation->getDirection()) ; 899 EXPECT_EQ(CompositorAnimation::Direction::NORMAL, animation->getDirection()) ;
900 EXPECT_EQ(playbackRate * playerPlaybackRate, animation->playbackRate()); 900 EXPECT_EQ(playbackRate * playerPlaybackRate, animation->playbackRate());
901 901
902 std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animati on->floatCurveForTesting(); 902 OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->float CurveForTesting();
903 903
904 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting(); 904 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting();
905 ASSERT_EQ(2UL, keyframes.size()); 905 ASSERT_EQ(2UL, keyframes.size());
906 } 906 }
907 907
908 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeNo ne) 908 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeNo ne)
909 { 909 {
910 // KeyframeEffect to convert 910 // KeyframeEffect to convert
911 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 911 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
912 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 912 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
913 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 913 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
914 914
915 m_timing.fillMode = Timing::FillModeNone; 915 m_timing.fillMode = Timing::FillModeNone;
916 916
917 std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimatio n(*effect); 917 OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect );
918 EXPECT_EQ(CompositorAnimation::FillMode::NONE, animation->getFillMode()); 918 EXPECT_EQ(CompositorAnimation::FillMode::NONE, animation->getFillMode());
919 } 919 }
920 920
921 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeAu to) 921 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeAu to)
922 { 922 {
923 // KeyframeEffect to convert 923 // KeyframeEffect to convert
924 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 924 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
925 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 925 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
926 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 926 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
927 927
928 m_timing.fillMode = Timing::FillModeAuto; 928 m_timing.fillMode = Timing::FillModeAuto;
929 929
930 std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimatio n(*effect); 930 OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect );
931 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty()); 931 EXPECT_EQ(CompositorTargetProperty::OPACITY, animation->targetProperty());
932 EXPECT_EQ(1.0, animation->iterations()); 932 EXPECT_EQ(1.0, animation->iterations());
933 EXPECT_EQ(0, animation->timeOffset()); 933 EXPECT_EQ(0, animation->timeOffset());
934 EXPECT_EQ(CompositorAnimation::Direction::NORMAL, animation->getDirection()) ; 934 EXPECT_EQ(CompositorAnimation::Direction::NORMAL, animation->getDirection()) ;
935 EXPECT_EQ(1.0, animation->playbackRate()); 935 EXPECT_EQ(1.0, animation->playbackRate());
936 EXPECT_EQ(CompositorAnimation::FillMode::NONE, animation->getFillMode()); 936 EXPECT_EQ(CompositorAnimation::FillMode::NONE, animation->getFillMode());
937 } 937 }
938 938
939 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationWithTiming Function) 939 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationWithTiming Function)
940 { 940 {
941 // KeyframeEffect to convert 941 // KeyframeEffect to convert
942 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 942 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
943 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 943 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
944 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 944 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
945 945
946 m_timing.timingFunction = m_cubicCustomTimingFunction; 946 m_timing.timingFunction = m_cubicCustomTimingFunction;
947 947
948 std::unique_ptr<CompositorAnimation> animation = convertToCompositorAnimatio n(*effect); 948 OwnPtr<CompositorAnimation> animation = convertToCompositorAnimation(*effect );
949 949
950 std::unique_ptr<CompositorFloatAnimationCurve> keyframedFloatCurve = animati on->floatCurveForTesting(); 950 OwnPtr<CompositorFloatAnimationCurve> keyframedFloatCurve = animation->float CurveForTesting();
951 951
952 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting(); 952 Vector<CompositorFloatKeyframe> keyframes = keyframedFloatCurve->keyframesFo rTesting();
953 ASSERT_EQ(2UL, keyframes.size()); 953 ASSERT_EQ(2UL, keyframes.size());
954 954
955 EXPECT_EQ(CubicBezierTimingFunction::EaseType::CUSTOM, keyframedFloatCurve-> getCurveEaseTypeForTesting()); 955 EXPECT_EQ(CubicBezierTimingFunction::EaseType::CUSTOM, keyframedFloatCurve-> getCurveEaseTypeForTesting());
956 956
957 EXPECT_EQ(0, keyframes[0].time); 957 EXPECT_EQ(0, keyframes[0].time);
958 EXPECT_EQ(2.0f, keyframes[0].value); 958 EXPECT_EQ(2.0f, keyframes[0].value);
959 EXPECT_TRUE(keyframedFloatCurve->keyframeHasLinearTimingFunctionForTesting(0 )); 959 EXPECT_TRUE(keyframedFloatCurve->keyframeHasLinearTimingFunctionForTesting(0 ));
960 960
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 simulateFrame(1.); 1007 simulateFrame(1.);
1008 1008
1009 element->setLayoutObject(nullptr); 1009 element->setLayoutObject(nullptr);
1010 LayoutObjectProxy::dispose(layoutObject); 1010 LayoutObjectProxy::dispose(layoutObject);
1011 1011
1012 ThreadHeap::collectAllGarbage(); 1012 ThreadHeap::collectAllGarbage();
1013 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); 1013 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty());
1014 } 1014 }
1015 1015
1016 } // namespace blink 1016 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698