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

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

Issue 178263006: Handle direction control in compositor Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: new patch: add a reference to chromium issue Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 using ::testing::CloneToPassOwnPtr; 58 using ::testing::CloneToPassOwnPtr;
59 using ::testing::ExpectationSet; 59 using ::testing::ExpectationSet;
60 using ::testing::Ref; 60 using ::testing::Ref;
61 using ::testing::Return; 61 using ::testing::Return;
62 using ::testing::_; 62 using ::testing::_;
63 63
64 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe stBase { 64 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe stBase {
65 65
66 protected: 66 protected:
67 enum Direction {
68 Normal = CompositorAnimationsImpl::CompositorTiming::Normal,
69 Alternate = CompositorAnimationsImpl::CompositorTiming::Alternate,
70 Reverse = CompositorAnimationsImpl::CompositorTiming::Reverse,
71 AlternateReverse = CompositorAnimationsImpl::CompositorTiming::Alternate Reverse
72 };
73
67 RefPtr<TimingFunction> m_linearTimingFunction; 74 RefPtr<TimingFunction> m_linearTimingFunction;
68 RefPtr<TimingFunction> m_cubicEaseTimingFunction; 75 RefPtr<TimingFunction> m_cubicEaseTimingFunction;
69 RefPtr<TimingFunction> m_cubicCustomTimingFunction; 76 RefPtr<TimingFunction> m_cubicCustomTimingFunction;
70 RefPtr<TimingFunction> m_stepTimingFunction; 77 RefPtr<TimingFunction> m_stepTimingFunction;
71 78
72 Timing m_timing; 79 Timing m_timing;
73 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; 80 CompositorAnimationsImpl::CompositorTiming m_compositorTiming;
74 KeyframeEffectModel::KeyframeVector m_keyframeVector2; 81 KeyframeEffectModel::KeyframeVector m_keyframeVector2;
75 RefPtrWillBePersistent<KeyframeEffectModel> m_keyframeAnimationEffect2; 82 RefPtrWillBePersistent<KeyframeEffectModel> m_keyframeAnimationEffect2;
76 KeyframeEffectModel::KeyframeVector m_keyframeVector5; 83 KeyframeEffectModel::KeyframeVector m_keyframeVector5;
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 360
354 m_timing.playbackRate = 0.0; 361 m_timing.playbackRate = 0.0;
355 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); 362 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming));
356 363
357 m_timing.playbackRate = -2.0; 364 m_timing.playbackRate = -2.0;
358 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming)); 365 EXPECT_FALSE(convertTimingForCompositor(m_timing, m_compositorTiming));
359 } 366 }
360 367
361 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirection) 368 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirection)
362 { 369 {
370 m_timing.direction = Timing::PlaybackDirectionNormal;
371 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
372 EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), Normal);
373
363 m_timing.direction = Timing::PlaybackDirectionAlternate; 374 m_timing.direction = Timing::PlaybackDirectionAlternate;
364 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); 375 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
365 EXPECT_TRUE(m_compositorTiming.alternate); 376 EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), Alternate);
366 EXPECT_FALSE(m_compositorTiming.reverse);
367 377
368 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; 378 m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
369 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); 379 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
370 EXPECT_TRUE(m_compositorTiming.alternate); 380 EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), AlternateRev erse);
371 EXPECT_TRUE(m_compositorTiming.reverse);
372 381
373 m_timing.direction = Timing::PlaybackDirectionReverse; 382 m_timing.direction = Timing::PlaybackDirectionReverse;
374 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); 383 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
375 EXPECT_FALSE(m_compositorTiming.alternate); 384 EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), Reverse);
376 EXPECT_TRUE(m_compositorTiming.reverse);
377 } 385 }
378 386
379 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIte rationsAndStartDelay) 387 TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirectionIte rationsAndStartDelay)
380 { 388 {
381 m_timing.direction = Timing::PlaybackDirectionAlternate; 389 m_timing.direction = Timing::PlaybackDirectionAlternate;
382 m_timing.iterationCount = 4.0; 390 m_timing.iterationCount = 4.0;
383 m_timing.iterationDuration = 5.0; 391 m_timing.iterationDuration = 5.0;
384 m_timing.startDelay = -6.0; 392 m_timing.startDelay = -6.0;
385 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); 393 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
386 EXPECT_DOUBLE_EQ(6.0, m_compositorTiming.scaledTimeOffset); 394 EXPECT_DOUBLE_EQ(6.0, m_compositorTiming.scaledTimeOffset);
387 EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount); 395 EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
388 EXPECT_TRUE(m_compositorTiming.alternate); 396 EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), Alternate);
389 EXPECT_FALSE(m_compositorTiming.reverse);
390 397
391 m_timing.direction = Timing::PlaybackDirectionAlternate; 398 m_timing.direction = Timing::PlaybackDirectionAlternate;
392 m_timing.iterationCount = 4.0; 399 m_timing.iterationCount = 4.0;
393 m_timing.iterationDuration = 5.0; 400 m_timing.iterationDuration = 5.0;
394 m_timing.startDelay = -11.0; 401 m_timing.startDelay = -11.0;
395 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); 402 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
396 EXPECT_DOUBLE_EQ(11.0, m_compositorTiming.scaledTimeOffset); 403 EXPECT_DOUBLE_EQ(11.0, m_compositorTiming.scaledTimeOffset);
397 EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount); 404 EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
398 EXPECT_TRUE(m_compositorTiming.alternate); 405 EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), Alternate);
399 EXPECT_FALSE(m_compositorTiming.reverse);
400 406
401 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; 407 m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
402 m_timing.iterationCount = 4.0; 408 m_timing.iterationCount = 4.0;
403 m_timing.iterationDuration = 5.0; 409 m_timing.iterationDuration = 5.0;
404 m_timing.startDelay = -6.0; 410 m_timing.startDelay = -6.0;
405 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); 411 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
406 EXPECT_DOUBLE_EQ(6.0, m_compositorTiming.scaledTimeOffset); 412 EXPECT_DOUBLE_EQ(6.0, m_compositorTiming.scaledTimeOffset);
407 EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount); 413 EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
408 EXPECT_TRUE(m_compositorTiming.alternate); 414 EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), AlternateRev erse);
409 EXPECT_TRUE(m_compositorTiming.reverse);
410 415
411 m_timing.direction = Timing::PlaybackDirectionAlternateReverse; 416 m_timing.direction = Timing::PlaybackDirectionAlternateReverse;
412 m_timing.iterationCount = 4.0; 417 m_timing.iterationCount = 4.0;
413 m_timing.iterationDuration = 5.0; 418 m_timing.iterationDuration = 5.0;
414 m_timing.startDelay = -11.0; 419 m_timing.startDelay = -11.0;
415 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming)); 420 EXPECT_TRUE(convertTimingForCompositor(m_timing, m_compositorTiming));
416 EXPECT_DOUBLE_EQ(11.0, m_compositorTiming.scaledTimeOffset); 421 EXPECT_DOUBLE_EQ(11.0, m_compositorTiming.scaledTimeOffset);
417 EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount); 422 EXPECT_EQ(4, m_compositorTiming.adjustedIterationCount);
418 EXPECT_TRUE(m_compositorTiming.alternate); 423 EXPECT_EQ(static_cast<Direction>(m_compositorTiming.direction), AlternateRev erse);
419 EXPECT_TRUE(m_compositorTiming.reverse);
420 } 424 }
421 425
422 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingTimingFunctionPassThru) 426 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingTimingFunctionPassThru)
423 { 427 {
424 m_timing.timingFunction = m_stepTimingFunction; 428 m_timing.timingFunction = m_stepTimingFunction;
425 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat ionEffect2.get())); 429 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat ionEffect2.get()));
426 } 430 }
427 431
428 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionLinear) 432 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionLinear)
429 { 433 {
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 702
699 // Create animation 703 // Create animation
700 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 704 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity);
701 ExpectationSet usesMockAnimation; 705 ExpectationSet usesMockAnimation;
702 706
703 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 707 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _))
704 .WillOnce(Return(mockAnimationPtr)); 708 .WillOnce(Return(mockAnimationPtr));
705 709
706 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1)); 710 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
707 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 711 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
708 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(f alse)); 712 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebA nimation::Normal));
709 713
710 EXPECT_CALL(*mockAnimationPtr, delete_()) 714 EXPECT_CALL(*mockAnimationPtr, delete_())
711 .Times(1) 715 .Times(1)
712 .After(usesMockAnimation); 716 .After(usesMockAnimation);
713 EXPECT_CALL(*mockCurvePtr, delete_()) 717 EXPECT_CALL(*mockCurvePtr, delete_())
714 .Times(1) 718 .Times(1)
715 .After(usesMockCurve); 719 .After(usesMockCurve);
716 720
717 // Go! 721 // Go!
718 setCompositorForTesting(mockCompositor); 722 setCompositorForTesting(mockCompositor);
(...skipping 26 matching lines...) Expand all
745 749
746 // Create animation 750 // Create animation
747 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 751 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity);
748 ExpectationSet usesMockAnimation; 752 ExpectationSet usesMockAnimation;
749 753
750 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 754 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _))
751 .WillOnce(Return(mockAnimationPtr)); 755 .WillOnce(Return(mockAnimationPtr));
752 756
753 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1)); 757 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
754 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 758 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
755 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(f alse)); 759 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebA nimation::Normal));
756 760
757 EXPECT_CALL(*mockAnimationPtr, delete_()) 761 EXPECT_CALL(*mockAnimationPtr, delete_())
758 .Times(1) 762 .Times(1)
759 .After(usesMockAnimation); 763 .After(usesMockAnimation);
760 EXPECT_CALL(*mockCurvePtr, delete_()) 764 EXPECT_CALL(*mockCurvePtr, delete_())
761 .Times(1) 765 .Times(1)
762 .After(usesMockCurve); 766 .After(usesMockCurve);
763 767
764 // Go! 768 // Go!
765 setCompositorForTesting(mockCompositor); 769 setCompositorForTesting(mockCompositor);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 802
799 // Animation is created 803 // Animation is created
800 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 804 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity);
801 ExpectationSet usesMockAnimation; 805 ExpectationSet usesMockAnimation;
802 806
803 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 807 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _))
804 .WillOnce(Return(mockAnimationPtr)); 808 .WillOnce(Return(mockAnimationPtr));
805 809
806 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5)); 810 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
807 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 811 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
808 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(t rue)); 812 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebA nimation::Alternate));
809 813
810 EXPECT_CALL(*mockAnimationPtr, delete_()) 814 EXPECT_CALL(*mockAnimationPtr, delete_())
811 .Times(1) 815 .Times(1)
812 .After(usesMockAnimation); 816 .After(usesMockAnimation);
813 EXPECT_CALL(*mockCurvePtr, delete_()) 817 EXPECT_CALL(*mockCurvePtr, delete_())
814 .Times(1) 818 .Times(1)
815 .After(usesMockCurve); 819 .After(usesMockCurve);
816 820
817 // Go! 821 // Go!
818 setCompositorForTesting(mockCompositor); 822 setCompositorForTesting(mockCompositor);
(...skipping 28 matching lines...) Expand all
847 851
848 // Create animation 852 // Create animation
849 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 853 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity);
850 ExpectationSet usesMockAnimation; 854 ExpectationSet usesMockAnimation;
851 855
852 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 856 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _))
853 .WillOnce(Return(mockAnimationPtr)); 857 .WillOnce(Return(mockAnimationPtr));
854 858
855 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5)); 859 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
856 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(-3.25)); 860 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(-3.25));
857 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(f alse)); 861 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebA nimation::Normal));
858 862
859 EXPECT_CALL(*mockAnimationPtr, delete_()) 863 EXPECT_CALL(*mockAnimationPtr, delete_())
860 .Times(1) 864 .Times(1)
861 .After(usesMockAnimation); 865 .After(usesMockAnimation);
862 EXPECT_CALL(*mockCurvePtr, delete_()) 866 EXPECT_CALL(*mockCurvePtr, delete_())
863 .Times(1) 867 .Times(1)
864 .After(usesMockCurve); 868 .After(usesMockCurve);
865 869
866 // Go! 870 // Go!
867 setCompositorForTesting(mockCompositor); 871 setCompositorForTesting(mockCompositor);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 911
908 // Animation is created 912 // Animation is created
909 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 913 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity);
910 ExpectationSet usesMockAnimation; 914 ExpectationSet usesMockAnimation;
911 915
912 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 916 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _))
913 .WillOnce(Return(mockAnimationPtr)); 917 .WillOnce(Return(mockAnimationPtr));
914 918
915 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10)); 919 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10));
916 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 920 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
917 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(t rue)); 921 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebA nimation::Alternate));
918 922
919 EXPECT_CALL(*mockAnimationPtr, delete_()) 923 EXPECT_CALL(*mockAnimationPtr, delete_())
920 .Times(1) 924 .Times(1)
921 .After(usesMockAnimation); 925 .After(usesMockAnimation);
922 EXPECT_CALL(*mockCurvePtr, delete_()) 926 EXPECT_CALL(*mockCurvePtr, delete_())
923 .Times(1) 927 .Times(1)
924 .After(usesMockCurve); 928 .After(usesMockCurve);
925 929
926 // Go! 930 // Go!
927 setCompositorForTesting(mockCompositor); 931 setCompositorForTesting(mockCompositor);
(...skipping 25 matching lines...) Expand all
953 957
954 WebCompositorSupportMock mockCompositor; 958 WebCompositorSupportMock mockCompositor;
955 959
956 // Curve is created 960 // Curve is created
957 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock(); 961 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock();
958 ExpectationSet usesMockCurve; 962 ExpectationSet usesMockCurve;
959 963
960 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 964 EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
961 .WillOnce(Return(mockCurvePtr)); 965 .WillOnce(Return(mockCurvePtr));
962 966
963 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 5.0), 1.0, 0.0, 1.0, 1.0)); 967 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebAnimationCurve::TimingFunctionTypeEaseIn));
964 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.5, 20.0), blink::WebAnimationCurve::TimingFunctionTypeLinear)); 968 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.25 , -1.0), blink::WebAnimationCurve::TimingFunctionTypeLinear));
965 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.75 , -1.0), blink::WebAnimationCurve::TimingFunctionTypeEaseOut)); 969 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.5, 20.0), 0.0, 0.0, 0.0, 1.0));
966 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 2.0))); 970 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.0, 5.0)));
967 971
968 // Create the animation 972 // Create the animation
969 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 973 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity);
970 ExpectationSet usesMockAnimation; 974 ExpectationSet usesMockAnimation;
971 975
972 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 976 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _))
973 .WillOnce(Return(mockAnimationPtr)); 977 .WillOnce(Return(mockAnimationPtr));
974 978
975 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10)); 979 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10));
976 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0)); 980 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
977 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(t rue)); 981 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebA nimation::AlternateReverse));
978 982
979 EXPECT_CALL(*mockAnimationPtr, delete_()) 983 EXPECT_CALL(*mockAnimationPtr, delete_())
980 .Times(1) 984 .Times(1)
981 .After(usesMockAnimation); 985 .After(usesMockAnimation);
982 EXPECT_CALL(*mockCurvePtr, delete_()) 986 EXPECT_CALL(*mockCurvePtr, delete_())
983 .Times(1) 987 .Times(1)
984 .After(usesMockCurve); 988 .After(usesMockCurve);
985 989
986 // Go! 990 // Go!
987 setCompositorForTesting(mockCompositor); 991 setCompositorForTesting(mockCompositor);
(...skipping 17 matching lines...) Expand all
1005 // -- 1009 // --
1006 1010
1007 WebCompositorSupportMock mockCompositor; 1011 WebCompositorSupportMock mockCompositor;
1008 1012
1009 // Curve is created 1013 // Curve is created
1010 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock; 1014 blink::WebFloatAnimationCurveMock* mockCurvePtr = new blink::WebFloatAnimati onCurveMock;
1011 ExpectationSet usesMockCurve; 1015 ExpectationSet usesMockCurve;
1012 EXPECT_CALL(mockCompositor, createFloatAnimationCurve()) 1016 EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
1013 .WillOnce(Return(mockCurvePtr)); 1017 .WillOnce(Return(mockCurvePtr));
1014 1018
1015 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 5.0), blink::WebAnimationCurve::TimingFunctionTypeLinear)); 1019 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(0.0, 2.0), blink::WebAnimationCurve::TimingFunctionTypeLinear));
1016 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.5, 2.0))); 1020 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(blink::WebFloatKeyframe(1.5, 5.0)));
1017 1021
1018 // Create animation 1022 // Create animation
1019 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity); 1023 blink::WebAnimationMock* mockAnimationPtr = new blink::WebAnimationMock(blin k::WebAnimation::TargetPropertyOpacity);
1020 ExpectationSet usesMockAnimation; 1024 ExpectationSet usesMockAnimation;
1021 1025
1022 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _)) 1026 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), blink::WebAnimation::TargetPropertyOpacity, _))
1023 .WillOnce(Return(mockAnimationPtr)); 1027 .WillOnce(Return(mockAnimationPtr));
1024 1028
1025 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5)); 1029 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
1026 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(3.0)); 1030 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(3.0));
1027 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setAlternatesDirection(t rue)); 1031 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebA nimation::AlternateReverse));
1028 1032
1029 EXPECT_CALL(*mockAnimationPtr, delete_()) 1033 EXPECT_CALL(*mockAnimationPtr, delete_())
1030 .Times(1) 1034 .Times(1)
1031 .After(usesMockAnimation); 1035 .After(usesMockAnimation);
1032 EXPECT_CALL(*mockCurvePtr, delete_()) 1036 EXPECT_CALL(*mockCurvePtr, delete_())
1033 .Times(1) 1037 .Times(1)
1034 .After(usesMockCurve); 1038 .After(usesMockCurve);
1035 1039
1036 // Go! 1040 // Go!
1037 setCompositorForTesting(mockCompositor); 1041 setCompositorForTesting(mockCompositor);
1038 Vector<OwnPtr<blink::WebAnimation> > result; 1042 Vector<OwnPtr<blink::WebAnimation> > result;
1039 getAnimationOnCompositor(m_timing, *effect.get(), result); 1043 getAnimationOnCompositor(m_timing, *effect.get(), result);
1040 EXPECT_EQ(1U, result.size()); 1044 EXPECT_EQ(1U, result.size());
1041 result[0].clear(); 1045 result[0].clear();
1042 } 1046 }
1043 1047
1044 1048
1045 } // namespace WebCore 1049 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698