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

Unified Diff: cc/CCKeyframedAnimationCurveTest.cpp

Issue 11086053: Revert 161133 - [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
===================================================================
--- cc/CCKeyframedAnimationCurveTest.cpp (revision 161134)
+++ cc/CCKeyframedAnimationCurveTest.cpp (working copy)
@@ -10,6 +10,7 @@
#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;
@@ -24,8 +25,8 @@
// Tests that a float animation with one keyframe works as expected.
TEST(CCKeyframedAnimationCurveTest, OneFloatKeyframe)
{
- scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create());
- curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>()));
+ OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create());
+ curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr));
EXPECT_FLOAT_EQ(2, curve->getValue(-1));
EXPECT_FLOAT_EQ(2, curve->getValue(0));
EXPECT_FLOAT_EQ(2, curve->getValue(0.5));
@@ -36,9 +37,9 @@
// Tests that a float animation with two keyframes works as expected.
TEST(CCKeyframedAnimationCurveTest, TwoFloatKeyframe)
{
- scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create());
- curve->addKeyframe(CCFloatKeyframe::create(0, 2, scoped_ptr<CCTimingFunction>()));
- curve->addKeyframe(CCFloatKeyframe::create(1, 4, scoped_ptr<CCTimingFunction>()));
+ OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve::create());
+ curve->addKeyframe(CCFloatKeyframe::create(0, 2, nullptr));
+ curve->addKeyframe(CCFloatKeyframe::create(1, 4, nullptr));
EXPECT_FLOAT_EQ(2, curve->getValue(-1));
EXPECT_FLOAT_EQ(2, curve->getValue(0));
EXPECT_FLOAT_EQ(3, curve->getValue(0.5));
@@ -49,10 +50,10 @@
// Tests that a float animation with three keyframes works as expected.
TEST(CCKeyframedAnimationCurveTest, ThreeFloatKeyframe)
{
- 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>()));
+ 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));
EXPECT_FLOAT_EQ(2, curve->getValue(-1));
EXPECT_FLOAT_EQ(2, curve->getValue(0));
EXPECT_FLOAT_EQ(3, curve->getValue(0.5));
@@ -65,11 +66,11 @@
// Tests that a float animation with multiple keys at a given time works sanely.
TEST(CCKeyframedAnimationCurveTest, RepeatedFloatKeyTimes)
{
- 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>()));
+ 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));
EXPECT_FLOAT_EQ(4, curve->getValue(-1));
EXPECT_FLOAT_EQ(4, curve->getValue(0));
@@ -88,10 +89,10 @@
// Tests that a transform animation with one keyframe works as expected.
TEST(CCKeyframedAnimationCurveTest, OneTransformKeyframe)
{
- scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create());
+ OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create());
WebKit::WebTransformOperations operations;
operations.appendTranslate(2, 0, 0);
- curve->addKeyframe(CCTransformKeyframe::create(0, operations, scoped_ptr<CCTimingFunction>()));
+ curve->addKeyframe(CCTransformKeyframe::create(0, operations, nullptr));
expectTranslateX(2, curve->getValue(-1));
expectTranslateX(2, curve->getValue(0));
@@ -103,14 +104,14 @@
// Tests that a transform animation with two keyframes works as expected.
TEST(CCKeyframedAnimationCurveTest, TwoTransformKeyframe)
{
- scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create());
+ OwnPtr<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, scoped_ptr<CCTimingFunction>()));
- curve->addKeyframe(CCTransformKeyframe::create(1, operations2, scoped_ptr<CCTimingFunction>()));
+ curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr));
+ curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr));
expectTranslateX(2, curve->getValue(-1));
expectTranslateX(2, curve->getValue(0));
expectTranslateX(3, curve->getValue(0.5));
@@ -121,16 +122,16 @@
// Tests that a transform animation with three keyframes works as expected.
TEST(CCKeyframedAnimationCurveTest, ThreeTransformKeyframe)
{
- scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create());
+ OwnPtr<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, scoped_ptr<CCTimingFunction>()));
- curve->addKeyframe(CCTransformKeyframe::create(1, operations2, scoped_ptr<CCTimingFunction>()));
- curve->addKeyframe(CCTransformKeyframe::create(2, operations3, scoped_ptr<CCTimingFunction>()));
+ curve->addKeyframe(CCTransformKeyframe::create(0, operations1, nullptr));
+ curve->addKeyframe(CCTransformKeyframe::create(1, operations2, nullptr));
+ curve->addKeyframe(CCTransformKeyframe::create(2, operations3, nullptr));
expectTranslateX(2, curve->getValue(-1));
expectTranslateX(2, curve->getValue(0));
expectTranslateX(3, curve->getValue(0.5));
@@ -143,7 +144,7 @@
// Tests that a transform animation with multiple keys at a given time works sanely.
TEST(CCKeyframedAnimationCurveTest, RepeatedTransformKeyTimes)
{
- scoped_ptr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create());
+ OwnPtr<CCKeyframedTransformAnimationCurve> curve(CCKeyframedTransformAnimationCurve::create());
// A step function.
WebKit::WebTransformOperations operations1;
operations1.appendTranslate(4, 0, 0);
@@ -153,10 +154,10 @@
operations3.appendTranslate(6, 0, 0);
WebKit::WebTransformOperations operations4;
operations4.appendTranslate(6, 0, 0);
- 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>()));
+ 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));
expectTranslateX(4, curve->getValue(-1));
expectTranslateX(4, curve->getValue(0));
@@ -174,10 +175,10 @@
// Tests that the keyframes may be added out of order.
TEST(CCKeyframedAnimationCurveTest, UnsortedKeyframes)
{
- 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>()));
+ 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));
EXPECT_FLOAT_EQ(2, curve->getValue(-1));
EXPECT_FLOAT_EQ(2, curve->getValue(0));
EXPECT_FLOAT_EQ(3, curve->getValue(0.5));
@@ -190,9 +191,9 @@
// Tests that a cubic bezier timing function works as expected.
TEST(CCKeyframedAnimationCurveTest, CubicBezierTimingFunction)
{
- 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>()));
+ 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));
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