cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / cc / test / animation_test_common.h
blob4d3efa61df1761e556314013d5ea685644e4b789
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/animation.h"
9 #include "cc/animation/animation_curve.h"
10 #include "cc/animation/layer_animation_controller.h"
11 #include "cc/animation/layer_animation_value_observer.h"
13 namespace cc {
14 class LayerImpl;
15 class Layer;
18 namespace cc {
20 class FakeFloatAnimationCurve : public 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<AnimationCurve> Clone() const OVERRIDE;
30 private:
31 double duration_;
34 class FakeTransformTransition : public TransformAnimationCurve {
35 public:
36 explicit FakeTransformTransition(double duration);
37 virtual ~FakeTransformTransition();
39 virtual double Duration() const OVERRIDE;
40 virtual gfx::Transform GetValue(double time) const OVERRIDE;
41 virtual bool AnimatedBoundsForBox(const gfx::BoxF& box,
42 gfx::BoxF* bounds) const OVERRIDE;
44 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
46 private:
47 double duration_;
50 class FakeFloatTransition : public FloatAnimationCurve {
51 public:
52 FakeFloatTransition(double duration, float from, float to);
53 virtual ~FakeFloatTransition();
55 virtual double Duration() const OVERRIDE;
56 virtual float GetValue(double time) const OVERRIDE;
58 virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE;
60 private:
61 double duration_;
62 float from_;
63 float to_;
66 class FakeLayerAnimationValueObserver : public LayerAnimationValueObserver {
67 public:
68 FakeLayerAnimationValueObserver();
69 virtual ~FakeLayerAnimationValueObserver();
71 // LayerAnimationValueObserver implementation
72 virtual void OnOpacityAnimated(float opacity) OVERRIDE;
73 virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE;
74 virtual bool IsActive() const OVERRIDE;
76 float opacity() const { return opacity_; }
77 const gfx::Transform& transform() const { return transform_; }
79 private:
80 float opacity_;
81 gfx::Transform transform_;
84 class FakeInactiveLayerAnimationValueObserver
85 : public FakeLayerAnimationValueObserver {
86 public:
87 virtual bool IsActive() const OVERRIDE;
90 int AddOpacityTransitionToController(LayerAnimationController* controller,
91 double duration,
92 float start_opacity,
93 float end_opacity,
94 bool use_timing_function);
96 int AddAnimatedTransformToController(LayerAnimationController* controller,
97 double duration,
98 int delta_x,
99 int delta_y);
101 int AddOpacityTransitionToLayer(Layer* layer,
102 double duration,
103 float start_opacity,
104 float end_opacity,
105 bool use_timing_function);
107 int AddOpacityTransitionToLayer(LayerImpl* layer,
108 double duration,
109 float start_opacity,
110 float end_opacity,
111 bool use_timing_function);
113 int AddAnimatedTransformToLayer(Layer* layer,
114 double duration,
115 int delta_x,
116 int delta_y);
118 int AddAnimatedTransformToLayer(LayerImpl* layer,
119 double duration,
120 int delta_x,
121 int delta_y);
123 } // namespace cc
125 #endif // CC_TEST_ANIMATION_TEST_COMMON_H_