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

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

Issue 1406163006: Composited Animations Tests: Support compositorAnimationTimelinesEnabled mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/CompositorAnimationsTestHelper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; 78 CompositorAnimationsImpl::CompositorTiming m_compositorTiming;
79 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2; 79 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2;
80 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2; 80 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2;
81 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5; 81 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5;
82 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5; 82 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5;
83 83
84 RefPtrWillBePersistent<Document> m_document; 84 RefPtrWillBePersistent<Document> m_document;
85 RefPtrWillBePersistent<Element> m_element; 85 RefPtrWillBePersistent<Element> m_element;
86 Persistent<AnimationTimeline> m_timeline; 86 Persistent<AnimationTimeline> m_timeline;
87 OwnPtr<DummyPageHolder> m_pageHolder; 87 OwnPtr<DummyPageHolder> m_pageHolder;
88 WebCompositorSupportMock m_mockCompositor;
88 89
89 virtual void SetUp() 90 virtual void SetUp()
90 { 91 {
91 AnimationCompositorAnimationsTestBase::SetUp(); 92 AnimationCompositorAnimationsTestBase::SetUp();
93 setCompositorForTesting(m_mockCompositor);
92 94
93 m_linearTimingFunction = LinearTimingFunction::shared(); 95 m_linearTimingFunction = LinearTimingFunction::shared();
94 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::Ease); 96 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::Ease);
95 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3, 4); 97 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3, 4);
96 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio n::End); 98 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio n::End);
97 99
98 m_timing = createCompositableTiming(); 100 m_timing = createCompositableTiming();
99 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming(); 101 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming();
100 // Make sure the CompositableTiming is really compositable, otherwise 102 // Make sure the CompositableTiming is really compositable, otherwise
101 // most other tests will fail. 103 // most other tests will fail.
102 ASSERT(convertTimingForCompositor(m_timing, m_compositorTiming)); 104 ASSERT(convertTimingForCompositor(m_timing, m_compositorTiming));
103 105
104 m_keyframeVector2 = createCompositableFloatKeyframeVector(2); 106 m_keyframeVector2 = createCompositableFloatKeyframeVector(2);
105 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector2); 107 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector2);
106 108
107 m_keyframeVector5 = createCompositableFloatKeyframeVector(5); 109 m_keyframeVector5 = createCompositableFloatKeyframeVector(5);
108 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector5); 110 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector5);
109 111
112 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
113 EXPECT_CALL(m_mockCompositor, createAnimationTimeline())
114 .WillOnce(Return(new WebCompositorAnimationTimelineMock()));
115 }
110 m_pageHolder = DummyPageHolder::create(); 116 m_pageHolder = DummyPageHolder::create();
111 m_document = &m_pageHolder->document(); 117 m_document = &m_pageHolder->document();
112 m_document->animationClock().resetTimeForTesting(); 118 m_document->animationClock().resetTimeForTesting();
119
120 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
121 EXPECT_CALL(m_mockCompositor, createAnimationTimeline())
122 .WillOnce(Return(new WebCompositorAnimationTimelineMock()));
123 }
113 m_timeline = AnimationTimeline::create(m_document.get()); 124 m_timeline = AnimationTimeline::create(m_document.get());
114 m_timeline->resetForTesting(); 125 m_timeline->resetForTesting();
115 m_element = m_document->createElement("test", ASSERT_NO_EXCEPTION); 126 m_element = m_document->createElement("test", ASSERT_NO_EXCEPTION);
116 } 127 }
117 128
118 public: 129 public:
119 130
120 bool convertTimingForCompositor(const Timing& t, CompositorAnimationsImpl::C ompositorTiming& out) 131 bool convertTimingForCompositor(const Timing& t, CompositorAnimationsImpl::C ompositorTiming& out)
121 { 132 {
122 return CompositorAnimationsImpl::convertTimingForCompositor(t, 0, out, 1 ); 133 return CompositorAnimationsImpl::convertTimingForCompositor(t, 0, out, 1 );
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 // ----------------------------------------------------------------------- 647 // -----------------------------------------------------------------------
637 648
638 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation) 649 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimation)
639 { 650 {
640 // KeyframeEffect to convert 651 // KeyframeEffect to convert
641 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 652 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
642 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 653 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
643 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 654 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
644 // -- 655 // --
645 656
646 WebCompositorSupportMock mockCompositor;
647
648 // Curve is created 657 // Curve is created
649 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 658 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
650 ExpectationSet usesMockCurve; 659 ExpectationSet usesMockCurve;
651 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 660 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve())
652 .WillOnce(Return(mockCurvePtr)); 661 .WillOnce(Return(mockCurvePtr));
653 662
654 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 663 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear));
655 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ; 664 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ;
656 665
657 // Create animation 666 // Create animation
658 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity); 667 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity);
659 ExpectationSet usesMockAnimation; 668 ExpectationSet usesMockAnimation;
660 669
661 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), WebCompositorAnimation::TargetPropertyOpacity, _, _)) 670 usesMockCurve += EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurv ePtr), WebCompositorAnimation::TargetPropertyOpacity, _, _))
662 .WillOnce(Return(mockAnimationPtr)); 671 .WillOnce(Return(mockAnimationPtr));
663 672
664 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1)); 673 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
665 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 674 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
666 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal)); 675 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal));
667 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1)); 676 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1));
668 677
669 EXPECT_CALL(*mockAnimationPtr, delete_()) 678 EXPECT_CALL(*mockAnimationPtr, delete_())
670 .Times(1) 679 .Times(1)
671 .After(usesMockAnimation); 680 .After(usesMockAnimation);
672 EXPECT_CALL(*mockCurvePtr, delete_()) 681 EXPECT_CALL(*mockCurvePtr, delete_())
673 .Times(1) 682 .Times(1)
674 .After(usesMockCurve); 683 .After(usesMockCurve);
675 684
676 // Go! 685 // Go!
677 setCompositorForTesting(mockCompositor);
678 Vector<OwnPtr<WebCompositorAnimation>> result; 686 Vector<OwnPtr<WebCompositorAnimation>> result;
679 getAnimationOnCompositor(m_timing, *effect, result); 687 getAnimationOnCompositor(m_timing, *effect, result);
680 EXPECT_EQ(1U, result.size()); 688 EXPECT_EQ(1U, result.size());
681 result[0].clear(); 689 result[0].clear();
682 } 690 }
683 691
684 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration) 692 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration)
685 { 693 {
686 // KeyframeEffect to convert 694 // KeyframeEffect to convert
687 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 695 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
688 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 696 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
689 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 697 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
690 698
691 m_timing.iterationDuration = 10.0; 699 m_timing.iterationDuration = 10.0;
692 // -- 700 // --
693 701
694 WebCompositorSupportMock mockCompositor;
695
696 // Curve is created 702 // Curve is created
697 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 703 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
698 ExpectationSet usesMockCurve; 704 ExpectationSet usesMockCurve;
699 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 705 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve())
700 .WillOnce(Return(mockCurvePtr)); 706 .WillOnce(Return(mockCurvePtr));
701 707
702 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 708 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear));
703 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(10.0, 5.0)) ); 709 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(10.0, 5.0)) );
704 710
705 // Create animation 711 // Create animation
706 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity); 712 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity);
707 ExpectationSet usesMockAnimation; 713 ExpectationSet usesMockAnimation;
708 714
709 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), WebCompositorAnimation::TargetPropertyOpacity, _, _)) 715 usesMockCurve += EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurv ePtr), WebCompositorAnimation::TargetPropertyOpacity, _, _))
710 .WillOnce(Return(mockAnimationPtr)); 716 .WillOnce(Return(mockAnimationPtr));
711 717
712 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1)); 718 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
713 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 719 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
714 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal)); 720 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal));
715 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1)); 721 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1));
716 722
717 EXPECT_CALL(*mockAnimationPtr, delete_()) 723 EXPECT_CALL(*mockAnimationPtr, delete_())
718 .Times(1) 724 .Times(1)
719 .After(usesMockAnimation); 725 .After(usesMockAnimation);
720 EXPECT_CALL(*mockCurvePtr, delete_()) 726 EXPECT_CALL(*mockCurvePtr, delete_())
721 .Times(1) 727 .Times(1)
722 .After(usesMockCurve); 728 .After(usesMockCurve);
723 729
724 // Go! 730 // Go!
725 setCompositorForTesting(mockCompositor);
726 Vector<OwnPtr<WebCompositorAnimation>> result; 731 Vector<OwnPtr<WebCompositorAnimation>> result;
727 getAnimationOnCompositor(m_timing, *effect, result); 732 getAnimationOnCompositor(m_timing, *effect, result);
728 EXPECT_EQ(1U, result.size()); 733 EXPECT_EQ(1U, result.size());
729 result[0].clear(); 734 result[0].clear();
730 } 735 }
731 736
732 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Linear) 737 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Linear)
733 { 738 {
734 // KeyframeEffect to convert 739 // KeyframeEffect to convert
735 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 740 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
736 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 741 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
737 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1. 0).get(), 0.25), 742 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1. 0).get(), 0.25),
738 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20. 0).get(), 0.5), 743 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20. 0).get(), 0.5),
739 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 744 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
740 745
741 m_timing.iterationCount = 5; 746 m_timing.iterationCount = 5;
742 m_timing.direction = Timing::PlaybackDirectionAlternate; 747 m_timing.direction = Timing::PlaybackDirectionAlternate;
743 m_timing.playbackRate = 2.0; 748 m_timing.playbackRate = 2.0;
744 // -- 749 // --
745 750
746 WebCompositorSupportMock mockCompositor;
747
748 // Curve is created 751 // Curve is created
749 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock(); 752 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock();
750 ExpectationSet usesMockCurve; 753 ExpectationSet usesMockCurve;
751 754
752 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 755 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve())
753 .WillOnce(Return(mockCurvePtr)); 756 .WillOnce(Return(mockCurvePtr));
754 757
755 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 758 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear));
756 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.25, -1.0) , WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 759 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.25, -1.0) , WebCompositorAnimationCurve::TimingFunctionTypeLinear));
757 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.5, 20.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 760 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.5, 20.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear));
758 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ; 761 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ;
759 762
760 // KeyframeEffect is created 763 // KeyframeEffect is created
761 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity); 764 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity);
762 ExpectationSet usesMockAnimation; 765 ExpectationSet usesMockAnimation;
763 766
764 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), WebCompositorAnimation::TargetPropertyOpacity, _, _)) 767 usesMockCurve += EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurv ePtr), WebCompositorAnimation::TargetPropertyOpacity, _, _))
765 .WillOnce(Return(mockAnimationPtr)); 768 .WillOnce(Return(mockAnimationPtr));
766 769
767 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5)); 770 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
768 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 771 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
769 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionAlternate)); 772 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionAlternate));
770 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(2.0)); 773 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(2.0));
771 774
772 EXPECT_CALL(*mockAnimationPtr, delete_()) 775 EXPECT_CALL(*mockAnimationPtr, delete_())
773 .Times(1) 776 .Times(1)
774 .After(usesMockAnimation); 777 .After(usesMockAnimation);
775 EXPECT_CALL(*mockCurvePtr, delete_()) 778 EXPECT_CALL(*mockCurvePtr, delete_())
776 .Times(1) 779 .Times(1)
777 .After(usesMockCurve); 780 .After(usesMockCurve);
778 781
779 // Go! 782 // Go!
780 setCompositorForTesting(mockCompositor);
781 Vector<OwnPtr<WebCompositorAnimation>> result; 783 Vector<OwnPtr<WebCompositorAnimation>> result;
782 getAnimationOnCompositor(m_timing, *effect, result); 784 getAnimationOnCompositor(m_timing, *effect, result);
783 EXPECT_EQ(1U, result.size()); 785 EXPECT_EQ(1U, result.size());
784 result[0].clear(); 786 result[0].clear();
785 } 787 }
786 788
787 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationStartDelay ) 789 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationStartDelay )
788 { 790 {
789 // KeyframeEffect to convert 791 // KeyframeEffect to convert
790 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 792 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
791 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 793 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
792 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 794 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
793 795
794 m_timing.iterationCount = 5.0; 796 m_timing.iterationCount = 5.0;
795 m_timing.iterationDuration = 1.75; 797 m_timing.iterationDuration = 1.75;
796 m_timing.startDelay = 3.25; 798 m_timing.startDelay = 3.25;
797 // -- 799 // --
798 800
799 WebCompositorSupportMock mockCompositor;
800
801 // Curve is created 801 // Curve is created
802 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 802 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
803 ExpectationSet usesMockCurve; 803 ExpectationSet usesMockCurve;
804 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 804 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve())
805 .WillOnce(Return(mockCurvePtr)); 805 .WillOnce(Return(mockCurvePtr));
806 806
807 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 807 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear));
808 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.75, 5.0)) ); 808 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.75, 5.0)) );
809 809
810 // Create animation 810 // Create animation
811 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity); 811 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity);
812 ExpectationSet usesMockAnimation; 812 ExpectationSet usesMockAnimation;
813 813
814 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), WebCompositorAnimation::TargetPropertyOpacity, _, _)) 814 usesMockCurve += EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurv ePtr), WebCompositorAnimation::TargetPropertyOpacity, _, _))
815 .WillOnce(Return(mockAnimationPtr)); 815 .WillOnce(Return(mockAnimationPtr));
816 816
817 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5)); 817 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
818 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(-3.25)); 818 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(-3.25));
819 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal)); 819 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal));
820 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1)); 820 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1));
821 821
822 EXPECT_CALL(*mockAnimationPtr, delete_()) 822 EXPECT_CALL(*mockAnimationPtr, delete_())
823 .Times(1) 823 .Times(1)
824 .After(usesMockAnimation); 824 .After(usesMockAnimation);
825 EXPECT_CALL(*mockCurvePtr, delete_()) 825 EXPECT_CALL(*mockCurvePtr, delete_())
826 .Times(1) 826 .Times(1)
827 .After(usesMockCurve); 827 .After(usesMockCurve);
828 828
829 // Go! 829 // Go!
830 setCompositorForTesting(mockCompositor);
831 Vector<OwnPtr<WebCompositorAnimation>> result; 830 Vector<OwnPtr<WebCompositorAnimation>> result;
832 getAnimationOnCompositor(m_timing, *effect, result); 831 getAnimationOnCompositor(m_timing, *effect, result);
833 EXPECT_EQ(1U, result.size()); 832 EXPECT_EQ(1U, result.size());
834 result[0].clear(); 833 result[0].clear();
835 } 834 }
836 835
837 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Chained) 836 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Chained)
838 { 837 {
839 // KeyframeEffect to convert 838 // KeyframeEffect to convert
840 AnimatableValueKeyframeVector frames; 839 AnimatableValueKeyframeVector frames;
841 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(2.0).get(), 0)); 840 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(2.0).get(), 0));
842 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(-1.0).get(), 0.25)); 841 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(-1.0).get(), 0.25));
843 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(20.0).get(), 0.5)); 842 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(20.0).get(), 0.5));
844 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(5.0).get(), 1.0)); 843 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(5.0).get(), 1.0));
845 frames[0]->setEasing(m_cubicEaseTimingFunction.get()); 844 frames[0]->setEasing(m_cubicEaseTimingFunction.get());
846 frames[1]->setEasing(m_linearTimingFunction.get()); 845 frames[1]->setEasing(m_linearTimingFunction.get());
847 frames[2]->setEasing(m_cubicCustomTimingFunction.get()); 846 frames[2]->setEasing(m_cubicCustomTimingFunction.get());
848 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(frames); 847 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(frames);
849 848
850 m_timing.timingFunction = m_linearTimingFunction.get(); 849 m_timing.timingFunction = m_linearTimingFunction.get();
851 m_timing.iterationDuration = 2.0; 850 m_timing.iterationDuration = 2.0;
852 m_timing.iterationCount = 10; 851 m_timing.iterationCount = 10;
853 m_timing.direction = Timing::PlaybackDirectionAlternate; 852 m_timing.direction = Timing::PlaybackDirectionAlternate;
854 // -- 853 // --
855 854
856 WebCompositorSupportMock mockCompositor;
857
858 // Curve is created 855 // Curve is created
859 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock(); 856 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock();
860 ExpectationSet usesMockCurve; 857 ExpectationSet usesMockCurve;
861 858
862 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 859 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve())
863 .WillOnce(Return(mockCurvePtr)); 860 .WillOnce(Return(mockCurvePtr));
864 861
865 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeEase)); 862 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeEase));
866 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.5, -1.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 863 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.5, -1.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear));
867 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 20.0), 1.0, 2.0, 3.0, 4.0)); 864 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 20.0), 1.0, 2.0, 3.0, 4.0));
868 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(2.0, 5.0))) ; 865 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(2.0, 5.0))) ;
869 866
870 // KeyframeEffect is created 867 // KeyframeEffect is created
871 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity); 868 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity);
872 ExpectationSet usesMockAnimation; 869 ExpectationSet usesMockAnimation;
873 870
874 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), WebCompositorAnimation::TargetPropertyOpacity, _, _)) 871 usesMockCurve += EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurv ePtr), WebCompositorAnimation::TargetPropertyOpacity, _, _))
875 .WillOnce(Return(mockAnimationPtr)); 872 .WillOnce(Return(mockAnimationPtr));
876 873
877 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10)); 874 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10));
878 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 875 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
879 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionAlternate)); 876 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionAlternate));
880 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1)); 877 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1));
881 878
882 EXPECT_CALL(*mockAnimationPtr, delete_()) 879 EXPECT_CALL(*mockAnimationPtr, delete_())
883 .Times(1) 880 .Times(1)
884 .After(usesMockAnimation); 881 .After(usesMockAnimation);
885 EXPECT_CALL(*mockCurvePtr, delete_()) 882 EXPECT_CALL(*mockCurvePtr, delete_())
886 .Times(1) 883 .Times(1)
887 .After(usesMockCurve); 884 .After(usesMockCurve);
888 885
889 // Go! 886 // Go!
890 setCompositorForTesting(mockCompositor);
891 Vector<OwnPtr<WebCompositorAnimation>> result; 887 Vector<OwnPtr<WebCompositorAnimation>> result;
892 getAnimationOnCompositor(m_timing, *effect, result); 888 getAnimationOnCompositor(m_timing, *effect, result);
893 EXPECT_EQ(1U, result.size()); 889 EXPECT_EQ(1U, result.size());
894 result[0].clear(); 890 result[0].clear();
895 } 891 }
896 892
897 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation) 893 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation)
898 { 894 {
899 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);
900 896
901 // KeyframeEffect to convert 897 // KeyframeEffect to convert
902 AnimatableValueKeyframeVector frames; 898 AnimatableValueKeyframeVector frames;
903 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(2.0).get(), 0)); 899 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(2.0).get(), 0));
904 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(-1.0).get(), 0.25)); 900 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(-1.0).get(), 0.25));
905 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(20.0).get(), 0.5)); 901 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(20.0).get(), 0.5));
906 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(5.0).get(), 1.0)); 902 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(5.0).get(), 1.0));
907 frames[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingFunc tion::EaseIn)); 903 frames[0]->setEasing(CubicBezierTimingFunction::preset(CubicBezierTimingFunc tion::EaseIn));
908 frames[1]->setEasing(m_linearTimingFunction.get()); 904 frames[1]->setEasing(m_linearTimingFunction.get());
909 frames[2]->setEasing(cubicEasyFlipTimingFunction.get()); 905 frames[2]->setEasing(cubicEasyFlipTimingFunction.get());
910 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(frames); 906 AnimatableValueKeyframeEffectModel* effect = AnimatableValueKeyframeEffectMo del::create(frames);
911 907
912 m_timing.timingFunction = m_linearTimingFunction.get(); 908 m_timing.timingFunction = m_linearTimingFunction.get();
913 m_timing.iterationCount = 10; 909 m_timing.iterationCount = 10;
914 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; 910 m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
915 // -- 911 // --
916 912
917 WebCompositorSupportMock mockCompositor;
918
919 // Curve is created 913 // Curve is created
920 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock(); 914 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock();
921 ExpectationSet usesMockCurve; 915 ExpectationSet usesMockCurve;
922 916
923 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 917 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve())
924 .WillOnce(Return(mockCurvePtr)); 918 .WillOnce(Return(mockCurvePtr));
925 919
926 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeEaseIn)); 920 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeEaseIn));
927 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.25, -1.0) , WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 921 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.25, -1.0) , WebCompositorAnimationCurve::TimingFunctionTypeLinear));
928 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.5, 20.0), 0.0, 0.0, 0.0, 1.0)); 922 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.5, 20.0), 0.0, 0.0, 0.0, 1.0));
929 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ; 923 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ;
930 924
931 // Create the animation 925 // Create the animation
932 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity); 926 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity);
933 ExpectationSet usesMockAnimation; 927 ExpectationSet usesMockAnimation;
934 928
935 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), WebCompositorAnimation::TargetPropertyOpacity, _, _)) 929 usesMockCurve += EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurv ePtr), WebCompositorAnimation::TargetPropertyOpacity, _, _))
936 .WillOnce(Return(mockAnimationPtr)); 930 .WillOnce(Return(mockAnimationPtr));
937 931
938 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10)); 932 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10));
939 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 933 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
940 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionAlternateReverse)); 934 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionAlternateReverse));
941 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1)); 935 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1));
942 936
943 EXPECT_CALL(*mockAnimationPtr, delete_()) 937 EXPECT_CALL(*mockAnimationPtr, delete_())
944 .Times(1) 938 .Times(1)
945 .After(usesMockAnimation); 939 .After(usesMockAnimation);
946 EXPECT_CALL(*mockCurvePtr, delete_()) 940 EXPECT_CALL(*mockCurvePtr, delete_())
947 .Times(1) 941 .Times(1)
948 .After(usesMockCurve); 942 .After(usesMockCurve);
949 943
950 // Go! 944 // Go!
951 setCompositorForTesting(mockCompositor);
952 Vector<OwnPtr<WebCompositorAnimation>> result; 945 Vector<OwnPtr<WebCompositorAnimation>> result;
953 getAnimationOnCompositor(m_timing, *effect, result); 946 getAnimationOnCompositor(m_timing, *effect, result);
954 EXPECT_EQ(1U, result.size()); 947 EXPECT_EQ(1U, result.size());
955 result[0].clear(); 948 result[0].clear();
956 } 949 }
957 950
958 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative StartDelay) 951 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative StartDelay)
959 { 952 {
960 // KeyframeEffect to convert 953 // KeyframeEffect to convert
961 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 954 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
962 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 955 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
963 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 956 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
964 957
965 m_timing.iterationCount = 5.0; 958 m_timing.iterationCount = 5.0;
966 m_timing.iterationDuration = 1.5; 959 m_timing.iterationDuration = 1.5;
967 m_timing.startDelay = -3; 960 m_timing.startDelay = -3;
968 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; 961 m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
969 // -- 962 // --
970 963
971 WebCompositorSupportMock mockCompositor;
972
973 // Curve is created 964 // Curve is created
974 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 965 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
975 ExpectationSet usesMockCurve; 966 ExpectationSet usesMockCurve;
976 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 967 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve())
977 .WillOnce(Return(mockCurvePtr)); 968 .WillOnce(Return(mockCurvePtr));
978 969
979 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 970 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear));
980 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.5, 5.0))) ; 971 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.5, 5.0))) ;
981 972
982 // Create animation 973 // Create animation
983 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity); 974 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity);
984 ExpectationSet usesMockAnimation; 975 ExpectationSet usesMockAnimation;
985 976
986 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), WebCompositorAnimation::TargetPropertyOpacity, _, _)) 977 usesMockCurve += EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurv ePtr), WebCompositorAnimation::TargetPropertyOpacity, _, _))
987 .WillOnce(Return(mockAnimationPtr)); 978 .WillOnce(Return(mockAnimationPtr));
988 979
989 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5)); 980 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
990 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(3.0)); 981 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(3.0));
991 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionAlternateReverse)); 982 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionAlternateReverse));
992 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1)); 983 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1));
993 984
994 EXPECT_CALL(*mockAnimationPtr, delete_()) 985 EXPECT_CALL(*mockAnimationPtr, delete_())
995 .Times(1) 986 .Times(1)
996 .After(usesMockAnimation); 987 .After(usesMockAnimation);
997 EXPECT_CALL(*mockCurvePtr, delete_()) 988 EXPECT_CALL(*mockCurvePtr, delete_())
998 .Times(1) 989 .Times(1)
999 .After(usesMockCurve); 990 .After(usesMockCurve);
1000 991
1001 // Go! 992 // Go!
1002 setCompositorForTesting(mockCompositor);
1003 Vector<OwnPtr<WebCompositorAnimation>> result; 993 Vector<OwnPtr<WebCompositorAnimation>> result;
1004 getAnimationOnCompositor(m_timing, *effect, result); 994 getAnimationOnCompositor(m_timing, *effect, result);
1005 EXPECT_EQ(1U, result.size()); 995 EXPECT_EQ(1U, result.size());
1006 result[0].clear(); 996 result[0].clear();
1007 } 997 }
1008 998
1009 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationPlaybackRa tes) 999 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationPlaybackRa tes)
1010 { 1000 {
1011 // KeyframeEffect to convert 1001 // KeyframeEffect to convert
1012 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 1002 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
1013 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 1003 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
1014 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 1004 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
1015 1005
1016 m_timing.playbackRate = 2; 1006 m_timing.playbackRate = 2;
1017 // -- 1007 // --
1018 1008
1019 WebCompositorSupportMock mockCompositor;
1020
1021 // Curve is created 1009 // Curve is created
1022 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 1010 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
1023 ExpectationSet usesMockCurve; 1011 ExpectationSet usesMockCurve;
1024 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 1012 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve())
1025 .WillOnce(Return(mockCurvePtr)); 1013 .WillOnce(Return(mockCurvePtr));
1026 1014
1027 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 1015 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear));
1028 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ; 1016 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ;
1029 1017
1030 // Create animation 1018 // Create animation
1031 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity); 1019 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity);
1032 ExpectationSet usesMockAnimation; 1020 ExpectationSet usesMockAnimation;
1033 1021
1034 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), WebCompositorAnimation::TargetPropertyOpacity, _, _)) 1022 usesMockCurve += EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurv ePtr), WebCompositorAnimation::TargetPropertyOpacity, _, _))
1035 .WillOnce(Return(mockAnimationPtr)); 1023 .WillOnce(Return(mockAnimationPtr));
1036 1024
1037 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1)); 1025 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
1038 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 1026 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
1039 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal)); 1027 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal));
1040 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(-3)); 1028 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(-3));
1041 1029
1042 EXPECT_CALL(*mockAnimationPtr, delete_()) 1030 EXPECT_CALL(*mockAnimationPtr, delete_())
1043 .Times(1) 1031 .Times(1)
1044 .After(usesMockAnimation); 1032 .After(usesMockAnimation);
1045 EXPECT_CALL(*mockCurvePtr, delete_()) 1033 EXPECT_CALL(*mockCurvePtr, delete_())
1046 .Times(1) 1034 .Times(1)
1047 .After(usesMockCurve); 1035 .After(usesMockCurve);
1048 1036
1049 // Go! 1037 // Go!
1050 setCompositorForTesting(mockCompositor);
1051 Vector<OwnPtr<WebCompositorAnimation>> result; 1038 Vector<OwnPtr<WebCompositorAnimation>> result;
1052 // Set player plaback rate also 1039 // Set player plaback rate also
1053 getAnimationOnCompositor(m_timing, *effect, result, -1.5); 1040 getAnimationOnCompositor(m_timing, *effect, result, -1.5);
1054 EXPECT_EQ(1U, result.size()); 1041 EXPECT_EQ(1U, result.size());
1055 result[0].clear(); 1042 result[0].clear();
1056 } 1043 }
1057 1044
1058 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeNo ne) 1045 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeNo ne)
1059 { 1046 {
1060 // KeyframeEffect to convert 1047 // KeyframeEffect to convert
1061 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 1048 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
1062 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 1049 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
1063 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 1050 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
1064 1051
1065 m_timing.fillMode = Timing::FillModeNone; 1052 m_timing.fillMode = Timing::FillModeNone;
1066 1053
1067 WebCompositorSupportMock mockCompositor;
1068
1069 // Curve is created 1054 // Curve is created
1070 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 1055 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
1071 ExpectationSet usesMockCurve; 1056 ExpectationSet usesMockCurve;
1072 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 1057 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve())
1073 .WillOnce(Return(mockCurvePtr)); 1058 .WillOnce(Return(mockCurvePtr));
1074 1059
1075 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 1060 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear));
1076 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ; 1061 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ;
1077 1062
1078 // Create animation 1063 // Create animation
1079 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity); 1064 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity);
1080 ExpectationSet usesMockAnimation; 1065 ExpectationSet usesMockAnimation;
1081 1066
1082 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), WebCompositorAnimation::TargetPropertyOpacity, _, _)) 1067 usesMockCurve += EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurv ePtr), WebCompositorAnimation::TargetPropertyOpacity, _, _))
1083 .WillOnce(Return(mockAnimationPtr)); 1068 .WillOnce(Return(mockAnimationPtr));
1084 1069
1085 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1)); 1070 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
1086 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 1071 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
1087 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal)); 1072 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal));
1088 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1)); 1073 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1));
1089 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setFillMode(WebComposito rAnimation::FillModeNone)); 1074 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setFillMode(WebComposito rAnimation::FillModeNone));
1090 1075
1091 EXPECT_CALL(*mockAnimationPtr, delete_()) 1076 EXPECT_CALL(*mockAnimationPtr, delete_())
1092 .Times(1) 1077 .Times(1)
1093 .After(usesMockAnimation); 1078 .After(usesMockAnimation);
1094 EXPECT_CALL(*mockCurvePtr, delete_()) 1079 EXPECT_CALL(*mockCurvePtr, delete_())
1095 .Times(1) 1080 .Times(1)
1096 .After(usesMockCurve); 1081 .After(usesMockCurve);
1097 1082
1098 // Go! 1083 // Go!
1099 setCompositorForTesting(mockCompositor);
1100 Vector<OwnPtr<WebCompositorAnimation>> result; 1084 Vector<OwnPtr<WebCompositorAnimation>> result;
1101 getAnimationOnCompositor(m_timing, *effect, result); 1085 getAnimationOnCompositor(m_timing, *effect, result);
1102 EXPECT_EQ(1U, result.size()); 1086 EXPECT_EQ(1U, result.size());
1103 result[0].clear(); 1087 result[0].clear();
1104 } 1088 }
1105 1089
1106 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeAu to) 1090 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationFillModeAu to)
1107 { 1091 {
1108 // KeyframeEffect to convert 1092 // KeyframeEffect to convert
1109 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 1093 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
1110 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 1094 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
1111 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 1095 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
1112 1096
1113 m_timing.fillMode = Timing::FillModeAuto; 1097 m_timing.fillMode = Timing::FillModeAuto;
1114 1098
1115 WebCompositorSupportMock mockCompositor;
1116
1117 // Curve is created 1099 // Curve is created
1118 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 1100 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
1119 ExpectationSet usesMockCurve; 1101 ExpectationSet usesMockCurve;
1120 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 1102 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve())
1121 .WillOnce(Return(mockCurvePtr)); 1103 .WillOnce(Return(mockCurvePtr));
1122 1104
1123 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 1105 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear));
1124 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ; 1106 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ;
1125 1107
1126 // Create animation 1108 // Create animation
1127 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity); 1109 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity);
1128 ExpectationSet usesMockAnimation; 1110 ExpectationSet usesMockAnimation;
1129 1111
1130 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), WebCompositorAnimation::TargetPropertyOpacity, _, _)) 1112 usesMockCurve += EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurv ePtr), WebCompositorAnimation::TargetPropertyOpacity, _, _))
1131 .WillOnce(Return(mockAnimationPtr)); 1113 .WillOnce(Return(mockAnimationPtr));
1132 1114
1133 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1)); 1115 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
1134 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 1116 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
1135 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal)); 1117 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal));
1136 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1)); 1118 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1));
1137 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setFillMode(WebComposito rAnimation::FillModeNone)); 1119 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setFillMode(WebComposito rAnimation::FillModeNone));
1138 1120
1139 EXPECT_CALL(*mockAnimationPtr, delete_()) 1121 EXPECT_CALL(*mockAnimationPtr, delete_())
1140 .Times(1) 1122 .Times(1)
1141 .After(usesMockAnimation); 1123 .After(usesMockAnimation);
1142 EXPECT_CALL(*mockCurvePtr, delete_()) 1124 EXPECT_CALL(*mockCurvePtr, delete_())
1143 .Times(1) 1125 .Times(1)
1144 .After(usesMockCurve); 1126 .After(usesMockCurve);
1145 1127
1146 // Go! 1128 // Go!
1147 setCompositorForTesting(mockCompositor);
1148 Vector<OwnPtr<WebCompositorAnimation>> result; 1129 Vector<OwnPtr<WebCompositorAnimation>> result;
1149 getAnimationOnCompositor(m_timing, *effect, result); 1130 getAnimationOnCompositor(m_timing, *effect, result);
1150 EXPECT_EQ(1U, result.size()); 1131 EXPECT_EQ(1U, result.size());
1151 result[0].clear(); 1132 result[0].clear();
1152 } 1133 }
1153 1134
1154 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationWithTiming Function) 1135 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationWithTiming Function)
1155 { 1136 {
1156 // KeyframeEffect to convert 1137 // KeyframeEffect to convert
1157 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel( 1138 AnimatableValueKeyframeEffectModel* effect = createKeyframeEffectModel(
1158 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 1139 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
1159 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 1140 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
1160 1141
1161 m_timing.timingFunction = m_cubicCustomTimingFunction; 1142 m_timing.timingFunction = m_cubicCustomTimingFunction;
1162 1143
1163 WebCompositorSupportMock mockCompositor;
1164
1165 // Curve is created 1144 // Curve is created
1166 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock; 1145 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
1167 ExpectationSet usesMockCurve; 1146 ExpectationSet usesMockCurve;
1168 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 1147 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve())
1169 .WillOnce(Return(mockCurvePtr)); 1148 .WillOnce(Return(mockCurvePtr));
1170 1149
1171 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear)); 1150 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear));
1172 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ; 1151 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ;
1173 usesMockCurve += EXPECT_CALL(*mockCurvePtr, setCubicBezierTimingFunction(1, 2, 3, 4)); 1152 usesMockCurve += EXPECT_CALL(*mockCurvePtr, setCubicBezierTimingFunction(1, 2, 3, 4));
1174 1153
1175 // Create animation 1154 // Create animation
1176 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity); 1155 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity);
1177 ExpectationSet usesMockAnimation; 1156 ExpectationSet usesMockAnimation;
1178 1157
1179 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), WebCompositorAnimation::TargetPropertyOpacity, _, _)) 1158 usesMockCurve += EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurv ePtr), WebCompositorAnimation::TargetPropertyOpacity, _, _))
1180 .WillOnce(Return(mockAnimationPtr)); 1159 .WillOnce(Return(mockAnimationPtr));
1181 1160
1182 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1)); 1161 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
1183 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 1162 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
1184 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal)); 1163 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(WebComposit orAnimation::DirectionNormal));
1185 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1)); 1164 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1));
1186 1165
1187 EXPECT_CALL(*mockAnimationPtr, delete_()) 1166 EXPECT_CALL(*mockAnimationPtr, delete_())
1188 .Times(1) 1167 .Times(1)
1189 .After(usesMockAnimation); 1168 .After(usesMockAnimation);
1190 EXPECT_CALL(*mockCurvePtr, delete_()) 1169 EXPECT_CALL(*mockCurvePtr, delete_())
1191 .Times(1) 1170 .Times(1)
1192 .After(usesMockCurve); 1171 .After(usesMockCurve);
1193 1172
1194 // Go! 1173 // Go!
1195 setCompositorForTesting(mockCompositor);
1196 Vector<OwnPtr<WebCompositorAnimation>> result; 1174 Vector<OwnPtr<WebCompositorAnimation>> result;
1197 getAnimationOnCompositor(m_timing, *effect, result); 1175 getAnimationOnCompositor(m_timing, *effect, result);
1198 EXPECT_EQ(1U, result.size()); 1176 EXPECT_EQ(1U, result.size());
1199 result[0].clear(); 1177 result[0].clear();
1200 } 1178 }
1201 1179
1202 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations ) 1180 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations )
1203 { 1181 {
1204 WebCompositorSupportMock mockCompositor;
1205 setCompositorForTesting(mockCompositor);
1206
1207 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION); 1182 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION);
1208 1183
1209 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get()); 1184 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get());
1210 element->setLayoutObject(layoutObject); 1185 element->setLayoutObject(layoutObject);
1211 1186
1212 AnimatableValueKeyframeVector keyFrames; 1187 AnimatableValueKeyframeVector keyFrames;
1213 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 0.0).get()); 1188 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 0.0).get());
1214 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 1.0).get()); 1189 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 1.0).get());
1215 EffectModel* animationEffect1 = AnimatableValueKeyframeEffectModel::create(k eyFrames); 1190 EffectModel* animationEffect1 = AnimatableValueKeyframeEffectModel::create(k eyFrames);
1216 EffectModel* animationEffect2 = AnimatableValueKeyframeEffectModel::create(k eyFrames); 1191 EffectModel* animationEffect2 = AnimatableValueKeyframeEffectModel::create(k eyFrames);
(...skipping 29 matching lines...) Expand all
1246 simulateFrame(1.); 1221 simulateFrame(1.);
1247 1222
1248 element->setLayoutObject(nullptr); 1223 element->setLayoutObject(nullptr);
1249 LayoutObjectProxy::dispose(layoutObject); 1224 LayoutObjectProxy::dispose(layoutObject);
1250 1225
1251 Heap::collectAllGarbage(); 1226 Heap::collectAllGarbage();
1252 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); 1227 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty());
1253 } 1228 }
1254 1229
1255 } // namespace blink 1230 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/animation/CompositorAnimationsTestHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698