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

Side by Side Diff: webkit/renderer/compositor_bindings/web_animation_unittest.cc

Issue 227733004: Handle direction control in compositor Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new patch: fixes build failure in web_animation_unittest.cc Created 6 years, 8 months 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 unified diff | Download patch
OLDNEW
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/renderer/compositor_bindings/web_animation_impl.h" 7 #include "webkit/renderer/compositor_bindings/web_animation_impl.h"
8 #include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h" 8 #include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h"
9 9
10 using blink::WebAnimation; 10 using blink::WebAnimation;
11 using blink::WebAnimationCurve; 11 using blink::WebAnimationCurve;
12 using blink::WebFloatAnimationCurve; 12 using blink::WebFloatAnimationCurve;
13 13
14 namespace webkit { 14 namespace webkit {
15 namespace { 15 namespace {
16 16
17 TEST(WebAnimationTest, DefaultSettings) { 17 TEST(WebAnimationTest, DefaultSettings) {
18 scoped_ptr<WebAnimationCurve> curve(new WebFloatAnimationCurveImpl()); 18 scoped_ptr<WebAnimationCurve> curve(new WebFloatAnimationCurveImpl());
19 scoped_ptr<WebAnimation> animation( 19 scoped_ptr<WebAnimation> animation(
20 new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1, 0)); 20 new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1, 0));
21 21
22 // Ensure that the defaults are correct. 22 // Ensure that the defaults are correct.
23 EXPECT_EQ(1, animation->iterations()); 23 EXPECT_EQ(1, animation->iterations());
24 EXPECT_EQ(0, animation->startTime()); 24 EXPECT_EQ(0, animation->startTime());
25 EXPECT_EQ(0, animation->timeOffset()); 25 EXPECT_EQ(0, animation->timeOffset());
26 #if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION
27 EXPECT_EQ(WebAnimation::DirectionNormal, animation->direction());
28 #else
26 EXPECT_FALSE(animation->alternatesDirection()); 29 EXPECT_FALSE(animation->alternatesDirection());
30 #endif
27 } 31 }
28 32
29 TEST(WebAnimationTest, ModifiedSettings) { 33 TEST(WebAnimationTest, ModifiedSettings) {
30 scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl()); 34 scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl());
31 scoped_ptr<WebAnimation> animation( 35 scoped_ptr<WebAnimation> animation(
32 new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1, 0)); 36 new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1, 0));
33 animation->setIterations(2); 37 animation->setIterations(2);
34 animation->setStartTime(2); 38 animation->setStartTime(2);
35 animation->setTimeOffset(2); 39 animation->setTimeOffset(2);
40 #if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION
41 animation->setDirection(WebAnimation::DirectionReverse);
42 #else
36 animation->setAlternatesDirection(true); 43 animation->setAlternatesDirection(true);
44 #endif
37 45
38 EXPECT_EQ(2, animation->iterations()); 46 EXPECT_EQ(2, animation->iterations());
39 EXPECT_EQ(2, animation->startTime()); 47 EXPECT_EQ(2, animation->startTime());
40 EXPECT_EQ(2, animation->timeOffset()); 48 EXPECT_EQ(2, animation->timeOffset());
49 #if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION
50 EXPECT_EQ(WebAnimation::DirectionReverse, animation->direction());
51 #else
41 EXPECT_TRUE(animation->alternatesDirection()); 52 EXPECT_TRUE(animation->alternatesDirection());
53 #endif
42 } 54 }
43 55
44 } // namespace 56 } // namespace
45 } // namespace webkit 57 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698