| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/animation/CompositorAnimation.h" | 5 #include "platform/animation/CompositorAnimation.h" |
| 6 | 6 |
| 7 #include "platform/animation/CompositorFloatAnimationCurve.h" | 7 #include "platform/animation/CompositorFloatAnimationCurve.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 TEST(WebCompositorAnimationTest, DefaultSettings) | 12 TEST(WebCompositorAnimationTest, DefaultSettings) |
| 13 { | 13 { |
| 14 std::unique_ptr<CompositorAnimationCurve> curve = CompositorFloatAnimationCu
rve::create(); | 14 OwnPtr<CompositorAnimationCurve> curve = CompositorFloatAnimationCurve::crea
te(); |
| 15 std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create
( | 15 OwnPtr<CompositorAnimation> animation = CompositorAnimation::create( |
| 16 *curve, CompositorTargetProperty::OPACITY, 1, 0); | 16 *curve, CompositorTargetProperty::OPACITY, 1, 0); |
| 17 | 17 |
| 18 // Ensure that the defaults are correct. | 18 // Ensure that the defaults are correct. |
| 19 EXPECT_EQ(1, animation->iterations()); | 19 EXPECT_EQ(1, animation->iterations()); |
| 20 EXPECT_EQ(0, animation->startTime()); | 20 EXPECT_EQ(0, animation->startTime()); |
| 21 EXPECT_EQ(0, animation->timeOffset()); | 21 EXPECT_EQ(0, animation->timeOffset()); |
| 22 EXPECT_EQ(CompositorAnimation::Direction::NORMAL, animation->getDirection())
; | 22 EXPECT_EQ(CompositorAnimation::Direction::NORMAL, animation->getDirection())
; |
| 23 } | 23 } |
| 24 | 24 |
| 25 TEST(WebCompositorAnimationTest, ModifiedSettings) | 25 TEST(WebCompositorAnimationTest, ModifiedSettings) |
| 26 { | 26 { |
| 27 std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimat
ionCurve::create(); | 27 OwnPtr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve:
:create(); |
| 28 std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create
( | 28 OwnPtr<CompositorAnimation> animation = CompositorAnimation::create( |
| 29 *curve, CompositorTargetProperty::OPACITY, 1, 0); | 29 *curve, CompositorTargetProperty::OPACITY, 1, 0); |
| 30 animation->setIterations(2); | 30 animation->setIterations(2); |
| 31 animation->setStartTime(2); | 31 animation->setStartTime(2); |
| 32 animation->setTimeOffset(2); | 32 animation->setTimeOffset(2); |
| 33 animation->setDirection(CompositorAnimation::Direction::REVERSE); | 33 animation->setDirection(CompositorAnimation::Direction::REVERSE); |
| 34 | 34 |
| 35 EXPECT_EQ(2, animation->iterations()); | 35 EXPECT_EQ(2, animation->iterations()); |
| 36 EXPECT_EQ(2, animation->startTime()); | 36 EXPECT_EQ(2, animation->startTime()); |
| 37 EXPECT_EQ(2, animation->timeOffset()); | 37 EXPECT_EQ(2, animation->timeOffset()); |
| 38 EXPECT_EQ(CompositorAnimation::Direction::REVERSE, animation->getDirection()
); | 38 EXPECT_EQ(CompositorAnimation::Direction::REVERSE, animation->getDirection()
); |
| 39 } | 39 } |
| 40 | 40 |
| 41 } // namespace blink | 41 } // namespace blink |
| OLD | NEW |