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

Unified Diff: cc/CCKeyframedAnimationCurveTest.cpp

Issue 11085029: [cc] Use base ptr types for cc's CSS animation classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/CCKeyframedAnimationCurve.cpp ('k') | cc/CCLayerAnimationController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « cc/CCKeyframedAnimationCurve.cpp ('k') | cc/CCLayerAnimationController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698