Roll leveldb to r78 / 1.15.
[chromium-blink-merge.git] / webkit / renderer / compositor_bindings / web_animation_unittest.cc
blobe5be25a8860742a8f16862bc94f61865a9a1c5c4
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.
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"
10 using blink::WebAnimation;
11 using blink::WebAnimationCurve;
12 using blink::WebFloatAnimationCurve;
14 namespace webkit {
15 namespace {
17 TEST(WebAnimationTest, DefaultSettings) {
18 scoped_ptr<WebAnimationCurve> curve(new WebFloatAnimationCurveImpl());
19 scoped_ptr<WebAnimation> animation(
20 new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1, 0));
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 EXPECT_FALSE(animation->alternatesDirection());
29 TEST(WebAnimationTest, ModifiedSettings) {
30 scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl());
31 scoped_ptr<WebAnimation> animation(
32 new WebAnimationImpl(*curve, WebAnimation::TargetPropertyOpacity, 1, 0));
33 animation->setIterations(2);
34 animation->setStartTime(2);
35 animation->setTimeOffset(2);
36 animation->setAlternatesDirection(true);
38 EXPECT_EQ(2, animation->iterations());
39 EXPECT_EQ(2, animation->startTime());
40 EXPECT_EQ(2, animation->timeOffset());
41 EXPECT_TRUE(animation->alternatesDirection());
44 } // namespace
45 } // namespace webkit