add a use_alsa gyp setting
[chromium-blink-merge.git] / cc / test / animation_test_common.h
blob95e427993db467fa30903b516f0f9280ebc77932
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"
13 namespace cc {
14 class LayerImpl;
15 class Layer;
18 namespace cc {
20 class FakeFloatAnimationCurve : public cc::FloatAnimationCurve {
21 public:
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;
30 private:
31 double m_duration;
34 class FakeTransformTransition : public cc::TransformAnimationCurve {
35 public:
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;
44 private:
45 double m_duration;
48 class FakeFloatTransition : public cc::FloatAnimationCurve {
49 public:
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;
58 private:
59 double m_duration;
60 float m_from;
61 float m_to;
64 class FakeLayerAnimationValueObserver : public cc::LayerAnimationValueObserver {
65 public:
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; }
77 private:
78 float m_opacity;
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);
91 } // namespace cc
93 #endif // CC_TEST_ANIMATION_TEST_COMMON_H_