Index: cc/CCKeyframedAnimationCurveTest.cpp |
diff --git a/cc/CCKeyframedAnimationCurveTest.cpp b/cc/CCKeyframedAnimationCurveTest.cpp |
index 21353eddd074e00464c87cd12fdb7e1e3ebb46d1..9dca26aeabb402298e51d02535d98a250b9b0117 100644 |
--- a/cc/CCKeyframedAnimationCurveTest.cpp |
+++ b/cc/CCKeyframedAnimationCurveTest.cpp |
@@ -10,7 +10,6 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include <public/WebTransformOperations.h> |
#include <public/WebTransformationMatrix.h> |
-#include <wtf/OwnPtr.h> |
using namespace cc; |
using WebKit::WebTransformationMatrix; |
@@ -25,8 +24,8 @@ void expectTranslateX(double translateX, const WebTransformationMatrix& matrix) |
// Tests that a float animation with one keyframe works as expected. |
TEST(CCKeyframedAnimationCurveTest, OneFloatKeyframe) |
{ |
- OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
- curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); |
+ scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
+ curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); |
EXPECT_FLOAT_EQ(2, curve->getValue(-1)); |
EXPECT_FLOAT_EQ(2, curve->getValue(0)); |
EXPECT_FLOAT_EQ(2, curve->getValue(0.5)); |
@@ -37,9 +36,9 @@ TEST(CCKeyframedAnimationCurveTest, OneFloatKeyframe) |
// Tests that a float animation with two keyframes works as expected. |
TEST(CCKeyframedAnimationCurveTest, TwoFloatKeyframe) |
{ |
- OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
- curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); |
- curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); |
+ scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
+ curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>())); |
EXPECT_FLOAT_EQ(2, curve->getValue(-1)); |
EXPECT_FLOAT_EQ(2, curve->getValue(0)); |
EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); |
@@ -50,10 +49,10 @@ TEST(CCKeyframedAnimationCurveTest, TwoFloatKeyframe) |
// Tests that a float animation with three keyframes works as expected. |
TEST(CCKeyframedAnimationCurveTest, ThreeFloatKeyframe) |
{ |
- OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
- curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); |
- curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); |
- curve->addKeyframe(CCFloatKeyframe::create(2, 8, nullptr)); |
+ scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
+ curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCFloatKeyframe::create(2, 8, scoped_ptr<CCTimingFunction>())); |
EXPECT_FLOAT_EQ(2, curve->getValue(-1)); |
EXPECT_FLOAT_EQ(2, curve->getValue(0)); |
EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); |
@@ -66,11 +65,11 @@ TEST(CCKeyframedAnimationCurveTest, ThreeFloatKeyframe) |
// Tests that a float animation with multiple keys at a given time works sanely. |
TEST(CCKeyframedAnimationCurveTest, RepeatedFloatKeyTimes) |
{ |
- OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
- curve->addKeyframe(CCFloatKeyframe::create(0, 4, nullptr)); |
- curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); |
- curve->addKeyframe(CCFloatKeyframe::create(1, 6, nullptr)); |
- curve->addKeyframe(CCFloatKeyframe::create(2, 6, nullptr)); |
+ scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
+ curve->addKeyframe(CCFloatKeyframe::create(0, 4, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCFloatKeyframe::create(1, 6, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCFloatKeyframe::create(2, 6, scoped_ptr<CCTimingFunction>())); |
EXPECT_FLOAT_EQ(4, curve->getValue(-1)); |
EXPECT_FLOAT_EQ(4, curve->getValue(0)); |
@@ -89,10 +88,10 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedFloatKeyTimes) |
// Tests that a transform animation with one keyframe works as expected. |
TEST(CCKeyframedAnimationCurveTest, OneTransformKeyframe) |
{ |
- OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
+ scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
WebKit::WebTransformOperations operations; |
operations.appendTranslate(2, 0, 0); |
- curve->addKeyframe(CCTransformKeyframe::create(0, operations, nullptr)); |
+ curve->addKeyframe(CCTransformKeyframe::create(0, operations, scoped_ptr<CCTimingFunction>())); |
expectTranslateX(2, curve->getValue(-1)); |
expectTranslateX(2, curve->getValue(0)); |
@@ -104,14 +103,14 @@ TEST(CCKeyframedAnimationCurveTest, OneTransformKeyframe) |
// Tests that a transform animation with two keyframes works as expected. |
TEST(CCKeyframedAnimationCurveTest, TwoTransformKeyframe) |
{ |
- OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
+ scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
WebKit::WebTransformOperations operations1; |
operations1.appendTranslate(2, 0, 0); |
WebKit::WebTransformOperations operations2; |
operations2.appendTranslate(4, 0, 0); |
- curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); |
- curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); |
+ curve->addKeyframe(CCTransformKeyframe::create(0, operations1, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCTransformKeyframe::create(1, operations2, scoped_ptr<CCTimingFunction>())); |
expectTranslateX(2, curve->getValue(-1)); |
expectTranslateX(2, curve->getValue(0)); |
expectTranslateX(3, curve->getValue(0.5)); |
@@ -122,16 +121,16 @@ TEST(CCKeyframedAnimationCurveTest, TwoTransformKeyframe) |
// Tests that a transform animation with three keyframes works as expected. |
TEST(CCKeyframedAnimationCurveTest, ThreeTransformKeyframe) |
{ |
- OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
+ scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
WebKit::WebTransformOperations operations1; |
operations1.appendTranslate(2, 0, 0); |
WebKit::WebTransformOperations operations2; |
operations2.appendTranslate(4, 0, 0); |
WebKit::WebTransformOperations operations3; |
operations3.appendTranslate(8, 0, 0); |
- curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); |
- curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); |
- curve->addKeyframe(CCTransformKeyframe::create(2, operations3, nullptr)); |
+ curve->addKeyframe(CCTransformKeyframe::create(0, operations1, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCTransformKeyframe::create(1, operations2, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCTransformKeyframe::create(2, operations3, scoped_ptr<CCTimingFunction>())); |
expectTranslateX(2, curve->getValue(-1)); |
expectTranslateX(2, curve->getValue(0)); |
expectTranslateX(3, curve->getValue(0.5)); |
@@ -144,7 +143,7 @@ TEST(CCKeyframedAnimationCurveTest, ThreeTransformKeyframe) |
// Tests that a transform animation with multiple keys at a given time works sanely. |
TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) |
{ |
- OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
+ scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create()); |
// A step function. |
WebKit::WebTransformOperations operations1; |
operations1.appendTranslate(4, 0, 0); |
@@ -154,10 +153,10 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) |
operations3.appendTranslate(6, 0, 0); |
WebKit::WebTransformOperations operations4; |
operations4.appendTranslate(6, 0, 0); |
- curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr)); |
- curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr)); |
- curve->addKeyframe(CCTransformKeyframe::create(1, operations3, nullptr)); |
- curve->addKeyframe(CCTransformKeyframe::create(2, operations4, nullptr)); |
+ curve->addKeyframe(CCTransformKeyframe::create(0, operations1, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCTransformKeyframe::create(1, operations2, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCTransformKeyframe::create(1, operations3, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCTransformKeyframe::create(2, operations4, scoped_ptr<CCTimingFunction>())); |
expectTranslateX(4, curve->getValue(-1)); |
expectTranslateX(4, curve->getValue(0)); |
@@ -175,10 +174,10 @@ TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes) |
// Tests that the keyframes may be added out of order. |
TEST(CCKeyframedAnimationCurveTest, UnsortedKeyframes) |
{ |
- OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
- curve->addKeyframe(CCFloatKeyframe::create(2, 8, nullptr)); |
- curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr)); |
- curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr)); |
+ scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
+ curve->addKeyframe(CCFloatKeyframe::create(2, 8, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>())); |
+ curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>())); |
EXPECT_FLOAT_EQ(2, curve->getValue(-1)); |
EXPECT_FLOAT_EQ(2, curve->getValue(0)); |
EXPECT_FLOAT_EQ(3, curve->getValue(0.5)); |
@@ -191,9 +190,9 @@ TEST(CCKeyframedAnimationCurveTest, UnsortedKeyframes) |
// Tests that a cubic bezier timing function works as expected. |
TEST(CCKeyframedAnimationCurveTest, CubicBezierTimingFunction) |
{ |
- OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
- curve->addKeyframe(CCFloatKeyframe::create(0, 0, CCCubicBezierTimingFunction::create(0.25, 0, 0.75, 1))); |
- curve->addKeyframe(CCFloatKeyframe::create(1, 1, nullptr)); |
+ scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create()); |
+ curve->addKeyframe(CCFloatKeyframe::create(0, 0, CCCubicBezierTimingFunction::create(0.25, 0, 0.75, 1).PassAs<CCTimingFunction>())); |
+ curve->addKeyframe(CCFloatKeyframe::create(1, 1, scoped_ptr<CCTimingFunction>())); |
EXPECT_FLOAT_EQ(0, curve->getValue(0)); |
EXPECT_LT(0, curve->getValue(0.25)); |