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 #ifndef CC_TEST_ANIMATION_TEST_COMMON_H_
6 #define CC_TEST_ANIMATION_TEST_COMMON_H_
8 #include "cc/animation.h"
9 #include "cc/animation_curve.h"
10 #include "cc/layer_animation_controller.h"
11 #include "cc/layer_animation_value_observer.h"
20 class FakeFloatAnimationCurve
: public cc::FloatAnimationCurve
{
22 FakeFloatAnimationCurve();
23 explicit FakeFloatAnimationCurve(double duration
);
24 virtual ~FakeFloatAnimationCurve();
26 virtual double duration() const OVERRIDE
;
27 virtual float getValue(double now
) const OVERRIDE
;
28 virtual scoped_ptr
<cc::AnimationCurve
> clone() const OVERRIDE
;
34 class FakeTransformTransition
: public cc::TransformAnimationCurve
{
36 FakeTransformTransition(double duration
);
37 virtual ~FakeTransformTransition();
39 virtual double duration() const OVERRIDE
;
40 virtual gfx::Transform
getValue(double time
) const OVERRIDE
;
42 virtual scoped_ptr
<cc::AnimationCurve
> clone() const OVERRIDE
;
48 class FakeFloatTransition
: public cc::FloatAnimationCurve
{
50 FakeFloatTransition(double duration
, float from
, float to
);
51 virtual ~FakeFloatTransition();
53 virtual double duration() const OVERRIDE
;
54 virtual float getValue(double time
) const OVERRIDE
;
56 virtual scoped_ptr
<cc::AnimationCurve
> clone() const OVERRIDE
;
64 class FakeLayerAnimationValueObserver
: public cc::LayerAnimationValueObserver
{
66 FakeLayerAnimationValueObserver();
67 virtual ~FakeLayerAnimationValueObserver();
69 // LayerAnimationValueObserver implementation
70 virtual void OnOpacityAnimated(float) OVERRIDE
;
71 virtual void OnTransformAnimated(const gfx::Transform
&) OVERRIDE
;
72 virtual bool IsActive() const OVERRIDE
;
74 float opacity() const { return m_opacity
; }
75 const gfx::Transform
& transform() const { return m_transform
; }
79 gfx::Transform m_transform
;
82 int addOpacityTransitionToController(cc::LayerAnimationController
&, double duration
, float startOpacity
, float endOpacity
, bool useTimingFunction
);
83 int addAnimatedTransformToController(cc::LayerAnimationController
&, double duration
, int deltaX
, int deltaY
);
85 int addOpacityTransitionToLayer(cc::Layer
&, double duration
, float startOpacity
, float endOpacity
, bool useTimingFunction
);
86 int addOpacityTransitionToLayer(cc::LayerImpl
&, double duration
, float startOpacity
, float endOpacity
, bool useTimingFunction
);
88 int addAnimatedTransformToLayer(cc::Layer
&, double duration
, int deltaX
, int deltaY
);
89 int addAnimatedTransformToLayer(cc::LayerImpl
&, double duration
, int deltaX
, int deltaY
);
93 #endif // CC_TEST_ANIMATION_TEST_COMMON_H_