OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/memory/scoped_ptr.h" | |
6 #include "testing/gtest/include/gtest/gtest.h" | |
7 #include "webkit/renderer/compositor_bindings/web_animation_impl.h" | |
8 #include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h" | |
9 | |
10 using blink::WebAnimation; | |
11 using blink::WebAnimationCurve; | |
12 using blink::WebFloatAnimationCurve; | |
13 | |
14 namespace webkit { | |
15 namespace { | |
16 | |
17 TEST(WebAnimationTest, DefaultSettings) { | |
18 scoped_ptr<WebAnimationCurve> curve(new WebFloatAnimationCurveImpl()); | |
19 scoped_ptr<WebAnimation> animation( | |
20 new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1, 0)); | |
21 | |
22 // Ensure that the defaults are correct. | |
23 EXPECT_EQ(1, animation->iterations()); | |
24 EXPECT_EQ(0, animation->startTime()); | |
25 EXPECT_EQ(0, animation->timeOffset()); | |
26 #if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION | |
27 EXPECT_EQ(WebAnimation::DirectionNormal, animation->direction()); | |
28 #else | |
29 EXPECT_FALSE(animation->alternatesDirection()); | |
30 #endif | |
31 } | |
32 | |
33 TEST(WebAnimationTest, ModifiedSettings) { | |
34 scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl()); | |
35 scoped_ptr<WebAnimation> animation( | |
36 new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1, 0)); | |
37 animation->setIterations(2); | |
38 animation->setStartTime(2); | |
39 animation->setTimeOffset(2); | |
40 #if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION | |
41 animation->setDirection(WebAnimation::DirectionReverse); | |
42 #else | |
43 animation->setAlternatesDirection(true); | |
44 #endif | |
45 | |
46 EXPECT_EQ(2, animation->iterations()); | |
47 EXPECT_EQ(2, animation->startTime()); | |
48 EXPECT_EQ(2, animation->timeOffset()); | |
49 #if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION | |
50 EXPECT_EQ(WebAnimation::DirectionReverse, animation->direction()); | |
51 #else | |
52 EXPECT_TRUE(animation->alternatesDirection()); | |
53 animation->setAlternatesDirection(false); | |
54 EXPECT_FALSE(animation->alternatesDirection()); | |
55 #endif | |
56 } | |
57 | |
58 } // namespace | |
59 } // namespace webkit | |
OLD | NEW |