OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ | 5 #ifndef CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ |
6 #define CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ | 6 #define CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <unordered_map> | 9 #include <unordered_map> |
9 | 10 |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "cc/animation/animation.h" | 11 #include "cc/animation/animation.h" |
12 #include "cc/animation/animation_delegate.h" | 12 #include "cc/animation/animation_delegate.h" |
13 #include "cc/animation/animation_host.h" | 13 #include "cc/animation/animation_host.h" |
14 #include "cc/trees/mutator_host_client.h" | 14 #include "cc/trees/mutator_host_client.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "ui/gfx/geometry/scroll_offset.h" | 16 #include "ui/gfx/geometry/scroll_offset.h" |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 | 19 |
20 class TestLayer { | 20 class TestLayer { |
21 public: | 21 public: |
22 static scoped_ptr<TestLayer> Create(); | 22 static std::unique_ptr<TestLayer> Create(); |
23 | 23 |
24 void ClearMutatedProperties(); | 24 void ClearMutatedProperties(); |
25 | 25 |
26 int transform_x() const { return transform_x_; } | 26 int transform_x() const { return transform_x_; } |
27 int transform_y() const { return transform_y_; } | 27 int transform_y() const { return transform_y_; } |
28 | 28 |
29 void set_transform(int transform_x, int transform_y) { | 29 void set_transform(int transform_x, int transform_y) { |
30 transform_x_ = transform_x; | 30 transform_x_ = transform_x; |
31 transform_y_ = transform_y; | 31 transform_y_ = transform_y; |
32 mutated_properties_[TargetProperty::TRANSFORM] = true; | 32 mutated_properties_[TargetProperty::TRANSFORM] = true; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 LayerTreeType tree_type, | 126 LayerTreeType tree_type, |
127 float opacity) const; | 127 float opacity) const; |
128 void ExpectTransformPropertyMutated(int layer_id, | 128 void ExpectTransformPropertyMutated(int layer_id, |
129 LayerTreeType tree_type, | 129 LayerTreeType tree_type, |
130 int transform_x, | 130 int transform_x, |
131 int transform_y) const; | 131 int transform_y) const; |
132 | 132 |
133 TestLayer* FindTestLayer(int layer_id, LayerTreeType tree_type) const; | 133 TestLayer* FindTestLayer(int layer_id, LayerTreeType tree_type) const; |
134 | 134 |
135 private: | 135 private: |
136 scoped_ptr<AnimationHost> host_; | 136 std::unique_ptr<AnimationHost> host_; |
137 | 137 |
138 using LayerIdToTestLayer = std::unordered_map<int, scoped_ptr<TestLayer>>; | 138 using LayerIdToTestLayer = |
| 139 std::unordered_map<int, std::unique_ptr<TestLayer>>; |
139 LayerIdToTestLayer layers_in_active_tree_; | 140 LayerIdToTestLayer layers_in_active_tree_; |
140 LayerIdToTestLayer layers_in_pending_tree_; | 141 LayerIdToTestLayer layers_in_pending_tree_; |
141 | 142 |
142 bool mutators_need_commit_; | 143 bool mutators_need_commit_; |
143 }; | 144 }; |
144 | 145 |
145 class TestAnimationDelegate : public AnimationDelegate { | 146 class TestAnimationDelegate : public AnimationDelegate { |
146 public: | 147 public: |
147 TestAnimationDelegate(); | 148 TestAnimationDelegate(); |
148 | 149 |
149 void NotifyAnimationStarted(base::TimeTicks monotonic_time, | 150 void NotifyAnimationStarted(base::TimeTicks monotonic_time, |
150 TargetProperty::Type target_property, | 151 TargetProperty::Type target_property, |
151 int group) override; | 152 int group) override; |
152 void NotifyAnimationFinished(base::TimeTicks monotonic_time, | 153 void NotifyAnimationFinished(base::TimeTicks monotonic_time, |
153 TargetProperty::Type target_property, | 154 TargetProperty::Type target_property, |
154 int group) override; | 155 int group) override; |
155 void NotifyAnimationAborted(base::TimeTicks monotonic_time, | 156 void NotifyAnimationAborted(base::TimeTicks monotonic_time, |
156 TargetProperty::Type target_property, | 157 TargetProperty::Type target_property, |
157 int group) override {} | 158 int group) override {} |
158 void NotifyAnimationTakeover(base::TimeTicks monotonic_time, | 159 void NotifyAnimationTakeover(base::TimeTicks monotonic_time, |
159 TargetProperty::Type target_property, | 160 TargetProperty::Type target_property, |
160 double animation_start_time, | 161 double animation_start_time, |
161 scoped_ptr<AnimationCurve> curve) override {} | 162 std::unique_ptr<AnimationCurve> curve) override { |
| 163 } |
162 bool started_; | 164 bool started_; |
163 bool finished_; | 165 bool finished_; |
164 }; | 166 }; |
165 | 167 |
166 class AnimationTimelinesTest : public testing::Test { | 168 class AnimationTimelinesTest : public testing::Test { |
167 public: | 169 public: |
168 AnimationTimelinesTest(); | 170 AnimationTimelinesTest(); |
169 ~AnimationTimelinesTest() override; | 171 ~AnimationTimelinesTest() override; |
170 | 172 |
171 protected: | 173 protected: |
(...skipping 27 matching lines...) Expand all Loading... |
199 scoped_refptr<AnimationTimeline> timeline_; | 201 scoped_refptr<AnimationTimeline> timeline_; |
200 scoped_refptr<AnimationPlayer> player_; | 202 scoped_refptr<AnimationPlayer> player_; |
201 | 203 |
202 scoped_refptr<AnimationTimeline> timeline_impl_; | 204 scoped_refptr<AnimationTimeline> timeline_impl_; |
203 scoped_refptr<AnimationPlayer> player_impl_; | 205 scoped_refptr<AnimationPlayer> player_impl_; |
204 }; | 206 }; |
205 | 207 |
206 } // namespace cc | 208 } // namespace cc |
207 | 209 |
208 #endif // CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ | 210 #endif // CC_TEST_ANIMATION_TIMELINES_TEST_COMMON_H_ |
OLD | NEW |