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

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

Issue 1318543009: Oilpan: Partially ship Oilpan for core/animations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 /* 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe stBase { 69 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe stBase {
70 protected: 70 protected:
71 RefPtr<TimingFunction> m_linearTimingFunction; 71 RefPtr<TimingFunction> m_linearTimingFunction;
72 RefPtr<TimingFunction> m_cubicEaseTimingFunction; 72 RefPtr<TimingFunction> m_cubicEaseTimingFunction;
73 RefPtr<TimingFunction> m_cubicCustomTimingFunction; 73 RefPtr<TimingFunction> m_cubicCustomTimingFunction;
74 RefPtr<TimingFunction> m_stepTimingFunction; 74 RefPtr<TimingFunction> m_stepTimingFunction;
75 75
76 Timing m_timing; 76 Timing m_timing;
77 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; 77 CompositorAnimationsImpl::CompositorTiming m_compositorTiming;
78 OwnPtrWillBePersistent<AnimatableValueKeyframeVector> m_keyframeVector2; 78 OwnPtrWillBePersistent<AnimatableValueKeyframeVector> m_keyframeVector2;
79 RefPtrWillBePersistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimati onEffect2; 79 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2;
80 OwnPtrWillBePersistent<AnimatableValueKeyframeVector> m_keyframeVector5; 80 OwnPtrWillBePersistent<AnimatableValueKeyframeVector> m_keyframeVector5;
81 RefPtrWillBePersistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimati onEffect5; 81 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5;
82 82
83 RefPtrWillBePersistent<Document> m_document; 83 RefPtrWillBePersistent<Document> m_document;
84 RefPtrWillBePersistent<Element> m_element; 84 RefPtrWillBePersistent<Element> m_element;
85 RefPtrWillBePersistent<AnimationTimeline> m_timeline; 85 Persistent<AnimationTimeline> m_timeline;
86 86
87 virtual void SetUp() 87 virtual void SetUp()
88 { 88 {
89 AnimationCompositorAnimationsTestBase::SetUp(); 89 AnimationCompositorAnimationsTestBase::SetUp();
90 90
91 m_linearTimingFunction = LinearTimingFunction::shared(); 91 m_linearTimingFunction = LinearTimingFunction::shared();
92 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::Ease); 92 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::Ease);
93 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3, 4); 93 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3, 4);
94 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio n::End); 94 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio n::End);
95 95
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 bool duplicateSingleKeyframeAndTestIsCandidateOnResult(AnimatableValueKeyfra me* frame) 137 bool duplicateSingleKeyframeAndTestIsCandidateOnResult(AnimatableValueKeyfra me* frame)
138 { 138 {
139 EXPECT_EQ(frame->offset(), 0); 139 EXPECT_EQ(frame->offset(), 0);
140 AnimatableValueKeyframeVector frames; 140 AnimatableValueKeyframeVector frames;
141 RefPtrWillBeRawPtr<Keyframe> second = frame->cloneWithOffset(1); 141 RefPtrWillBeRawPtr<Keyframe> second = frame->cloneWithOffset(1);
142 142
143 frames.append(frame); 143 frames.append(frame);
144 frames.append(toAnimatableValueKeyframe(second.get())); 144 frames.append(toAnimatableValueKeyframe(second.get()));
145 return isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueKey frameEffectModel::create(frames).get()); 145 return isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueKey frameEffectModel::create(frames));
146 } 146 }
147 147
148 // ------------------------------------------------------------------- 148 // -------------------------------------------------------------------
149 149
150 Timing createCompositableTiming() 150 Timing createCompositableTiming()
151 { 151 {
152 Timing timing; 152 Timing timing;
153 timing.startDelay = 0; 153 timing.startDelay = 0;
154 timing.fillMode = Timing::FillModeNone; 154 timing.fillMode = Timing::FillModeNone;
155 timing.iterationStart = 0; 155 timing.iterationStart = 0;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 { 209 {
210 OwnPtrWillBeRawPtr<AnimatableValueKeyframeVector> frames = adoptPtrWillB eNoop(new AnimatableValueKeyframeVector); 210 OwnPtrWillBeRawPtr<AnimatableValueKeyframeVector> frames = adoptPtrWillB eNoop(new AnimatableValueKeyframeVector);
211 for (size_t i = 0; i < values.size(); ++i) { 211 for (size_t i = 0; i < values.size(); ++i) {
212 double offset = 1.0f / (values.size() - 1) * i; 212 double offset = 1.0f / (values.size() - 1) * i;
213 RefPtrWillBeRawPtr<AnimatableTransform> value = AnimatableTransform: :create(values[i]); 213 RefPtrWillBeRawPtr<AnimatableTransform> value = AnimatableTransform: :create(values[i]);
214 frames->append(createReplaceOpKeyframe(CSSPropertyTransform, value.g et(), offset).get()); 214 frames->append(createReplaceOpKeyframe(CSSPropertyTransform, value.g et(), offset).get());
215 } 215 }
216 return frames.release(); 216 return frames.release();
217 } 217 }
218 218
219 PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframeEff ectModel(PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> prpFrom, PassRefPtrWill BeRawPtr<AnimatableValueKeyframe> prpTo, PassRefPtrWillBeRawPtr<AnimatableValueK eyframe> prpC = nullptr, PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> prpD = nullptr) 219 AnimatableValueKeyframeEffectModel* createKeyframeEffectModel(PassRefPtrWill BeRawPtr<AnimatableValueKeyframe> prpFrom, PassRefPtrWillBeRawPtr<AnimatableValu eKeyframe> prpTo, PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> prpC = nullptr , PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> prpD = nullptr)
220 { 220 {
221 RefPtrWillBeRawPtr<AnimatableValueKeyframe> from = prpFrom; 221 RefPtrWillBeRawPtr<AnimatableValueKeyframe> from = prpFrom;
222 RefPtrWillBeRawPtr<AnimatableValueKeyframe> to = prpTo; 222 RefPtrWillBeRawPtr<AnimatableValueKeyframe> to = prpTo;
223 RefPtrWillBeRawPtr<AnimatableValueKeyframe> c = prpC; 223 RefPtrWillBeRawPtr<AnimatableValueKeyframe> c = prpC;
224 RefPtrWillBeRawPtr<AnimatableValueKeyframe> d = prpD; 224 RefPtrWillBeRawPtr<AnimatableValueKeyframe> d = prpD;
225 225
226 EXPECT_EQ(from->offset(), 0); 226 EXPECT_EQ(from->offset(), 0);
227 AnimatableValueKeyframeVector frames; 227 AnimatableValueKeyframeVector frames;
228 frames.append(from); 228 frames.append(from);
229 EXPECT_LE(from->offset(), to->offset()); 229 EXPECT_LE(from->offset(), to->offset());
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 ops2.operations().append(TranslateTransformOperation::create(calcLength, Len gth(0, Fixed), TransformOperation::TranslateX)); 305 ops2.operations().append(TranslateTransformOperation::create(calcLength, Len gth(0, Fixed), TransformOperation::TranslateX));
306 RefPtrWillBeRawPtr<AnimatableValueKeyframe> badKeyframe2 = createReplaceOpKe yframe(CSSPropertyTransform, AnimatableTransform::create(ops2).get()); 306 RefPtrWillBeRawPtr<AnimatableValueKeyframe> badKeyframe2 = createReplaceOpKe yframe(CSSPropertyTransform, AnimatableTransform::create(ops2).get());
307 EXPECT_FALSE(duplicateSingleKeyframeAndTestIsCandidateOnResult(badKeyframe2. get())); 307 EXPECT_FALSE(duplicateSingleKeyframeAndTestIsCandidateOnResult(badKeyframe2. get()));
308 } 308 }
309 309
310 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey frameEffectModelMultipleFramesOkay) 310 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey frameEffectModelMultipleFramesOkay)
311 { 311 {
312 AnimatableValueKeyframeVector framesSame; 312 AnimatableValueKeyframeVector framesSame;
313 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Com positeReplace, 0.0).get()); 313 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Com positeReplace, 0.0).get());
314 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Com positeReplace, 1.0).get()); 314 framesSame.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Com positeReplace, 1.0).get());
315 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueKe yframeEffectModel::create(framesSame).get())); 315 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueKe yframeEffectModel::create(framesSame)));
316 316
317 AnimatableValueKeyframeVector framesMixed; 317 AnimatableValueKeyframeVector framesMixed;
318 framesMixed.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Co mpositeReplace, 0.0).get()); 318 framesMixed.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Co mpositeReplace, 0.0).get());
319 framesMixed.append(createDefaultKeyframe(CSSPropertyTransform, EffectModel:: CompositeReplace, 1.0).get()); 319 framesMixed.append(createDefaultKeyframe(CSSPropertyTransform, EffectModel:: CompositeReplace, 1.0).get());
320 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK eyframeEffectModel::create(framesMixed).get())); 320 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK eyframeEffectModel::create(framesMixed)));
321 } 321 }
322 322
323 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey frameEffectModel) 323 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey frameEffectModel)
324 { 324 {
325 AnimatableValueKeyframeVector framesSame; 325 AnimatableValueKeyframeVector framesSame;
326 framesSame.append(createDefaultKeyframe(CSSPropertyColor, EffectModel::Compo siteReplace, 0.0).get()); 326 framesSame.append(createDefaultKeyframe(CSSPropertyColor, EffectModel::Compo siteReplace, 0.0).get());
327 framesSame.append(createDefaultKeyframe(CSSPropertyColor, EffectModel::Compo siteReplace, 1.0).get()); 327 framesSame.append(createDefaultKeyframe(CSSPropertyColor, EffectModel::Compo siteReplace, 1.0).get());
328 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK eyframeEffectModel::create(framesSame).get())); 328 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK eyframeEffectModel::create(framesSame)));
329 329
330 AnimatableValueKeyframeVector framesMixedProperties; 330 AnimatableValueKeyframeVector framesMixedProperties;
331 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyOpacity, Effec tModel::CompositeReplace, 0.0).get()); 331 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyOpacity, Effec tModel::CompositeReplace, 0.0).get());
332 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyColor, EffectM odel::CompositeReplace, 1.0).get()); 332 framesMixedProperties.append(createDefaultKeyframe(CSSPropertyColor, EffectM odel::CompositeReplace, 1.0).get());
333 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK eyframeEffectModel::create(framesMixedProperties).get())); 333 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *AnimatableValueK eyframeEffectModel::create(framesMixedProperties)));
334 } 334 }
335 335
336 TEST_F(AnimationCompositorAnimationsTest, AnimatedBoundingBox) 336 TEST_F(AnimationCompositorAnimationsTest, AnimatedBoundingBox)
337 { 337 {
338 Vector<TransformOperations> transformVector; 338 Vector<TransformOperations> transformVector;
339 transformVector.append(TransformOperations()); 339 transformVector.append(TransformOperations());
340 transformVector.last().operations().append(TranslateTransformOperation::crea te(Length(0, Fixed), Length(0, Fixed), 0.0, TransformOperation::Translate3D)); 340 transformVector.last().operations().append(TranslateTransformOperation::crea te(Length(0, Fixed), Length(0, Fixed), 0.0, TransformOperation::Translate3D));
341 transformVector.append(TransformOperations()); 341 transformVector.append(TransformOperations());
342 transformVector.last().operations().append(TranslateTransformOperation::crea te(Length(200, Fixed), Length(200, Fixed), 0.0, TransformOperation::Translate3D) ); 342 transformVector.last().operations().append(TranslateTransformOperation::crea te(Length(200, Fixed), Length(200, Fixed), 0.0, TransformOperation::Translate3D) );
343 OwnPtrWillBePersistent<AnimatableValueKeyframeVector> frames = createComposi tableTransformKeyframeVector(transformVector); 343 OwnPtrWillBePersistent<AnimatableValueKeyframeVector> frames = createComposi tableTransformKeyframeVector(transformVector);
344 FloatBox bounds; 344 FloatBox bounds;
345 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel:: create(*frames).get(), 0, 1)); 345 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel:: create(*frames), 0, 1));
346 EXPECT_EQ(FloatBox(0.0f, 0.f, 0.0f, 200.0f, 200.0f, 0.0f), bounds); 346 EXPECT_EQ(FloatBox(0.0f, 0.f, 0.0f, 200.0f, 200.0f, 0.0f), bounds);
347 bounds = FloatBox(); 347 bounds = FloatBox();
348 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel:: create(*frames).get(), -1, 1)); 348 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel:: create(*frames), -1, 1));
349 EXPECT_EQ(FloatBox(-200.0f, -200.0, 0.0, 400.0f, 400.0f, 0.0f), bounds); 349 EXPECT_EQ(FloatBox(-200.0f, -200.0, 0.0, 400.0f, 400.0f, 0.0f), bounds);
350 transformVector.append(TransformOperations()); 350 transformVector.append(TransformOperations());
351 transformVector.last().operations().append(TranslateTransformOperation::crea te(Length(-300, Fixed), Length(-400, Fixed), 1.0f, TransformOperation::Translate 3D)); 351 transformVector.last().operations().append(TranslateTransformOperation::crea te(Length(-300, Fixed), Length(-400, Fixed), 1.0f, TransformOperation::Translate 3D));
352 bounds = FloatBox(); 352 bounds = FloatBox();
353 frames = createCompositableTransformKeyframeVector(transformVector); 353 frames = createCompositableTransformKeyframeVector(transformVector);
354 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel:: create(*frames).get(), 0, 1)); 354 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel:: create(*frames), 0, 1));
355 EXPECT_EQ(FloatBox(-300.0f, -400.f, 0.0f, 500.0f, 600.0f, 1.0f), bounds); 355 EXPECT_EQ(FloatBox(-300.0f, -400.f, 0.0f, 500.0f, 600.0f, 1.0f), bounds);
356 bounds = FloatBox(); 356 bounds = FloatBox();
357 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel:: create(*frames).get(), -1, 2)); 357 EXPECT_TRUE(getAnimationBounds(bounds, *AnimatableValueKeyframeEffectModel:: create(*frames), -1, 2));
358 EXPECT_EQ(FloatBox(-1300.0f, -1600.f, 0.0f, 1500.0f, 1800.0f, 3.0f), bounds) ; 358 EXPECT_EQ(FloatBox(-1300.0f, -1600.f, 0.0f, 1500.0f, 1800.0f, 3.0f), bounds) ;
359 } 359 }
360 360
361 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorStartDelay) 361 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorStartDelay)
362 { 362 {
363 m_timing.iterationDuration = 20.0; 363 m_timing.iterationDuration = 20.0;
364 364
365 m_timing.startDelay = 2.0; 365 m_timing.startDelay = 2.0;
366 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); 366 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
367 EXPECT_DOUBLE_EQ(-2.0, m_compositorTiming.scaledTimeOffset); 367 EXPECT_DOUBLE_EQ(-2.0, m_compositorTiming.scaledTimeOffset);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 m_timing.startDelay = -11.0; 493 m_timing.startDelay = -11.0;
494 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); 494 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
495 EXPECT_DOUBLE_EQ(11.0, m_compositorTiming.scaledTimeOffset); 495 EXPECT_DOUBLE_EQ(11.0, m_compositorTiming.scaledTimeOffset);
496 EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount); 496 EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
497 EXPECT_EQ(m_compositorTiming.direction, Timing::PlaybackDirectionAlternateRe verse); 497 EXPECT_EQ(m_compositorTiming.direction, Timing::PlaybackDirectionAlternateRe verse);
498 } 498 }
499 499
500 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionLinear) 500 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionLinear)
501 { 501 {
502 m_timing.timingFunction = m_linearTimingFunction; 502 m_timing.timingFunction = m_linearTimingFunction;
503 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 503 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2));
504 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 504 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5));
505 } 505 }
506 506
507 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionCubic) 507 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionCubic)
508 { 508 {
509 m_timing.timingFunction = m_cubicEaseTimingFunction; 509 m_timing.timingFunction = m_cubicEaseTimingFunction;
510 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 510 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2));
511 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 511 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5));
512 512
513 m_timing.timingFunction = m_cubicCustomTimingFunction; 513 m_timing.timingFunction = m_cubicCustomTimingFunction;
514 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 514 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2));
515 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 515 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5));
516 } 516 }
517 517
518 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionSteps) 518 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionSteps)
519 { 519 {
520 m_timing.timingFunction = m_stepTimingFunction; 520 m_timing.timingFunction = m_stepTimingFunction;
521 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 521 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2));
522 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 522 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5));
523 } 523 }
524 524
525 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionChainedLinear) 525 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionChainedLinear)
526 { 526 {
527 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 527 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2));
528 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 528 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5));
529 } 529 }
530 530
531 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorNon LinearTimingFunctionOnFirstOrLastFrame) 531 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorNon LinearTimingFunctionOnFirstOrLastFrame)
532 { 532 {
533 (*m_keyframeVector2)[0]->setEasing(m_cubicEaseTimingFunction.get()); 533 (*m_keyframeVector2)[0]->setEasing(m_cubicEaseTimingFunction.get());
534 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2); 534 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2);
535 535
536 (*m_keyframeVector5)[3]->setEasing(m_cubicEaseTimingFunction.get()); 536 (*m_keyframeVector5)[3]->setEasing(m_cubicEaseTimingFunction.get());
537 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5); 537 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5);
538 538
539 m_timing.timingFunction = m_cubicEaseTimingFunction; 539 m_timing.timingFunction = m_cubicEaseTimingFunction;
540 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 540 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2));
541 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 541 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5));
542 542
543 m_timing.timingFunction = m_cubicCustomTimingFunction; 543 m_timing.timingFunction = m_cubicCustomTimingFunction;
544 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 544 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2));
545 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 545 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5));
546 } 546 }
547 547
548 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionChainedCubicMatchingOffsets) 548 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionChainedCubicMatchingOffsets)
549 { 549 {
550 (*m_keyframeVector2)[0]->setEasing(m_cubicEaseTimingFunction.get()); 550 (*m_keyframeVector2)[0]->setEasing(m_cubicEaseTimingFunction.get());
551 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2); 551 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2);
552 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 552 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2));
553 553
554 (*m_keyframeVector2)[0]->setEasing(m_cubicCustomTimingFunction.get()); 554 (*m_keyframeVector2)[0]->setEasing(m_cubicCustomTimingFunction.get());
555 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2); 555 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2);
556 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 556 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2));
557 557
558 (*m_keyframeVector5)[0]->setEasing(m_cubicEaseTimingFunction.get()); 558 (*m_keyframeVector5)[0]->setEasing(m_cubicEaseTimingFunction.get());
559 (*m_keyframeVector5)[1]->setEasing(m_cubicCustomTimingFunction.get()); 559 (*m_keyframeVector5)[1]->setEasing(m_cubicCustomTimingFunction.get());
560 (*m_keyframeVector5)[2]->setEasing(m_cubicCustomTimingFunction.get()); 560 (*m_keyframeVector5)[2]->setEasing(m_cubicCustomTimingFunction.get());
561 (*m_keyframeVector5)[3]->setEasing(m_cubicCustomTimingFunction.get()); 561 (*m_keyframeVector5)[3]->setEasing(m_cubicCustomTimingFunction.get());
562 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5); 562 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5);
563 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 563 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5));
564 } 564 }
565 565
566 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionMixedGood) 566 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionMixedGood)
567 { 567 {
568 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); 568 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get());
569 (*m_keyframeVector5)[1]->setEasing(m_cubicEaseTimingFunction.get()); 569 (*m_keyframeVector5)[1]->setEasing(m_cubicEaseTimingFunction.get());
570 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); 570 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get());
571 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); 571 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get());
572 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5); 572 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5);
573 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 573 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5));
574 } 574 }
575 575
576 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionWithStepOkay) 576 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionWithStepOkay)
577 { 577 {
578 (*m_keyframeVector2)[0]->setEasing(m_stepTimingFunction.get()); 578 (*m_keyframeVector2)[0]->setEasing(m_stepTimingFunction.get());
579 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2); 579 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2);
580 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 580 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2));
581 581
582 (*m_keyframeVector5)[0]->setEasing(m_stepTimingFunction.get()); 582 (*m_keyframeVector5)[0]->setEasing(m_stepTimingFunction.get());
583 (*m_keyframeVector5)[1]->setEasing(m_linearTimingFunction.get()); 583 (*m_keyframeVector5)[1]->setEasing(m_linearTimingFunction.get());
584 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); 584 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get());
585 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); 585 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get());
586 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5); 586 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5);
587 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 587 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5));
588 588
589 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); 589 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get());
590 (*m_keyframeVector5)[1]->setEasing(m_stepTimingFunction.get()); 590 (*m_keyframeVector5)[1]->setEasing(m_stepTimingFunction.get());
591 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); 591 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get());
592 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get()); 592 (*m_keyframeVector5)[3]->setEasing(m_linearTimingFunction.get());
593 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5); 593 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5);
594 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 594 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5));
595 595
596 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get()); 596 (*m_keyframeVector5)[0]->setEasing(m_linearTimingFunction.get());
597 (*m_keyframeVector5)[1]->setEasing(m_cubicEaseTimingFunction.get()); 597 (*m_keyframeVector5)[1]->setEasing(m_cubicEaseTimingFunction.get());
598 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get()); 598 (*m_keyframeVector5)[2]->setEasing(m_cubicEaseTimingFunction.get());
599 (*m_keyframeVector5)[3]->setEasing(m_stepTimingFunction.get()); 599 (*m_keyframeVector5)[3]->setEasing(m_stepTimingFunction.get());
600 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5); 600 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5);
601 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 601 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5));
602 } 602 }
603 603
604 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositor) 604 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositor)
605 { 605 {
606 Timing linearTiming(createCompositableTiming()); 606 Timing linearTiming(createCompositableTiming());
607 607
608 AnimatableValueKeyframeVector basicFramesVector; 608 AnimatableValueKeyframeVector basicFramesVector;
609 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, EffectMod el::CompositeReplace, 0.0).get()); 609 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, EffectMod el::CompositeReplace, 0.0).get());
610 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, EffectMod el::CompositeReplace, 1.0).get()); 610 basicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, EffectMod el::CompositeReplace, 1.0).get());
611 611
612 AnimatableValueKeyframeVector nonBasicFramesVector; 612 AnimatableValueKeyframeVector nonBasicFramesVector;
613 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Effect Model::CompositeReplace, 0.0).get()); 613 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Effect Model::CompositeReplace, 0.0).get());
614 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Effect Model::CompositeReplace, 0.5).get()); 614 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Effect Model::CompositeReplace, 0.5).get());
615 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Effect Model::CompositeReplace, 1.0).get()); 615 nonBasicFramesVector.append(createDefaultKeyframe(CSSPropertyOpacity, Effect Model::CompositeReplace, 1.0).get());
616 616
617 basicFramesVector[0]->setEasing(m_linearTimingFunction.get()); 617 basicFramesVector[0]->setEasing(m_linearTimingFunction.get());
618 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> basicFrames = Animata bleValueKeyframeEffectModel::create(basicFramesVector).get(); 618 AnimatableValueKeyframeEffectModel* basicFrames = AnimatableValueKeyframeEff ectModel::create(basicFramesVector);
619 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *basicFrames.g et())); 619 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *basicFrames)) ;
620 620
621 basicFramesVector[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::EaseIn)); 621 basicFramesVector[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::EaseIn));
622 basicFrames = AnimatableValueKeyframeEffectModel::create(basicFramesVector). get(); 622 basicFrames = AnimatableValueKeyframeEffectModel::create(basicFramesVector);
623 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *basicFrames.g et())); 623 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *basicFrames)) ;
624 624
625 nonBasicFramesVector[0]->setEasing(m_linearTimingFunction.get()); 625 nonBasicFramesVector[0]->setEasing(m_linearTimingFunction.get());
626 nonBasicFramesVector[1]->setEasing(CubicBezierTimingFunction::preset(CubicBe zierTimingFunction::EaseIn)); 626 nonBasicFramesVector[1]->setEasing(CubicBezierTimingFunction::preset(CubicBe zierTimingFunction::EaseIn));
627 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> nonBasicFrames = Anim atableValueKeyframeEffectModel::create(nonBasicFramesVector).get(); 627 AnimatableValueKeyframeEffectModel* nonBasicFrames = AnimatableValueKeyframe EffectModel::create(nonBasicFramesVector);
628 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *nonBasicFrame s.get())); 628 EXPECT_TRUE(isCandidateForAnimationOnCompositor(linearTiming, *nonBasicFrame s));
629 } 629 }
630 630
631 // ----------------------------------------------------------------------- 631 // -----------------------------------------------------------------------
632 // ----------------------------------------------------------------------- 632 // -----------------------------------------------------------------------
633 633
634 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation) 634 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation)
635 { 635 {
636 // KeyframeEffect to convert 636 // KeyframeEffect to convert
637 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 637 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
638 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 638 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
639 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 639 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
640 // -- 640 // --
641 641
642 WebCompositorSupportMock mockCompositor; 642 WebCompositorSupportMock mockCompositor;
643 643
644 // Curve is created 644 // Curve is created
645 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 645 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
646 ExpectationSet usesMockCurve; 646 ExpectationSet usesMockCurve;
647 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 647 EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
(...skipping 17 matching lines...) Expand all
665 EXPECT_CALL(*mockAnimationPtr, delete_()) 665 EXPECT_CALL(*mockAnimationPtr, delete_())
666 .Times(1) 666 .Times(1)
667 .After(usesMockAnimation); 667 .After(usesMockAnimation);
668 EXPECT_CALL(*mockCurvePtr, delete_()) 668 EXPECT_CALL(*mockCurvePtr, delete_())
669 .Times(1) 669 .Times(1)
670 .After(usesMockCurve); 670 .After(usesMockCurve);
671 671
672 // Go! 672 // Go!
673 setCompositorForTesting(mockCompositor); 673 setCompositorForTesting(mockCompositor);
674 Vector<OwnPtr<WebCompositorAnimation>> result; 674 Vector<OwnPtr<WebCompositorAnimation>> result;
675 getAnimationOnCompositor(m_timing, *effect.get(), result); 675 getAnimationOnCompositor(m_timing, *effect, result);
676 EXPECT_EQ(1U, result.size()); 676 EXPECT_EQ(1U, result.size());
677 result[0].clear(); 677 result[0].clear();
678 } 678 }
679 679
680 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration) 680 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration)
681 { 681 {
682 // KeyframeEffect to convert 682 // KeyframeEffect to convert
683 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 683 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
684 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 684 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
685 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 685 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
686 686
687 m_timing.iterationDuration = 10.0; 687 m_timing.iterationDuration = 10.0;
688 // -- 688 // --
689 689
690 WebCompositorSupportMock mockCompositor; 690 WebCompositorSupportMock mockCompositor;
691 691
692 // Curve is created 692 // Curve is created
693 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 693 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
(...skipping 19 matching lines...) Expand all
713 EXPECT_CALL(*mockAnimationPtr, delete_()) 713 EXPECT_CALL(*mockAnimationPtr, delete_())
714 .Times(1) 714 .Times(1)
715 .After(usesMockAnimation); 715 .After(usesMockAnimation);
716 EXPECT_CALL(*mockCurvePtr, delete_()) 716 EXPECT_CALL(*mockCurvePtr, delete_())
717 .Times(1) 717 .Times(1)
718 .After(usesMockCurve); 718 .After(usesMockCurve);
719 719
720 // Go! 720 // Go!
721 setCompositorForTesting(mockCompositor); 721 setCompositorForTesting(mockCompositor);
722 Vector<OwnPtr<WebCompositorAnimation>> result; 722 Vector<OwnPtr<WebCompositorAnimation>> result;
723 getAnimationOnCompositor(m_timing, *effect.get(), result); 723 getAnimationOnCompositor(m_timing, *effect, result);
724 EXPECT_EQ(1U, result.size()); 724 EXPECT_EQ(1U, result.size());
725 result[0].clear(); 725 result[0].clear();
726 } 726 }
727 727
728 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Linear) 728 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Linear)
729 { 729 {
730 // KeyframeEffect to convert 730 // KeyframeEffect to convert
731 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 731 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
732 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 732 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
733 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1. 0).get(), 0.25), 733 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1. 0).get(), 0.25),
734 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20. 0).get(), 0.5), 734 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20. 0).get(), 0.5),
735 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 735 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
736 736
737 m_timing.iterationCount = 5; 737 m_timing.iterationCount = 5;
738 m_timing.direction = Timing::PlaybackDirectionAlternate; 738 m_timing.direction = Timing::PlaybackDirectionAlternate;
739 m_timing.playbackRate = 2.0; 739 m_timing.playbackRate = 2.0;
740 // -- 740 // --
741 741
(...skipping 26 matching lines...) Expand all
768 EXPECT_CALL(*mockAnimationPtr, delete_()) 768 EXPECT_CALL(*mockAnimationPtr, delete_())
769 .Times(1) 769 .Times(1)
770 .After(usesMockAnimation); 770 .After(usesMockAnimation);
771 EXPECT_CALL(*mockCurvePtr, delete_()) 771 EXPECT_CALL(*mockCurvePtr, delete_())
772 .Times(1) 772 .Times(1)
773 .After(usesMockCurve); 773 .After(usesMockCurve);
774 774
775 // Go! 775 // Go!
776 setCompositorForTesting(mockCompositor); 776 setCompositorForTesting(mockCompositor);
777 Vector<OwnPtr<WebCompositorAnimation>> result; 777 Vector<OwnPtr<WebCompositorAnimation>> result;
778 getAnimationOnCompositor(m_timing, *effect.get(), result); 778 getAnimationOnCompositor(m_timing, *effect, result);
779 EXPECT_EQ(1U, result.size()); 779 EXPECT_EQ(1U, result.size());
780 result[0].clear(); 780 result[0].clear();
781 } 781 }
782 782
783 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationStartDelay ) 783 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationStartDelay )
784 { 784 {
785 // KeyframeEffect to convert 785 // KeyframeEffect to convert
786 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 786 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
787 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 787 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
788 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 788 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
789 789
790 m_timing.iterationCount = 5.0; 790 m_timing.iterationCount = 5.0;
791 m_timing.iterationDuration = 1.75; 791 m_timing.iterationDuration = 1.75;
792 m_timing.startDelay = 3.25; 792 m_timing.startDelay = 3.25;
793 // -- 793 // --
794 794
795 WebCompositorSupportMock mockCompositor; 795 WebCompositorSupportMock mockCompositor;
796 796
(...skipping 21 matching lines...) Expand all
818 EXPECT_CALL(*mockAnimationPtr, delete_()) 818 EXPECT_CALL(*mockAnimationPtr, delete_())
819 .Times(1) 819 .Times(1)
820 .After(usesMockAnimation); 820 .After(usesMockAnimation);
821 EXPECT_CALL(*mockCurvePtr, delete_()) 821 EXPECT_CALL(*mockCurvePtr, delete_())
822 .Times(1) 822 .Times(1)
823 .After(usesMockCurve); 823 .After(usesMockCurve);
824 824
825 // Go! 825 // Go!
826 setCompositorForTesting(mockCompositor); 826 setCompositorForTesting(mockCompositor);
827 Vector<OwnPtr<WebCompositorAnimation>> result; 827 Vector<OwnPtr<WebCompositorAnimation>> result;
828 getAnimationOnCompositor(m_timing, *effect.get(), result); 828 getAnimationOnCompositor(m_timing, *effect, result);
829 EXPECT_EQ(1U, result.size()); 829 EXPECT_EQ(1U, result.size());
830 result[0].clear(); 830 result[0].clear();
831 } 831 }
832 832
833 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Chained) 833 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Chained)
834 { 834 {
835 // KeyframeEffect to convert 835 // KeyframeEffect to convert
836 AnimatableValueKeyframeVector frames; 836 AnimatableValueKeyframeVector frames;
837 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(2.0).get(), 0)); 837 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(2.0).get(), 0));
838 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(-1.0).get(), 0.25)); 838 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(-1.0).get(), 0.25));
839 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(20.0).get(), 0.5)); 839 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(20.0).get(), 0.5));
840 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(5.0).get(), 1.0)); 840 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(5.0).get(), 1.0));
841 frames[0]->setEasing(m_cubicEaseTimingFunction.get()); 841 frames[0]->setEasing(m_cubicEaseTimingFunction.get());
842 frames[1]->setEasing(m_linearTimingFunction.get()); 842 frames[1]->setEasing(m_linearTimingFunction.get());
843 frames[2]->setEasing(m_cubicCustomTimingFunction.get()); 843 frames[2]->setEasing(m_cubicCustomTimingFunction.get());
844 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa lueKeyframeEffectModel::create(frames); 844 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(frames);
845 845
846 m_timing.timingFunction = m_linearTimingFunction.get(); 846 m_timing.timingFunction = m_linearTimingFunction.get();
847 m_timing.iterationDuration = 2.0; 847 m_timing.iterationDuration = 2.0;
848 m_timing.iterationCount = 10; 848 m_timing.iterationCount = 10;
849 m_timing.direction = Timing::PlaybackDirectionAlternate; 849 m_timing.direction = Timing::PlaybackDirectionAlternate;
850 // -- 850 // --
851 851
852 WebCompositorSupportMock mockCompositor; 852 WebCompositorSupportMock mockCompositor;
853 853
854 // Curve is created 854 // Curve is created
(...skipping 23 matching lines...) Expand all
878 EXPECT_CALL(*mockAnimationPtr, delete_()) 878 EXPECT_CALL(*mockAnimationPtr, delete_())
879 .Times(1) 879 .Times(1)
880 .After(usesMockAnimation); 880 .After(usesMockAnimation);
881 EXPECT_CALL(*mockCurvePtr, delete_()) 881 EXPECT_CALL(*mockCurvePtr, delete_())
882 .Times(1) 882 .Times(1)
883 .After(usesMockCurve); 883 .After(usesMockCurve);
884 884
885 // Go! 885 // Go!
886 setCompositorForTesting(mockCompositor); 886 setCompositorForTesting(mockCompositor);
887 Vector<OwnPtr<WebCompositorAnimation>> result; 887 Vector<OwnPtr<WebCompositorAnimation>> result;
888 getAnimationOnCompositor(m_timing, *effect.get(), result); 888 getAnimationOnCompositor(m_timing, *effect, result);
889 EXPECT_EQ(1U, result.size()); 889 EXPECT_EQ(1U, result.size());
890 result[0].clear(); 890 result[0].clear();
891 } 891 }
892 892
893 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation) 893 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation)
894 { 894 {
895 RefPtr<TimingFunction> cubicEasyFlipTimingFunction = CubicBezierTimingFuncti on::create(0.0, 0.0, 0.0, 1.0); 895 RefPtr<TimingFunction> cubicEasyFlipTimingFunction = CubicBezierTimingFuncti on::create(0.0, 0.0, 0.0, 1.0);
896 896
897 // KeyframeEffect to convert 897 // KeyframeEffect to convert
898 AnimatableValueKeyframeVector frames; 898 AnimatableValueKeyframeVector frames;
899 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(2.0).get(), 0)); 899 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(2.0).get(), 0));
900 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(-1.0).get(), 0.25)); 900 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(-1.0).get(), 0.25));
901 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(20.0).get(), 0.5)); 901 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(20.0).get(), 0.5));
902 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(5.0).get(), 1.0)); 902 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(5.0).get(), 1.0));
903 frames[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingFunc tion::EaseIn)); 903 frames[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingFunc tion::EaseIn));
904 frames[1]->setEasing(m_linearTimingFunction.get()); 904 frames[1]->setEasing(m_linearTimingFunction.get());
905 frames[2]->setEasing(cubicEasyFlipTimingFunction.get()); 905 frames[2]->setEasing(cubicEasyFlipTimingFunction.get());
906 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa lueKeyframeEffectModel::create(frames); 906 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(frames);
907 907
908 m_timing.timingFunction = m_linearTimingFunction.get(); 908 m_timing.timingFunction = m_linearTimingFunction.get();
909 m_timing.iterationCount = 10; 909 m_timing.iterationCount = 10;
910 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; 910 m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
911 // -- 911 // --
912 912
913 WebCompositorSupportMock mockCompositor; 913 WebCompositorSupportMock mockCompositor;
914 914
915 // Curve is created 915 // Curve is created
916 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock(); 916 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock();
(...skipping 22 matching lines...) Expand all
939 EXPECT_CALL(*mockAnimationPtr, delete_()) 939 EXPECT_CALL(*mockAnimationPtr, delete_())
940 .Times(1) 940 .Times(1)
941 .After(usesMockAnimation); 941 .After(usesMockAnimation);
942 EXPECT_CALL(*mockCurvePtr, delete_()) 942 EXPECT_CALL(*mockCurvePtr, delete_())
943 .Times(1) 943 .Times(1)
944 .After(usesMockCurve); 944 .After(usesMockCurve);
945 945
946 // Go! 946 // Go!
947 setCompositorForTesting(mockCompositor); 947 setCompositorForTesting(mockCompositor);
948 Vector<OwnPtr<WebCompositorAnimation>> result; 948 Vector<OwnPtr<WebCompositorAnimation>> result;
949 getAnimationOnCompositor(m_timing, *effect.get(), result); 949 getAnimationOnCompositor(m_timing, *effect, result);
950 EXPECT_EQ(1U, result.size()); 950 EXPECT_EQ(1U, result.size());
951 result[0].clear(); 951 result[0].clear();
952 } 952 }
953 953
954 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative StartDelay) 954 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative StartDelay)
955 { 955 {
956 // KeyframeEffect to convert 956 // KeyframeEffect to convert
957 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 957 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
958 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 958 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
959 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 959 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
960 960
961 m_timing.iterationCount = 5.0; 961 m_timing.iterationCount = 5.0;
962 m_timing.iterationDuration = 1.5; 962 m_timing.iterationDuration = 1.5;
963 m_timing.startDelay = -3; 963 m_timing.startDelay = -3;
964 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; 964 m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
965 // -- 965 // --
966 966
967 WebCompositorSupportMock mockCompositor; 967 WebCompositorSupportMock mockCompositor;
(...skipping 22 matching lines...) Expand all
990 EXPECT_CALL(*mockAnimationPtr, delete_()) 990 EXPECT_CALL(*mockAnimationPtr, delete_())
991 .Times(1) 991 .Times(1)
992 .After(usesMockAnimation); 992 .After(usesMockAnimation);
993 EXPECT_CALL(*mockCurvePtr, delete_()) 993 EXPECT_CALL(*mockCurvePtr, delete_())
994 .Times(1) 994 .Times(1)
995 .After(usesMockCurve); 995 .After(usesMockCurve);
996 996
997 // Go! 997 // Go!
998 setCompositorForTesting(mockCompositor); 998 setCompositorForTesting(mockCompositor);
999 Vector<OwnPtr<WebCompositorAnimation>> result; 999 Vector<OwnPtr<WebCompositorAnimation>> result;
1000 getAnimationOnCompositor(m_timing, *effect.get(), result); 1000 getAnimationOnCompositor(m_timing, *effect, result);
1001 EXPECT_EQ(1U, result.size()); 1001 EXPECT_EQ(1U, result.size());
1002 result[0].clear(); 1002 result[0].clear();
1003 } 1003 }
1004 1004
1005 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationPlaybackRa tes) 1005 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationPlaybackRa tes)
1006 { 1006 {
1007 // KeyframeEffect to convert 1007 // KeyframeEffect to convert
1008 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 1008 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
1009 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 1009 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
1010 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 1010 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
1011 1011
1012 m_timing.playbackRate = 2; 1012 m_timing.playbackRate = 2;
1013 // -- 1013 // --
1014 1014
1015 WebCompositorSupportMock mockCompositor; 1015 WebCompositorSupportMock mockCompositor;
1016 1016
1017 // Curve is created 1017 // Curve is created
1018 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 1018 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
(...skipping 20 matching lines...) Expand all
1039 .Times(1) 1039 .Times(1)
1040 .After(usesMockAnimation); 1040 .After(usesMockAnimation);
1041 EXPECT_CALL(*mockCurvePtr, delete_()) 1041 EXPECT_CALL(*mockCurvePtr, delete_())
1042 .Times(1) 1042 .Times(1)
1043 .After(usesMockCurve); 1043 .After(usesMockCurve);
1044 1044
1045 // Go! 1045 // Go!
1046 setCompositorForTesting(mockCompositor); 1046 setCompositorForTesting(mockCompositor);
1047 Vector<OwnPtr<WebCompositorAnimation>> result; 1047 Vector<OwnPtr<WebCompositorAnimation>> result;
1048 // Set player plaback rate also 1048 // Set player plaback rate also
1049 getAnimationOnCompositor(m_timing, *effect.get(), result, -1.5); 1049 getAnimationOnCompositor(m_timing, *effect, result, -1.5);
1050 EXPECT_EQ(1U, result.size()); 1050 EXPECT_EQ(1U, result.size());
1051 result[0].clear(); 1051 result[0].clear();
1052 } 1052 }
1053 1053
1054 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeNo ne) 1054 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeNo ne)
1055 { 1055 {
1056 // KeyframeEffect to convert 1056 // KeyframeEffect to convert
1057 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 1057 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
1058 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 1058 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
1059 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 1059 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
1060 1060
1061 m_timing.fillMode = Timing::FillModeNone; 1061 m_timing.fillMode = Timing::FillModeNone;
1062 1062
1063 WebCompositorSupportMock mockCompositor; 1063 WebCompositorSupportMock mockCompositor;
1064 1064
1065 // Curve is created 1065 // Curve is created
1066 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 1066 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
1067 ExpectationSet usesMockCurve; 1067 ExpectationSet usesMockCurve;
(...skipping 19 matching lines...) Expand all
1087 EXPECT_CALL(*mockAnimationPtr, delete_()) 1087 EXPECT_CALL(*mockAnimationPtr, delete_())
1088 .Times(1) 1088 .Times(1)
1089 .After(usesMockAnimation); 1089 .After(usesMockAnimation);
1090 EXPECT_CALL(*mockCurvePtr, delete_()) 1090 EXPECT_CALL(*mockCurvePtr, delete_())
1091 .Times(1) 1091 .Times(1)
1092 .After(usesMockCurve); 1092 .After(usesMockCurve);
1093 1093
1094 // Go! 1094 // Go!
1095 setCompositorForTesting(mockCompositor); 1095 setCompositorForTesting(mockCompositor);
1096 Vector<OwnPtr<WebCompositorAnimation>> result; 1096 Vector<OwnPtr<WebCompositorAnimation>> result;
1097 getAnimationOnCompositor(m_timing, *effect.get(), result); 1097 getAnimationOnCompositor(m_timing, *effect, result);
1098 EXPECT_EQ(1U, result.size()); 1098 EXPECT_EQ(1U, result.size());
1099 result[0].clear(); 1099 result[0].clear();
1100 } 1100 }
1101 1101
1102 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeAu to) 1102 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeAu to)
1103 { 1103 {
1104 // KeyframeEffect to convert 1104 // KeyframeEffect to convert
1105 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 1105 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
1106 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 1106 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
1107 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 1107 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
1108 1108
1109 m_timing.fillMode = Timing::FillModeAuto; 1109 m_timing.fillMode = Timing::FillModeAuto;
1110 1110
1111 WebCompositorSupportMock mockCompositor; 1111 WebCompositorSupportMock mockCompositor;
1112 1112
1113 // Curve is created 1113 // Curve is created
1114 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 1114 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
1115 ExpectationSet usesMockCurve; 1115 ExpectationSet usesMockCurve;
(...skipping 19 matching lines...) Expand all
1135 EXPECT_CALL(*mockAnimationPtr, delete_()) 1135 EXPECT_CALL(*mockAnimationPtr, delete_())
1136 .Times(1) 1136 .Times(1)
1137 .After(usesMockAnimation); 1137 .After(usesMockAnimation);
1138 EXPECT_CALL(*mockCurvePtr, delete_()) 1138 EXPECT_CALL(*mockCurvePtr, delete_())
1139 .Times(1) 1139 .Times(1)
1140 .After(usesMockCurve); 1140 .After(usesMockCurve);
1141 1141
1142 // Go! 1142 // Go!
1143 setCompositorForTesting(mockCompositor); 1143 setCompositorForTesting(mockCompositor);
1144 Vector<OwnPtr<WebCompositorAnimation>> result; 1144 Vector<OwnPtr<WebCompositorAnimation>> result;
1145 getAnimationOnCompositor(m_timing, *effect.get(), result); 1145 getAnimationOnCompositor(m_timing, *effect, result);
1146 EXPECT_EQ(1U, result.size()); 1146 EXPECT_EQ(1U, result.size());
1147 result[0].clear(); 1147 result[0].clear();
1148 } 1148 }
1149 1149
1150 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationWithTiming Function) 1150 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationWithTiming Function)
1151 { 1151 {
1152 // KeyframeEffect to convert 1152 // KeyframeEffect to convert
1153 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 1153 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
1154 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 1154 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
1155 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 1155 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
1156 1156
1157 m_timing.timingFunction = m_cubicCustomTimingFunction; 1157 m_timing.timingFunction = m_cubicCustomTimingFunction;
1158 1158
1159 WebCompositorSupportMock mockCompositor; 1159 WebCompositorSupportMock mockCompositor;
1160 1160
1161 // Curve is created 1161 // Curve is created
1162 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 1162 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
1163 ExpectationSet usesMockCurve; 1163 ExpectationSet usesMockCurve;
(...skipping 19 matching lines...) Expand all
1183 EXPECT_CALL(*mockAnimationPtr, delete_()) 1183 EXPECT_CALL(*mockAnimationPtr, delete_())
1184 .Times(1) 1184 .Times(1)
1185 .After(usesMockAnimation); 1185 .After(usesMockAnimation);
1186 EXPECT_CALL(*mockCurvePtr, delete_()) 1186 EXPECT_CALL(*mockCurvePtr, delete_())
1187 .Times(1) 1187 .Times(1)
1188 .After(usesMockCurve); 1188 .After(usesMockCurve);
1189 1189
1190 // Go! 1190 // Go!
1191 setCompositorForTesting(mockCompositor); 1191 setCompositorForTesting(mockCompositor);
1192 Vector<OwnPtr<WebCompositorAnimation>> result; 1192 Vector<OwnPtr<WebCompositorAnimation>> result;
1193 getAnimationOnCompositor(m_timing, *effect.get(), result); 1193 getAnimationOnCompositor(m_timing, *effect, result);
1194 EXPECT_EQ(1U, result.size()); 1194 EXPECT_EQ(1U, result.size());
1195 result[0].clear(); 1195 result[0].clear();
1196 } 1196 }
1197 1197
1198 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations ) 1198 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations )
1199 { 1199 {
1200 WebCompositorSupportMock mockCompositor; 1200 WebCompositorSupportMock mockCompositor;
1201 setCompositorForTesting(mockCompositor); 1201 setCompositorForTesting(mockCompositor);
1202 1202
1203 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION); 1203 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION);
1204 1204
1205 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get()); 1205 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get());
1206 element->setLayoutObject(layoutObject); 1206 element->setLayoutObject(layoutObject);
1207 1207
1208 AnimatableValueKeyframeVector keyFrames; 1208 AnimatableValueKeyframeVector keyFrames;
1209 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 0.0).get()); 1209 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 0.0).get());
1210 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 1.0).get()); 1210 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 1.0).get());
1211 RefPtrWillBeRawPtr<EffectModel> animationEffect1 = AnimatableValueKeyframeEf fectModel::create(keyFrames); 1211 EffectModel* animationEffect1 = AnimatableValueKeyframeEffectModel::create(k eyFrames);
1212 RefPtrWillBeRawPtr<EffectModel> animationEffect2 = AnimatableValueKeyframeEf fectModel::create(keyFrames); 1212 EffectModel* animationEffect2 = AnimatableValueKeyframeEffectModel::create(k eyFrames);
1213 1213
1214 Timing timing; 1214 Timing timing;
1215 timing.iterationDuration = 1.f; 1215 timing.iterationDuration = 1.f;
1216 1216
1217 // The first animation for opacity is ok to run on compositor. 1217 // The first animation for opacity is ok to run on compositor.
1218 RefPtrWillBeRawPtr<KeyframeEffect> keyframeEffect1 = KeyframeEffect::create( element.get(), animationEffect1, timing); 1218 KeyframeEffect* keyframeEffect1 = KeyframeEffect::create(element.get(), anim ationEffect1, timing);
1219 RefPtrWillBePersistent<Animation> animation1 = m_timeline->play(keyframeEffe ct1.get()); 1219 Animation* animation1 = m_timeline->play(keyframeEffect1);
1220 EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForAnimationOnCompo sitor(timing, *element.get(), animation1.get(), *animationEffect1.get(), 1)); 1220 EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForAnimationOnCompo sitor(timing, *element.get(), animation1, *animationEffect1, 1));
1221 1221
1222 // simulate KeyframeEffect::maybeStartAnimationOnCompositor 1222 // simulate KeyframeEffect::maybeStartAnimationOnCompositor
1223 Vector<int> compositorAnimationIds; 1223 Vector<int> compositorAnimationIds;
1224 compositorAnimationIds.append(1); 1224 compositorAnimationIds.append(1);
1225 keyframeEffect1->setCompositorAnimationIdsForTesting(compositorAnimationIds) ; 1225 keyframeEffect1->setCompositorAnimationIdsForTesting(compositorAnimationIds) ;
1226 EXPECT_TRUE(animation1->hasActiveAnimationsOnCompositor()); 1226 EXPECT_TRUE(animation1->hasActiveAnimationsOnCompositor());
1227 1227
1228 // The second animation for opacity is not ok to run on compositor. 1228 // The second animation for opacity is not ok to run on compositor.
1229 RefPtrWillBeRawPtr<KeyframeEffect> keyframeEffect2 = KeyframeEffect::create( element.get(), animationEffect2, timing); 1229 KeyframeEffect* keyframeEffect2 = KeyframeEffect::create(element.get(), anim ationEffect2, timing);
1230 RefPtrWillBePersistent<Animation> animation2 = m_timeline->play(keyframeEffe ct2.get()); 1230 Animation* animation2 = m_timeline->play(keyframeEffect2);
1231 EXPECT_FALSE(CompositorAnimations::instance()->isCandidateForAnimationOnComp ositor(timing, *element.get(), animation2.get(), *animationEffect2.get(), 1)); 1231 EXPECT_FALSE(CompositorAnimations::instance()->isCandidateForAnimationOnComp ositor(timing, *element.get(), animation2, *animationEffect2, 1));
1232 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor()); 1232 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor());
1233 1233
1234 // A fallback to blink implementation needed, so cancel all compositor-side opacity animations for this element. 1234 // A fallback to blink implementation needed, so cancel all compositor-side opacity animations for this element.
1235 animation2->cancelIncompatibleAnimationsOnCompositor(); 1235 animation2->cancelIncompatibleAnimationsOnCompositor();
1236 1236
1237 EXPECT_FALSE(animation1->hasActiveAnimationsOnCompositor()); 1237 EXPECT_FALSE(animation1->hasActiveAnimationsOnCompositor());
1238 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor()); 1238 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor());
1239 1239
1240 simulateFrame(0); 1240 simulateFrame(0);
1241 EXPECT_EQ(2U, element->elementAnimations()->animations().size()); 1241 EXPECT_EQ(2U, element->elementAnimations()->animations().size());
1242 simulateFrame(1.); 1242 simulateFrame(1.);
1243 1243
1244 element->setLayoutObject(nullptr); 1244 element->setLayoutObject(nullptr);
1245 LayoutObjectProxy::dispose(layoutObject); 1245 LayoutObjectProxy::dispose(layoutObject);
1246 1246
1247 animation1.release();
1248 animation2.release();
1249 Heap::collectAllGarbage(); 1247 Heap::collectAllGarbage();
1250 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); 1248 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty());
1251 } 1249 }
1252 1250
1253 } // namespace blink 1251 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/AnimationTimelineTest.cpp ('k') | Source/core/animation/CompositorPendingAnimations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698