OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 #include "webkit/compositor_bindings/web_animation_impl.h" | 7 #include "webkit/compositor_bindings/web_animation_impl.h" |
8 #include "webkit/compositor_bindings/web_float_animation_curve_impl.h" | 8 #include "webkit/compositor_bindings/web_float_animation_curve_impl.h" |
9 | 9 |
10 using namespace WebKit; | 10 using WebKit::WebAnimation; |
| 11 using WebKit::WebAnimationCurve; |
| 12 using WebKit::WebFloatAnimationCurve; |
11 | 13 |
| 14 namespace webkit { |
12 namespace { | 15 namespace { |
13 | 16 |
14 TEST(WebAnimationTest, DefaultSettings) { | 17 TEST(WebAnimationTest, DefaultSettings) { |
15 scoped_ptr<WebAnimationCurve> curve(new WebFloatAnimationCurveImpl()); | 18 scoped_ptr<WebAnimationCurve> curve(new WebFloatAnimationCurveImpl()); |
16 scoped_ptr<WebAnimation> animation( | 19 scoped_ptr<WebAnimation> animation( |
17 new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1)); | 20 new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1, 0)); |
18 | 21 |
19 // Ensure that the defaults are correct. | 22 // Ensure that the defaults are correct. |
20 EXPECT_EQ(1, animation->iterations()); | 23 EXPECT_EQ(1, animation->iterations()); |
21 EXPECT_EQ(0, animation->startTime()); | 24 EXPECT_EQ(0, animation->startTime()); |
22 EXPECT_EQ(0, animation->timeOffset()); | 25 EXPECT_EQ(0, animation->timeOffset()); |
23 EXPECT_FALSE(animation->alternatesDirection()); | 26 EXPECT_FALSE(animation->alternatesDirection()); |
24 } | 27 } |
25 | 28 |
26 TEST(WebAnimationTest, ModifiedSettings) { | 29 TEST(WebAnimationTest, ModifiedSettings) { |
27 scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl()); | 30 scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl()); |
28 scoped_ptr<WebAnimation> animation( | 31 scoped_ptr<WebAnimation> animation( |
29 new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1)); | 32 new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1, 0)); |
30 animation->setIterations(2); | 33 animation->setIterations(2); |
31 animation->setStartTime(2); | 34 animation->setStartTime(2); |
32 animation->setTimeOffset(2); | 35 animation->setTimeOffset(2); |
33 animation->setAlternatesDirection(true); | 36 animation->setAlternatesDirection(true); |
34 | 37 |
35 EXPECT_EQ(2, animation->iterations()); | 38 EXPECT_EQ(2, animation->iterations()); |
36 EXPECT_EQ(2, animation->startTime()); | 39 EXPECT_EQ(2, animation->startTime()); |
37 EXPECT_EQ(2, animation->timeOffset()); | 40 EXPECT_EQ(2, animation->timeOffset()); |
38 EXPECT_TRUE(animation->alternatesDirection()); | 41 EXPECT_TRUE(animation->alternatesDirection()); |
39 } | 42 } |
40 | 43 |
41 } // namespace | 44 } // namespace |
| 45 } // namespace webkit |
OLD | NEW |