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

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

Issue 768653002: Revert "Animations: Pass animation timing function through to compositor." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 { 465 {
466 m_timing.timingFunction = m_linearTimingFunction; 466 m_timing.timingFunction = m_linearTimingFunction;
467 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 467 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get()));
468 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 468 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get()));
469 } 469 }
470 470
471 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionCubic) 471 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionCubic)
472 { 472 {
473 m_timing.timingFunction = m_cubicEaseTimingFunction; 473 m_timing.timingFunction = m_cubicEaseTimingFunction;
474 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 474 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get()));
475 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 475 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat ionEffect5.get()));
476 476
477 m_timing.timingFunction = m_cubicCustomTimingFunction; 477 m_timing.timingFunction = m_cubicCustomTimingFunction;
478 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 478 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get()));
479 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 479 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat ionEffect5.get()));
480 } 480 }
481 481
482 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionSteps) 482 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionSteps)
483 { 483 {
484 m_timing.timingFunction = m_stepTimingFunction; 484 m_timing.timingFunction = m_stepTimingFunction;
485 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat ionEffect2.get())); 485 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat ionEffect2.get()));
486 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat ionEffect5.get())); 486 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat ionEffect5.get()));
487 } 487 }
488 488
489 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionChainedLinear) 489 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionChainedLinear)
490 { 490 {
491 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 491 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get()));
492 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get())); 492 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get()));
493 } 493 }
494 494
495 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorNon LinearTimingFunctionOnFirstOrLastFrame) 495 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorNon LinearTimingFunctionOnFirstFrame)
496 { 496 {
497 m_timing.timingFunction = m_cubicEaseTimingFunction;
498
499 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get()));
500
497 (*m_keyframeVector2)[0]->setEasing(m_cubicEaseTimingFunction.get()); 501 (*m_keyframeVector2)[0]->setEasing(m_cubicEaseTimingFunction.get());
498 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2); 502 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2);
499
500 (*m_keyframeVector5)[3]->setEasing(m_cubicEaseTimingFunction.get());
501 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector5);
502
503 m_timing.timingFunction = m_cubicCustomTimingFunction;
504
505 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat ionEffect2.get())); 503 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat ionEffect2.get()));
506 EXPECT_FALSE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimat ionEffect5.get()));
507
508 m_timing.timingFunction = m_cubicEaseTimingFunction;
509 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get()));
510 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect5.get()));
511 } 504 }
512 505
513 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionChainedCubicMatchingOffsets) 506 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorTim ingFunctionChainedCubicMatchingOffsets)
514 { 507 {
515 (*m_keyframeVector2)[0]->setEasing(m_cubicEaseTimingFunction.get()); 508 (*m_keyframeVector2)[0]->setEasing(m_cubicEaseTimingFunction.get());
516 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2); 509 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2);
517 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get())); 510 EXPECT_TRUE(isCandidateForAnimationOnCompositor(m_timing, *m_keyframeAnimati onEffect2.get()));
518 511
519 (*m_keyframeVector2)[0]->setEasing(m_cubicCustomTimingFunction.get()); 512 (*m_keyframeVector2)[0]->setEasing(m_cubicCustomTimingFunction.get());
520 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2); 513 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create(*m_k eyframeVector2);
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 .After(usesMockCurve); 1098 .After(usesMockCurve);
1106 1099
1107 // Go! 1100 // Go!
1108 setCompositorForTesting(mockCompositor); 1101 setCompositorForTesting(mockCompositor);
1109 Vector<OwnPtr<WebCompositorAnimation> > result; 1102 Vector<OwnPtr<WebCompositorAnimation> > result;
1110 getAnimationOnCompositor(m_timing, *effect.get(), result); 1103 getAnimationOnCompositor(m_timing, *effect.get(), result);
1111 EXPECT_EQ(1U, result.size()); 1104 EXPECT_EQ(1U, result.size());
1112 result[0].clear(); 1105 result[0].clear();
1113 } 1106 }
1114 1107
1115 TEST_F(AnimationCompositorAnimationsTest, createSimpleOpacityAnimationWithTiming Function)
1116 {
1117 // Animation to convert
1118 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = createKeyfra meEffectModel(
1119 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(2.0 ).get(), 0),
1120 createReplaceOpKeyframe(CSSPropertyOpacity, AnimatableDouble::create(5.0 ).get(), 1.0));
1121
1122 m_timing.timingFunction = m_cubicCustomTimingFunction;
1123
1124 WebCompositorSupportMock mockCompositor;
1125
1126 // Curve is created
1127 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMock;
1128 ExpectationSet usesMockCurve;
1129 EXPECT_CALL(mockCompositor, createFloatAnimationCurve())
1130 .WillOnce(Return(mockCurvePtr));
1131
1132 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(0.0, 2.0), WebCompositorAnimationCurve::TimingFunctionTypeLinear));
1133 usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(WebFloatKeyframe(1.0, 5.0))) ;
1134 usesMockCurve += EXPECT_CALL(*mockCurvePtr, setTimingFunction(1, 2, 3, 4));
1135
1136 // Create animation
1137 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMoc k(WebCompositorAnimation::TargetPropertyOpacity);
1138 ExpectationSet usesMockAnimation;
1139
1140 usesMockCurve += EXPECT_CALL(mockCompositor, createAnimation(Ref(*mockCurveP tr), WebCompositorAnimation::TargetPropertyOpacity, _, _))
1141 .WillOnce(Return(mockAnimationPtr));
1142
1143 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
1144 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setTimeOffset(0.0));
1145 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setDirection(blink::WebC ompositorAnimation::DirectionNormal));
1146 usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setPlaybackRate(1));
1147
1148 EXPECT_CALL(*mockAnimationPtr, delete_())
1149 .Times(1)
1150 .After(usesMockAnimation);
1151 EXPECT_CALL(*mockCurvePtr, delete_())
1152 .Times(1)
1153 .After(usesMockCurve);
1154
1155 // Go!
1156 setCompositorForTesting(mockCompositor);
1157 Vector<OwnPtr<WebCompositorAnimation> > result;
1158 getAnimationOnCompositor(m_timing, *effect.get(), result);
1159 EXPECT_EQ(1U, result.size());
1160 result[0].clear();
1161 }
1162
1163 } // namespace blink 1108 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/CompositorAnimations.cpp ('k') | Source/core/animation/CompositorAnimationsTestHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698