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

Unified Diff: cc/keyframed_animation_curve_unittest.cc

Issue 11644004: Only create instances of WebTransformOperations using cc::TransformOperations::Create (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase, and fix WebTransformAnimationCurveImpl Created 8 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 side-by-side diff with in-line comments
Download patch
Index: cc/keyframed_animation_curve_unittest.cc
diff --git a/cc/keyframed_animation_curve_unittest.cc b/cc/keyframed_animation_curve_unittest.cc
index 0a0efdd5fcceece5673dca7ebf43fb0f447ebc69..49267d00328ee39ebd9f92a9ca5af42ea72a553a 100644
--- a/cc/keyframed_animation_curve_unittest.cc
+++ b/cc/keyframed_animation_curve_unittest.cc
@@ -4,6 +4,7 @@
#include "cc/keyframed_animation_curve.h"
+#include "cc/transform_operations.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebTransformOperations.h"
@@ -87,9 +88,10 @@ TEST(KeyframedAnimationCurveTest, RepeatedFloatKeyTimes)
TEST(KeyframedAnimationCurveTest, OneTransformKeyframe)
{
scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::create());
- WebKit::WebTransformOperations operations;
- operations.appendTranslate(2, 0, 0);
- curve->addKeyframe(TransformKeyframe::create(0, operations, scoped_ptr<TimingFunction>()));
+ scoped_ptr<WebKit::WebTransformOperations> operations(
+ TransformOperations::Create());
+ operations->appendTranslate(2, 0, 0);
+ curve->addKeyframe(TransformKeyframe::create(0, *operations, scoped_ptr<TimingFunction>()));
expectTranslateX(2, curve->getValue(-1));
expectTranslateX(2, curve->getValue(0));
@@ -102,13 +104,15 @@ TEST(KeyframedAnimationCurveTest, OneTransformKeyframe)
TEST(KeyframedAnimationCurveTest, TwoTransformKeyframe)
{
scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::create());
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(2, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(4, 0, 0);
-
- curve->addKeyframe(TransformKeyframe::create(0, operations1, scoped_ptr<TimingFunction>()));
- curve->addKeyframe(TransformKeyframe::create(1, operations2, scoped_ptr<TimingFunction>()));
+ scoped_ptr<WebKit::WebTransformOperations> operations1(
+ TransformOperations::Create());
+ operations1->appendTranslate(2, 0, 0);
+ scoped_ptr<WebKit::WebTransformOperations> operations2(
+ TransformOperations::Create());
+ operations2->appendTranslate(4, 0, 0);
+
+ curve->addKeyframe(TransformKeyframe::create(0, *operations1, scoped_ptr<TimingFunction>()));
+ curve->addKeyframe(TransformKeyframe::create(1, *operations2, scoped_ptr<TimingFunction>()));
expectTranslateX(2, curve->getValue(-1));
expectTranslateX(2, curve->getValue(0));
expectTranslateX(3, curve->getValue(0.5));
@@ -120,15 +124,18 @@ TEST(KeyframedAnimationCurveTest, TwoTransformKeyframe)
TEST(KeyframedAnimationCurveTest, ThreeTransformKeyframe)
{
scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::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(TransformKeyframe::create(0, operations1, scoped_ptr<TimingFunction>()));
- curve->addKeyframe(TransformKeyframe::create(1, operations2, scoped_ptr<TimingFunction>()));
- curve->addKeyframe(TransformKeyframe::create(2, operations3, scoped_ptr<TimingFunction>()));
+ scoped_ptr<WebKit::WebTransformOperations> operations1(
+ TransformOperations::Create());
+ operations1->appendTranslate(2, 0, 0);
+ scoped_ptr<WebKit::WebTransformOperations> operations2(
+ TransformOperations::Create());
+ operations2->appendTranslate(4, 0, 0);
+ scoped_ptr<WebKit::WebTransformOperations> operations3(
+ TransformOperations::Create());
+ operations3->appendTranslate(8, 0, 0);
+ curve->addKeyframe(TransformKeyframe::create(0, *operations1, scoped_ptr<TimingFunction>()));
+ curve->addKeyframe(TransformKeyframe::create(1, *operations2, scoped_ptr<TimingFunction>()));
+ curve->addKeyframe(TransformKeyframe::create(2, *operations3, scoped_ptr<TimingFunction>()));
expectTranslateX(2, curve->getValue(-1));
expectTranslateX(2, curve->getValue(0));
expectTranslateX(3, curve->getValue(0.5));
@@ -143,18 +150,22 @@ TEST(KeyframedAnimationCurveTest, RepeatedTransformKeyTimes)
{
scoped_ptr<KeyframedTransformAnimationCurve> curve(KeyframedTransformAnimationCurve::create());
// A step function.
- WebKit::WebTransformOperations operations1;
- operations1.appendTranslate(4, 0, 0);
- WebKit::WebTransformOperations operations2;
- operations2.appendTranslate(4, 0, 0);
- WebKit::WebTransformOperations operations3;
- operations3.appendTranslate(6, 0, 0);
- WebKit::WebTransformOperations operations4;
- operations4.appendTranslate(6, 0, 0);
- curve->addKeyframe(TransformKeyframe::create(0, operations1, scoped_ptr<TimingFunction>()));
- curve->addKeyframe(TransformKeyframe::create(1, operations2, scoped_ptr<TimingFunction>()));
- curve->addKeyframe(TransformKeyframe::create(1, operations3, scoped_ptr<TimingFunction>()));
- curve->addKeyframe(TransformKeyframe::create(2, operations4, scoped_ptr<TimingFunction>()));
+ scoped_ptr<WebKit::WebTransformOperations> operations1(
+ TransformOperations::Create());
+ operations1->appendTranslate(4, 0, 0);
+ scoped_ptr<WebKit::WebTransformOperations> operations2(
+ TransformOperations::Create());
+ operations2->appendTranslate(4, 0, 0);
+ scoped_ptr<WebKit::WebTransformOperations> operations3(
+ TransformOperations::Create());
+ operations3->appendTranslate(6, 0, 0);
+ scoped_ptr<WebKit::WebTransformOperations> operations4(
+ TransformOperations::Create());
+ operations4->appendTranslate(6, 0, 0);
+ curve->addKeyframe(TransformKeyframe::create(0, *operations1, scoped_ptr<TimingFunction>()));
+ curve->addKeyframe(TransformKeyframe::create(1, *operations2, scoped_ptr<TimingFunction>()));
+ curve->addKeyframe(TransformKeyframe::create(1, *operations3, scoped_ptr<TimingFunction>()));
+ curve->addKeyframe(TransformKeyframe::create(2, *operations4, scoped_ptr<TimingFunction>()));
expectTranslateX(4, curve->getValue(-1));
expectTranslateX(4, curve->getValue(0));

Powered by Google App Engine
This is Rietveld 408576698