Infer appropriate GNU_STACK alignment for a shared library.
[chromium-blink-merge.git] / cc / test / animation_test_common.h
blobb2909b8711fcf82da8238fc12bafed87bd00874f
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"
12 #include "cc/animation/layer_animation_value_provider.h"
13 #include "cc/output/filter_operations.h"
14 #include "cc/test/geometry_test_utils.h"
16 namespace cc {
17 class LayerImpl;
18 class Layer;
21 namespace cc {
23 class FakeFloatAnimationCurve : public FloatAnimationCurve {
24 public:
25 FakeFloatAnimationCurve();
26 explicit FakeFloatAnimationCurve(double duration);
27 ~FakeFloatAnimationCurve() override;
29 base::TimeDelta Duration() const override;
30 float GetValue(base::TimeDelta now) const override;
31 scoped_ptr<AnimationCurve> Clone() const override;
33 private:
34 base::TimeDelta duration_;
37 class FakeTransformTransition : public TransformAnimationCurve {
38 public:
39 explicit FakeTransformTransition(double duration);
40 ~FakeTransformTransition() override;
42 base::TimeDelta Duration() const override;
43 gfx::Transform GetValue(base::TimeDelta time) const override;
44 bool AnimatedBoundsForBox(const gfx::BoxF& box,
45 gfx::BoxF* bounds) const override;
46 bool AffectsScale() const override;
47 bool IsTranslation() const override;
48 bool PreservesAxisAlignment() const override;
49 bool MaximumTargetScale(bool forward_direction,
50 float* max_scale) const override;
52 scoped_ptr<AnimationCurve> Clone() const override;
54 private:
55 base::TimeDelta duration_;
58 class FakeFloatTransition : public FloatAnimationCurve {
59 public:
60 FakeFloatTransition(double duration, float from, float to);
61 ~FakeFloatTransition() override;
63 base::TimeDelta Duration() const override;
64 float GetValue(base::TimeDelta time) const override;
66 scoped_ptr<AnimationCurve> Clone() const override;
68 private:
69 base::TimeDelta duration_;
70 float from_;
71 float to_;
74 class FakeLayerAnimationValueObserver : public LayerAnimationValueObserver {
75 public:
76 FakeLayerAnimationValueObserver();
77 ~FakeLayerAnimationValueObserver() override;
79 // LayerAnimationValueObserver implementation
80 void OnFilterAnimated(const FilterOperations& filters) override;
81 void OnOpacityAnimated(float opacity) override;
82 void OnTransformAnimated(const gfx::Transform& transform) override;
83 void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) override;
84 void OnAnimationWaitingForDeletion() override;
85 bool IsActive() const override;
87 const FilterOperations& filters() const { return filters_; }
88 float opacity() const { return opacity_; }
89 const gfx::Transform& transform() const { return transform_; }
90 gfx::ScrollOffset scroll_offset() { return scroll_offset_; }
92 bool animation_waiting_for_deletion() {
93 return animation_waiting_for_deletion_;
96 private:
97 FilterOperations filters_;
98 float opacity_;
99 gfx::Transform transform_;
100 gfx::ScrollOffset scroll_offset_;
101 bool animation_waiting_for_deletion_;
104 class FakeInactiveLayerAnimationValueObserver
105 : public FakeLayerAnimationValueObserver {
106 public:
107 bool IsActive() const override;
110 class FakeLayerAnimationValueProvider : public LayerAnimationValueProvider {
111 public:
112 gfx::ScrollOffset ScrollOffsetForAnimation() const override;
114 void set_scroll_offset(const gfx::ScrollOffset& scroll_offset) {
115 scroll_offset_ = scroll_offset;
118 private:
119 gfx::ScrollOffset scroll_offset_;
122 int AddOpacityTransitionToController(LayerAnimationController* controller,
123 double duration,
124 float start_opacity,
125 float end_opacity,
126 bool use_timing_function);
128 int AddAnimatedTransformToController(LayerAnimationController* controller,
129 double duration,
130 int delta_x,
131 int delta_y);
133 int AddAnimatedFilterToController(LayerAnimationController* controller,
134 double duration,
135 float start_brightness,
136 float end_brightness);
138 int AddOpacityTransitionToLayer(Layer* layer,
139 double duration,
140 float start_opacity,
141 float end_opacity,
142 bool use_timing_function);
144 int AddOpacityTransitionToLayer(LayerImpl* layer,
145 double duration,
146 float start_opacity,
147 float end_opacity,
148 bool use_timing_function);
150 int AddAnimatedTransformToLayer(Layer* layer,
151 double duration,
152 int delta_x,
153 int delta_y);
155 int AddAnimatedTransformToLayer(LayerImpl* layer,
156 double duration,
157 int delta_x,
158 int delta_y);
160 int AddAnimatedTransformToLayer(Layer* layer,
161 double duration,
162 TransformOperations start_operations,
163 TransformOperations operations);
165 int AddAnimatedTransformToLayer(LayerImpl* layer,
166 double duration,
167 TransformOperations start_operations,
168 TransformOperations operations);
170 int AddAnimatedFilterToLayer(Layer* layer,
171 double duration,
172 float start_brightness,
173 float end_brightness);
175 int AddAnimatedFilterToLayer(LayerImpl* layer,
176 double duration,
177 float start_brightness,
178 float end_brightness);
180 } // namespace cc
182 #endif // CC_TEST_ANIMATION_TEST_COMMON_H_