| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "cc/blink/web_animation_impl.h" | 6 #include "cc/blink/web_animation_impl.h" |
| 7 #include "cc/blink/web_float_animation_curve_impl.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "third_party/WebKit/Source/platform/animation/WebFloatAnimationCurve.h" |
| 9 | 9 |
| 10 using blink::WebCompositorAnimation; | 10 using blink::WebCompositorAnimation; |
| 11 using blink::WebCompositorAnimationCurve; | 11 using blink::WebCompositorAnimationCurve; |
| 12 using blink::WebFloatAnimationCurve; | 12 using blink::WebFloatAnimationCurve; |
| 13 | 13 |
| 14 namespace cc_blink { | 14 namespace cc_blink { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 TEST(WebCompositorAnimationTest, DefaultSettings) { | 17 TEST(WebCompositorAnimationTest, DefaultSettings) { |
| 18 scoped_ptr<WebCompositorAnimationCurve> curve( | 18 scoped_ptr<WebCompositorAnimationCurve> curve(new WebFloatAnimationCurve()); |
| 19 new WebFloatAnimationCurveImpl()); | |
| 20 scoped_ptr<WebCompositorAnimation> animation(new WebCompositorAnimationImpl( | 19 scoped_ptr<WebCompositorAnimation> animation(new WebCompositorAnimationImpl( |
| 21 *curve, WebCompositorAnimation::TargetPropertyOpacity, 1, 0)); | 20 *curve, WebCompositorAnimation::TargetPropertyOpacity, 1, 0)); |
| 22 | 21 |
| 23 // Ensure that the defaults are correct. | 22 // Ensure that the defaults are correct. |
| 24 EXPECT_EQ(1, animation->iterations()); | 23 EXPECT_EQ(1, animation->iterations()); |
| 25 EXPECT_EQ(0, animation->startTime()); | 24 EXPECT_EQ(0, animation->startTime()); |
| 26 EXPECT_EQ(0, animation->timeOffset()); | 25 EXPECT_EQ(0, animation->timeOffset()); |
| 27 EXPECT_EQ(WebCompositorAnimation::DirectionNormal, animation->direction()); | 26 EXPECT_EQ(WebCompositorAnimation::DirectionNormal, animation->direction()); |
| 28 } | 27 } |
| 29 | 28 |
| 30 TEST(WebCompositorAnimationTest, ModifiedSettings) { | 29 TEST(WebCompositorAnimationTest, ModifiedSettings) { |
| 31 scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl()); | 30 scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurve()); |
| 32 scoped_ptr<WebCompositorAnimation> animation(new WebCompositorAnimationImpl( | 31 scoped_ptr<WebCompositorAnimation> animation(new WebCompositorAnimationImpl( |
| 33 *curve, WebCompositorAnimation::TargetPropertyOpacity, 1, 0)); | 32 *curve, WebCompositorAnimation::TargetPropertyOpacity, 1, 0)); |
| 34 animation->setIterations(2); | 33 animation->setIterations(2); |
| 35 animation->setStartTime(2); | 34 animation->setStartTime(2); |
| 36 animation->setTimeOffset(2); | 35 animation->setTimeOffset(2); |
| 37 animation->setDirection(WebCompositorAnimation::DirectionReverse); | 36 animation->setDirection(WebCompositorAnimation::DirectionReverse); |
| 38 | 37 |
| 39 EXPECT_EQ(2, animation->iterations()); | 38 EXPECT_EQ(2, animation->iterations()); |
| 40 EXPECT_EQ(2, animation->startTime()); | 39 EXPECT_EQ(2, animation->startTime()); |
| 41 EXPECT_EQ(2, animation->timeOffset()); | 40 EXPECT_EQ(2, animation->timeOffset()); |
| 42 EXPECT_EQ(WebCompositorAnimation::DirectionReverse, animation->direction()); | 41 EXPECT_EQ(WebCompositorAnimation::DirectionReverse, animation->direction()); |
| 43 } | 42 } |
| 44 | 43 |
| 45 } // namespace | 44 } // namespace |
| 46 } // namespace cc_blink | 45 } // namespace cc_blink |
| OLD | NEW |