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

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

Issue 412123002: Rename WebAnimation to WebCompositorAnimation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Set upstream branch Created 6 years, 5 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 25 matching lines...) Expand all
36 #include "core/animation/CompositorAnimationsTestHelper.h" 36 #include "core/animation/CompositorAnimationsTestHelper.h"
37 #include "core/animation/animatable/AnimatableDouble.h" 37 #include "core/animation/animatable/AnimatableDouble.h"
38 #include "core/animation/animatable/AnimatableFilterOperations.h" 38 #include "core/animation/animatable/AnimatableFilterOperations.h"
39 #include "core/animation/animatable/AnimatableTransform.h" 39 #include "core/animation/animatable/AnimatableTransform.h"
40 #include "core/animation/animatable/AnimatableValueTestHelper.h" 40 #include "core/animation/animatable/AnimatableValueTestHelper.h"
41 #include "platform/geometry/FloatBox.h" 41 #include "platform/geometry/FloatBox.h"
42 #include "platform/geometry/IntSize.h" 42 #include "platform/geometry/IntSize.h"
43 #include "platform/graphics/filters/FilterOperations.h" 43 #include "platform/graphics/filters/FilterOperations.h"
44 #include "platform/transforms/TransformOperations.h" 44 #include "platform/transforms/TransformOperations.h"
45 #include "platform/transforms/TranslateTransformOperation.h" 45 #include "platform/transforms/TranslateTransformOperation.h"
46 #include "public/platform/WebAnimation.h" 46 #include "public/platform/WebCompositorAnimation.h"
47 #include "wtf/HashFunctions.h" 47 #include "wtf/HashFunctions.h"
48 #include "wtf/OwnPtr.h" 48 #include "wtf/OwnPtr.h"
49 #include "wtf/PassOwnPtr.h" 49 #include "wtf/PassOwnPtr.h"
50 #include "wtf/PassRefPtr.h" 50 #include "wtf/PassRefPtr.h"
51 #include "wtf/RefPtr.h" 51 #include "wtf/RefPtr.h"
52 52
53 #include <gmock/gmock.h> 53 #include <gmock/gmock.h>
54 #include <gtest/gtest.h> 54 #include <gtest/gtest.h>
55 55
56 namespace blink { 56 namespace blink {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 public: 100 public:
101 101
102 bool convertTimingForCompositor(const Timing& t, CompositorAnimationsImpl::C ompositorTiming& out) 102 bool convertTimingForCompositor(const Timing& t, CompositorAnimationsImpl::C ompositorTiming& out)
103 { 103 {
104 return CompositorAnimationsImpl::convertTimingForCompositor(t, out); 104 return CompositorAnimationsImpl::convertTimingForCompositor(t, out);
105 } 105 }
106 bool isCandidateForAnimationOnCompositor(const Timing& timing, const Animati onEffect& effect) 106 bool isCandidateForAnimationOnCompositor(const Timing& timing, const Animati onEffect& effect)
107 { 107 {
108 return CompositorAnimations::instance()->isCandidateForAnimationOnCompos itor(timing, effect); 108 return CompositorAnimations::instance()->isCandidateForAnimationOnCompos itor(timing, effect);
109 } 109 }
110 void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectM odel& effect, Vector<OwnPtr<blink::WebAnimation> >& animations) 110 void getAnimationOnCompositor(Timing& timing, AnimatableValueKeyframeEffectM odel& effect, Vector<OwnPtr<blink::WebCompositorAnimation> >& animations)
111 { 111 {
112 return CompositorAnimationsImpl::getAnimationOnCompositor(timing, std::n umeric_limits<double>::quiet_NaN(), effect, animations); 112 return CompositorAnimationsImpl::getAnimationOnCompositor(timing, std::n umeric_limits<double>::quiet_NaN(), effect, animations);
113 } 113 }
114 bool getAnimationBounds(FloatBox& boundingBox, const AnimationEffect& effect , double minValue, double maxValue) 114 bool getAnimationBounds(FloatBox& boundingBox, const AnimationEffect& effect , double minValue, double maxValue)
115 { 115 {
116 return CompositorAnimations::instance()->getAnimatedBoundingBox(bounding Box, effect, minValue, maxValue); 116 return CompositorAnimations::instance()->getAnimatedBoundingBox(bounding Box, effect, minValue, maxValue);
117 } 117 }
118 118
119 bool duplicateSingleKeyframeAndTestIsCandidateOnResult(AnimatableValueKeyfra me* frame) 119 bool duplicateSingleKeyframeAndTestIsCandidateOnResult(AnimatableValueKeyfra me* frame)
120 { 120 {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 // -- 582 // --
583 583
584 WebCompositorSupportMock mockCompositor; 584 WebCompositorSupportMock mockCompositor;
585 585
586 // Curve is created 586 // Curve is created
587 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock; 587 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock;
588 ExpectationSet usesMockCurve; 588 ExpectationSet usesMockCurve;
589 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 589 EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
590 .WillOnce(Return(mockCurvePtr)); 590 .WillOnce(Return(mockCurvePtr));
591 591
592 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebAnimationCurve::TimingFunctionTypeLinear)); 592 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebCompositorAnimationCurve::TimingFunctionTypeLinear));
593 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 5.0))); 593 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 5.0)));
594 594
595 // Create animation 595 // Create animation
596 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 596 blink::WebCompositorAnimationMock* mockAnimationPtr = new blink::WebComposit orAnimationMock(blink::WebCompositorAnimation::TargetPropertyOpacity);
597 ExpectationSet usesMockAnimation; 597 ExpectationSet usesMockAnimation;
598 598
599 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 599 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebCompositorAnimation::TargetPropertyOpacity, _))
600 .WillOnce(Return(mockAnimationPtr)); 600 .WillOnce(Return(mockAnimationPtr));
601 601
602 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1)); 602 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
603 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 603 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
604 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(f alse)); 604 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(f alse));
605 605
606 EXPECT_CALL(*mockAnimationPtr, delete_()) 606 EXPECT_CALL(*mockAnimationPtr, delete_())
607 .Times(1) 607 .Times(1)
608 .After(usesMockAnimation); 608 .After(usesMockAnimation);
609 EXPECT_CALL(*mockCurvePtr, delete_()) 609 EXPECT_CALL(*mockCurvePtr, delete_())
610 .Times(1) 610 .Times(1)
611 .After(usesMockCurve); 611 .After(usesMockCurve);
612 612
613 // Go! 613 // Go!
614 setCompositorForTesting(mockCompositor); 614 setCompositorForTesting(mockCompositor);
615 Vector<OwnPtr<blink::WebAnimation> > result; 615 Vector<OwnPtr<blink::WebCompositorAnimation> > result;
616 getAnimationOnCompositor(m_timing, *effect.get(), result); 616 getAnimationOnCompositor(m_timing, *effect.get(), result);
617 EXPECT_EQ(1U, result.size()); 617 EXPECT_EQ(1U, result.size());
618 result[0].clear(); 618 result[0].clear();
619 } 619 }
620 620
621 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration) 621 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationDuration)
622 { 622 {
623 // Animation to convert 623 // Animation to convert
624 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 624 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel(
625 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 625 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
626 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 626 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
627 627
628 m_timing.iterationDuration = 10.0; 628 m_timing.iterationDuration = 10.0;
629 // -- 629 // --
630 630
631 WebCompositorSupportMock mockCompositor; 631 WebCompositorSupportMock mockCompositor;
632 632
633 // Curve is created 633 // Curve is created
634 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock; 634 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock;
635 ExpectationSet usesMockCurve; 635 ExpectationSet usesMockCurve;
636 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 636 EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
637 .WillOnce(Return(mockCurvePtr)); 637 .WillOnce(Return(mockCurvePtr));
638 638
639 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebAnimationCurve::TimingFunctionTypeLinear)); 639 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebCompositorAnimationCurve::TimingFunctionTypeLinear));
640 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(10.0 , 5.0))); 640 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(10.0 , 5.0)));
641 641
642 // Create animation 642 // Create animation
643 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 643 blink::WebCompositorAnimationMock* mockAnimationPtr = new blink::WebComposit orAnimationMock(blink::WebCompositorAnimation::TargetPropertyOpacity);
644 ExpectationSet usesMockAnimation; 644 ExpectationSet usesMockAnimation;
645 645
646 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 646 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebCompositorAnimation::TargetPropertyOpacity, _))
647 .WillOnce(Return(mockAnimationPtr)); 647 .WillOnce(Return(mockAnimationPtr));
648 648
649 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1)); 649 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
650 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 650 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
651 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(f alse)); 651 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(f alse));
652 652
653 EXPECT_CALL(*mockAnimationPtr, delete_()) 653 EXPECT_CALL(*mockAnimationPtr, delete_())
654 .Times(1) 654 .Times(1)
655 .After(usesMockAnimation); 655 .After(usesMockAnimation);
656 EXPECT_CALL(*mockCurvePtr, delete_()) 656 EXPECT_CALL(*mockCurvePtr, delete_())
657 .Times(1) 657 .Times(1)
658 .After(usesMockCurve); 658 .After(usesMockCurve);
659 659
660 // Go! 660 // Go!
661 setCompositorForTesting(mockCompositor); 661 setCompositorForTesting(mockCompositor);
662 Vector<OwnPtr<blink::WebAnimation> > result; 662 Vector<OwnPtr<blink::WebCompositorAnimation> > result;
663 getAnimationOnCompositor(m_timing, *effect.get(), result); 663 getAnimationOnCompositor(m_timing, *effect.get(), result);
664 EXPECT_EQ(1U, result.size()); 664 EXPECT_EQ(1U, result.size());
665 result[0].clear(); 665 result[0].clear();
666 } 666 }
667 667
668 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Linear) 668 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Linear)
669 { 669 {
670 // Animation to convert 670 // Animation to convert
671 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 671 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel(
672 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 672 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
673 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1. 0).get(), 0.25), 673 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(-1. 0).get(), 0.25),
674 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20. 0).get(), 0.5), 674 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(20. 0).get(), 0.5),
675 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 675 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
676 676
677 m_timing.iterationCount = 5; 677 m_timing.iterationCount = 5;
678 m_timing.direction = Timing::PlaybackDirectionAlternate; 678 m_timing.direction = Timing::PlaybackDirectionAlternate;
679 // -- 679 // --
680 680
681 WebCompositorSupportMock mockCompositor; 681 WebCompositorSupportMock mockCompositor;
682 682
683 // Curve is created 683 // Curve is created
684 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock(); 684 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock();
685 ExpectationSet usesMockCurve; 685 ExpectationSet usesMockCurve;
686 686
687 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 687 EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
688 .WillOnce(Return(mockCurvePtr)); 688 .WillOnce(Return(mockCurvePtr));
689 689
690 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebAnimationCurve::TimingFunctionTypeLinear)); 690 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebCompositorAnimationCurve::TimingFunctionTypeLinear));
691 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.25 , -1.0), blink::WebAnimationCurve::TimingFunctionTypeLinear)); 691 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.25 , -1.0), blink::WebCompositorAnimationCurve::TimingFunctionTypeLinear));
692 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.5, 20.0), blink::WebAnimationCurve::TimingFunctionTypeLinear)); 692 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.5, 20.0), blink::WebCompositorAnimationCurve::TimingFunctionTypeLinear));
693 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 5.0))); 693 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 5.0)));
694 694
695 // Animation is created 695 // Animation is created
696 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 696 blink::WebCompositorAnimationMock* mockAnimationPtr = new blink::WebComposit orAnimationMock(blink::WebCompositorAnimation::TargetPropertyOpacity);
697 ExpectationSet usesMockAnimation; 697 ExpectationSet usesMockAnimation;
698 698
699 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 699 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebCompositorAnimation::TargetPropertyOpacity, _))
700 .WillOnce(Return(mockAnimationPtr)); 700 .WillOnce(Return(mockAnimationPtr));
701 701
702 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5)); 702 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
703 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 703 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
704 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(t rue)); 704 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(t rue));
705 705
706 EXPECT_CALL(*mockAnimationPtr, delete_()) 706 EXPECT_CALL(*mockAnimationPtr, delete_())
707 .Times(1) 707 .Times(1)
708 .After(usesMockAnimation); 708 .After(usesMockAnimation);
709 EXPECT_CALL(*mockCurvePtr, delete_()) 709 EXPECT_CALL(*mockCurvePtr, delete_())
710 .Times(1) 710 .Times(1)
711 .After(usesMockCurve); 711 .After(usesMockCurve);
712 712
713 // Go! 713 // Go!
714 setCompositorForTesting(mockCompositor); 714 setCompositorForTesting(mockCompositor);
715 Vector<OwnPtr<blink::WebAnimation> > result; 715 Vector<OwnPtr<blink::WebCompositorAnimation> > result;
716 getAnimationOnCompositor(m_timing, *effect.get(), result); 716 getAnimationOnCompositor(m_timing, *effect.get(), result);
717 EXPECT_EQ(1U, result.size()); 717 EXPECT_EQ(1U, result.size());
718 result[0].clear(); 718 result[0].clear();
719 } 719 }
720 720
721 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationStartDelay ) 721 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationStartDelay )
722 { 722 {
723 // Animation to convert 723 // Animation to convert
724 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 724 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel(
725 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 725 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
726 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 726 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
727 727
728 m_timing.iterationCount = 5.0; 728 m_timing.iterationCount = 5.0;
729 m_timing.iterationDuration = 1.75; 729 m_timing.iterationDuration = 1.75;
730 m_timing.startDelay = 3.25; 730 m_timing.startDelay = 3.25;
731 // -- 731 // --
732 732
733 WebCompositorSupportMock mockCompositor; 733 WebCompositorSupportMock mockCompositor;
734 734
735 // Curve is created 735 // Curve is created
736 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock; 736 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock;
737 ExpectationSet usesMockCurve; 737 ExpectationSet usesMockCurve;
738 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 738 EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
739 .WillOnce(Return(mockCurvePtr)); 739 .WillOnce(Return(mockCurvePtr));
740 740
741 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebAnimationCurve::TimingFunctionTypeLinear)); 741 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebCompositorAnimationCurve::TimingFunctionTypeLinear));
742 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.75 , 5.0))); 742 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.75 , 5.0)));
743 743
744 // Create animation 744 // Create animation
745 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 745 blink::WebCompositorAnimationMock* mockAnimationPtr = new blink::WebComposit orAnimationMock(blink::WebCompositorAnimation::TargetPropertyOpacity);
746 ExpectationSet usesMockAnimation; 746 ExpectationSet usesMockAnimation;
747 747
748 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 748 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebCompositorAnimation::TargetPropertyOpacity, _))
749 .WillOnce(Return(mockAnimationPtr)); 749 .WillOnce(Return(mockAnimationPtr));
750 750
751 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5)); 751 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
752 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(-3.25)); 752 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(-3.25));
753 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(f alse)); 753 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(f alse));
754 754
755 EXPECT_CALL(*mockAnimationPtr, delete_()) 755 EXPECT_CALL(*mockAnimationPtr, delete_())
756 .Times(1) 756 .Times(1)
757 .After(usesMockAnimation); 757 .After(usesMockAnimation);
758 EXPECT_CALL(*mockCurvePtr, delete_()) 758 EXPECT_CALL(*mockCurvePtr, delete_())
759 .Times(1) 759 .Times(1)
760 .After(usesMockCurve); 760 .After(usesMockCurve);
761 761
762 // Go! 762 // Go!
763 setCompositorForTesting(mockCompositor); 763 setCompositorForTesting(mockCompositor);
764 Vector<OwnPtr<blink::WebAnimation> > result; 764 Vector<OwnPtr<blink::WebCompositorAnimation> > result;
765 getAnimationOnCompositor(m_timing, *effect.get(), result); 765 getAnimationOnCompositor(m_timing, *effect.get(), result);
766 EXPECT_EQ(1U, result.size()); 766 EXPECT_EQ(1U, result.size());
767 result[0].clear(); 767 result[0].clear();
768 } 768 }
769 769
770 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Chained) 770 TEST_F(AnimationCompositorAnimationsTest, createMultipleKeyframeOpacityAnimation Chained)
771 { 771 {
772 // Animation to convert 772 // Animation to convert
773 AnimatableValueKeyframeVector frames; 773 AnimatableValueKeyframeVector frames;
774 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(2.0).get(), 0)); 774 frames.append(createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble:: create(2.0).get(), 0));
(...skipping 13 matching lines...) Expand all
788 788
789 WebCompositorSupportMock mockCompositor; 789 WebCompositorSupportMock mockCompositor;
790 790
791 // Curve is created 791 // Curve is created
792 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock(); 792 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock();
793 ExpectationSet usesMockCurve; 793 ExpectationSet usesMockCurve;
794 794
795 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 795 EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
796 .WillOnce(Return(mockCurvePtr)); 796 .WillOnce(Return(mockCurvePtr));
797 797
798 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebAnimationCurve::TimingFunctionTypeEase)); 798 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebCompositorAnimationCurve::TimingFunctionTypeEase));
799 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.5, -1.0), blink::WebAnimationCurve::TimingFunctionTypeLinear)); 799 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.5, -1.0), blink::WebCompositorAnimationCurve::TimingFunctionTypeLinear));
800 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 20.0), 1.0, 2.0, 3.0, 4.0)); 800 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 20.0), 1.0, 2.0, 3.0, 4.0));
801 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(2.0, 5.0))); 801 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(2.0, 5.0)));
802 802
803 // Animation is created 803 // Animation is created
804 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 804 blink::WebCompositorAnimationMock* mockAnimationPtr = new blink::WebComposit orAnimationMock(blink::WebCompositorAnimation::TargetPropertyOpacity);
805 ExpectationSet usesMockAnimation; 805 ExpectationSet usesMockAnimation;
806 806
807 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 807 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebCompositorAnimation::TargetPropertyOpacity, _))
808 .WillOnce(Return(mockAnimationPtr)); 808 .WillOnce(Return(mockAnimationPtr));
809 809
810 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10)); 810 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10));
811 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 811 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
812 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(t rue)); 812 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(t rue));
813 813
814 EXPECT_CALL(*mockAnimationPtr, delete_()) 814 EXPECT_CALL(*mockAnimationPtr, delete_())
815 .Times(1) 815 .Times(1)
816 .After(usesMockAnimation); 816 .After(usesMockAnimation);
817 EXPECT_CALL(*mockCurvePtr, delete_()) 817 EXPECT_CALL(*mockCurvePtr, delete_())
818 .Times(1) 818 .Times(1)
819 .After(usesMockCurve); 819 .After(usesMockCurve);
820 820
821 // Go! 821 // Go!
822 setCompositorForTesting(mockCompositor); 822 setCompositorForTesting(mockCompositor);
823 Vector<OwnPtr<blink::WebAnimation> > result; 823 Vector<OwnPtr<blink::WebCompositorAnimation> > result;
824 getAnimationOnCompositor(m_timing, *effect.get(), result); 824 getAnimationOnCompositor(m_timing, *effect.get(), result);
825 EXPECT_EQ(1U, result.size()); 825 EXPECT_EQ(1U, result.size());
826 result[0].clear(); 826 result[0].clear();
827 } 827 }
828 828
829 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation) 829 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimation)
830 { 830 {
831 RefPtr<TimingFunction> cubicEasyFlipTimingFunction = CubicBezierTimingFuncti on::create(0.0, 0.0, 0.0, 1.0); 831 RefPtr<TimingFunction> cubicEasyFlipTimingFunction = CubicBezierTimingFuncti on::create(0.0, 0.0, 0.0, 1.0);
832 832
833 // Animation to convert 833 // Animation to convert
(...skipping 15 matching lines...) Expand all
849 WebCompositorSupportMock mockCompositor; 849 WebCompositorSupportMock mockCompositor;
850 850
851 // Curve is created 851 // Curve is created
852 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock(); 852 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock();
853 ExpectationSet usesMockCurve; 853 ExpectationSet usesMockCurve;
854 854
855 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 855 EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
856 .WillOnce(Return(mockCurvePtr)); 856 .WillOnce(Return(mockCurvePtr));
857 857
858 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 5.0), 1.0, 0.0, 1.0, 1.0)); 858 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 5.0), 1.0, 0.0, 1.0, 1.0));
859 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.5, 20.0), blink::WebAnimationCurve::TimingFunctionTypeLinear)); 859 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.5, 20.0), blink::WebCompositorAnimationCurve::TimingFunctionTypeLinear));
860 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.75 , -1.0), blink::WebAnimationCurve::TimingFunctionTypeEaseOut)); 860 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.75 , -1.0), blink::WebCompositorAnimationCurve::TimingFunctionTypeEaseOut));
861 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 2.0))); 861 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 2.0)));
862 862
863 // Create the animation 863 // Create the animation
864 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 864 blink::WebCompositorAnimationMock* mockAnimationPtr = new blink::WebComposit orAnimationMock(blink::WebCompositorAnimation::TargetPropertyOpacity);
865 ExpectationSet usesMockAnimation; 865 ExpectationSet usesMockAnimation;
866 866
867 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 867 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebCompositorAnimation::TargetPropertyOpacity, _))
868 .WillOnce(Return(mockAnimationPtr)); 868 .WillOnce(Return(mockAnimationPtr));
869 869
870 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10)); 870 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10));
871 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 871 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
872 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(t rue)); 872 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(t rue));
873 873
874 EXPECT_CALL(*mockAnimationPtr, delete_()) 874 EXPECT_CALL(*mockAnimationPtr, delete_())
875 .Times(1) 875 .Times(1)
876 .After(usesMockAnimation); 876 .After(usesMockAnimation);
877 EXPECT_CALL(*mockCurvePtr, delete_()) 877 EXPECT_CALL(*mockCurvePtr, delete_())
878 .Times(1) 878 .Times(1)
879 .After(usesMockCurve); 879 .After(usesMockCurve);
880 880
881 // Go! 881 // Go!
882 setCompositorForTesting(mockCompositor); 882 setCompositorForTesting(mockCompositor);
883 Vector<OwnPtr<blink::WebAnimation> > result; 883 Vector<OwnPtr<blink::WebCompositorAnimation> > result;
884 getAnimationOnCompositor(m_timing, *effect.get(), result); 884 getAnimationOnCompositor(m_timing, *effect.get(), result);
885 EXPECT_EQ(1U, result.size()); 885 EXPECT_EQ(1U, result.size());
886 result[0].clear(); 886 result[0].clear();
887 } 887 }
888 888
889 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative StartDelay) 889 TEST_F(AnimationCompositorAnimationsTest, createReversedOpacityAnimationNegative StartDelay)
890 { 890 {
891 // Animation to convert 891 // Animation to convert
892 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel( 892 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel(
893 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0), 893 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
894 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0)); 894 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
895 895
896 m_timing.iterationCount = 5.0; 896 m_timing.iterationCount = 5.0;
897 m_timing.iterationDuration = 1.5; 897 m_timing.iterationDuration = 1.5;
898 m_timing.startDelay = -3; 898 m_timing.startDelay = -3;
899 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; 899 m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
900 // -- 900 // --
901 901
902 WebCompositorSupportMock mockCompositor; 902 WebCompositorSupportMock mockCompositor;
903 903
904 // Curve is created 904 // Curve is created
905 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock; 905 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock;
906 ExpectationSet usesMockCurve; 906 ExpectationSet usesMockCurve;
907 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 907 EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
908 .WillOnce(Return(mockCurvePtr)); 908 .WillOnce(Return(mockCurvePtr));
909 909
910 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 5.0), blink::WebAnimationCurve::TimingFunctionTypeLinear)); 910 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 5.0), blink::WebCompositorAnimationCurve::TimingFunctionTypeLinear));
911 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.5, 2.0))); 911 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.5, 2.0)));
912 912
913 // Create animation 913 // Create animation
914 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 914 blink::WebCompositorAnimationMock* mockAnimationPtr = new blink::WebComposit orAnimationMock(blink::WebCompositorAnimation::TargetPropertyOpacity);
915 ExpectationSet usesMockAnimation; 915 ExpectationSet usesMockAnimation;
916 916
917 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 917 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebCompositorAnimation::TargetPropertyOpacity, _))
918 .WillOnce(Return(mockAnimationPtr)); 918 .WillOnce(Return(mockAnimationPtr));
919 919
920 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5)); 920 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
921 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(3.0)); 921 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(3.0));
922 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(t rue)); 922 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(t rue));
923 923
924 EXPECT_CALL(*mockAnimationPtr, delete_()) 924 EXPECT_CALL(*mockAnimationPtr, delete_())
925 .Times(1) 925 .Times(1)
926 .After(usesMockAnimation); 926 .After(usesMockAnimation);
927 EXPECT_CALL(*mockCurvePtr, delete_()) 927 EXPECT_CALL(*mockCurvePtr, delete_())
928 .Times(1) 928 .Times(1)
929 .After(usesMockCurve); 929 .After(usesMockCurve);
930 930
931 // Go! 931 // Go!
932 setCompositorForTesting(mockCompositor); 932 setCompositorForTesting(mockCompositor);
933 Vector<OwnPtr<blink::WebAnimation> > result; 933 Vector<OwnPtr<blink::WebCompositorAnimation> > result;
934 getAnimationOnCompositor(m_timing, *effect.get(), result); 934 getAnimationOnCompositor(m_timing, *effect.get(), result);
935 EXPECT_EQ(1U, result.size()); 935 EXPECT_EQ(1U, result.size());
936 result[0].clear(); 936 result[0].clear();
937 } 937 }
938 938
939 939
940 } // namespace blink 940 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698