diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-19 02:47:18 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-19 02:48:29 +0000 |
commit | 38564621b3363efe786f4f24000e663d832e4b9b (patch) | |
tree | 24e1efd151b4c718682a6cc3dc6a30cc829889cd /cc/blink/web_animation_unittest.cc | |
parent | 5d19fee72e4c6147fee799406b6b438002162b1f (diff) | |
download | chromium_src-38564621b3363efe786f4f24000e663d832e4b9b.zip chromium_src-38564621b3363efe786f4f24000e663d832e4b9b.tar.gz chromium_src-38564621b3363efe786f4f24000e663d832e4b9b.tar.bz2 |
Move blink<->cc bindings to cc/blink
These files provide the implementations of the public Blink API that
bind to the cc implementation. This moves them out of content/ into a
subdirectory of cc/ so that we can reuse these files in mojo which
can depend on cc/ and on blink but not on content/. To make sure we
don't introduce dependencies from cc/ on blink proper, cc/DEPS forbids
including cc/blink/ and cc/blink/DEPS allows using the blink headers.
cc_blink is built as a separate component to avoid linking anything from
blink into targets that don't care about the blink bindings (such as
the browser compositor).
R=darin@chromium.org
Review URL: https://codereview.chromium.org/470983004
Cr-Commit-Position: refs/heads/master@{#290464}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290464 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/blink/web_animation_unittest.cc')
-rw-r--r-- | cc/blink/web_animation_unittest.cc | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/cc/blink/web_animation_unittest.cc b/cc/blink/web_animation_unittest.cc new file mode 100644 index 0000000..cf9e05c --- /dev/null +++ b/cc/blink/web_animation_unittest.cc @@ -0,0 +1,60 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/memory/scoped_ptr.h" +#include "cc/blink/web_animation_impl.h" +#include "cc/blink/web_float_animation_curve_impl.h" +#include "testing/gtest/include/gtest/gtest.h" + +using blink::WebCompositorAnimation; +using blink::WebCompositorAnimationCurve; +using blink::WebFloatAnimationCurve; + +namespace cc_blink { +namespace { + +TEST(WebCompositorAnimationTest, DefaultSettings) { + scoped_ptr<WebCompositorAnimationCurve> curve( + new WebFloatAnimationCurveImpl()); + scoped_ptr<WebCompositorAnimation> animation(new WebCompositorAnimationImpl( + *curve, WebCompositorAnimation::TargetPropertyOpacity, 1, 0)); + + // Ensure that the defaults are correct. + EXPECT_EQ(1, animation->iterations()); + EXPECT_EQ(0, animation->startTime()); + EXPECT_EQ(0, animation->timeOffset()); +#if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION + EXPECT_EQ(WebCompositorAnimation::DirectionNormal, animation->direction()); +#else + EXPECT_FALSE(animation->alternatesDirection()); +#endif +} + +TEST(WebCompositorAnimationTest, ModifiedSettings) { + scoped_ptr<WebFloatAnimationCurve> curve(new WebFloatAnimationCurveImpl()); + scoped_ptr<WebCompositorAnimation> animation(new WebCompositorAnimationImpl( + *curve, WebCompositorAnimation::TargetPropertyOpacity, 1, 0)); + animation->setIterations(2); + animation->setStartTime(2); + animation->setTimeOffset(2); +#if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION + animation->setDirection(WebCompositorAnimation::DirectionReverse); +#else + animation->setAlternatesDirection(true); +#endif + + EXPECT_EQ(2, animation->iterations()); + EXPECT_EQ(2, animation->startTime()); + EXPECT_EQ(2, animation->timeOffset()); +#if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION + EXPECT_EQ(WebCompositorAnimation::DirectionReverse, animation->direction()); +#else + EXPECT_TRUE(animation->alternatesDirection()); + animation->setAlternatesDirection(false); + EXPECT_FALSE(animation->alternatesDirection()); +#endif +} + +} // namespace +} // namespace cc_blink |