OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ASH_TEST_TEST_SESSION_STATE_ANIMATOR_H_ | 5 #ifndef ASH_TEST_TEST_SESSION_STATE_ANIMATOR_H_ |
6 #define ASH_TEST_TEST_SESSION_STATE_ANIMATOR_H_ | 6 #define ASH_TEST_TEST_SESSION_STATE_ANIMATOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
12 #include "ash/wm/session_state_animator.h" | 12 #include "ash/wm/session_state_animator.h" |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 namespace test { | 17 namespace test { |
18 | 18 |
19 // A SessionStateAnimator that offers control over the lifetime of active | 19 // A SessionStateAnimator that offers control over the lifetime of active |
20 // animations. | 20 // animations. |
21 // NOTE: The TestSessionStateAnimator limits each | 21 // NOTE: The TestSessionStateAnimator limits each |
22 // SessionStateAnimator::Container to a single active animation at any one time. | 22 // SessionStateAnimator::Container to a single active animation at any one time. |
23 // If a new animation is started on a container the existing one will be | 23 // If a new animation is started on a container the existing one will be |
24 // aborted. | 24 // aborted. |
25 class TestSessionStateAnimator : public SessionStateAnimator { | 25 class TestSessionStateAnimator : public SessionStateAnimator { |
26 public: | 26 public: |
27 TestSessionStateAnimator(); | 27 TestSessionStateAnimator(); |
28 virtual ~TestSessionStateAnimator(); | 28 ~TestSessionStateAnimator() override; |
29 | 29 |
30 int last_animation_epoch() { | 30 int last_animation_epoch() { |
31 return last_animation_epoch_; | 31 return last_animation_epoch_; |
32 } | 32 } |
33 | 33 |
34 // Resets the current animation epoch back to 0 and aborts all currently | 34 // Resets the current animation epoch back to 0 and aborts all currently |
35 // active animations. | 35 // active animations. |
36 void ResetAnimationEpoch(); | 36 void ResetAnimationEpoch(); |
37 | 37 |
38 // Advances all contained animations by the specified |duration|. Any | 38 // Advances all contained animations by the specified |duration|. Any |
(...skipping 18 matching lines...) Expand all Loading... |
57 | 57 |
58 // Returns true if there is an animation active with |type| for all the given | 58 // Returns true if there is an animation active with |type| for all the given |
59 // containers specified by |container_mask|. | 59 // containers specified by |container_mask|. |
60 bool AreContainersAnimated(int container_mask, | 60 bool AreContainersAnimated(int container_mask, |
61 SessionStateAnimator::AnimationType type) const; | 61 SessionStateAnimator::AnimationType type) const; |
62 | 62 |
63 // Returns the number of active animations. | 63 // Returns the number of active animations. |
64 size_t GetAnimationCount() const; | 64 size_t GetAnimationCount() const; |
65 | 65 |
66 // ash::SessionStateAnimator: | 66 // ash::SessionStateAnimator: |
67 virtual void StartAnimation(int container_mask, | 67 void StartAnimation(int container_mask, |
68 AnimationType type, | 68 AnimationType type, |
69 AnimationSpeed speed) override; | 69 AnimationSpeed speed) override; |
70 virtual void StartAnimationWithCallback( | 70 void StartAnimationWithCallback(int container_mask, |
71 int container_mask, | 71 AnimationType type, |
72 AnimationType type, | 72 AnimationSpeed speed, |
73 AnimationSpeed speed, | 73 base::Closure callback) override; |
74 base::Closure callback) override; | 74 AnimationSequence* BeginAnimationSequence(base::Closure callback) override; |
75 virtual AnimationSequence* BeginAnimationSequence( | 75 bool IsBackgroundHidden() const override; |
76 base::Closure callback) override; | 76 void ShowBackground() override; |
77 virtual bool IsBackgroundHidden() const override; | 77 void HideBackground() override; |
78 virtual void ShowBackground() override; | |
79 virtual void HideBackground() override; | |
80 | 78 |
81 private: | 79 private: |
82 class AnimationSequence; | 80 class AnimationSequence; |
83 friend class AnimationSequence; | 81 friend class AnimationSequence; |
84 | 82 |
85 // Data structure to track the currently active animations and their | 83 // Data structure to track the currently active animations and their |
86 // callbacks. | 84 // callbacks. |
87 struct ActiveAnimation { | 85 struct ActiveAnimation { |
88 ActiveAnimation( | 86 ActiveAnimation( |
89 int animation_epoch, | 87 int animation_epoch, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Tracks whether the background is hidden or not. | 155 // Tracks whether the background is hidden or not. |
158 bool is_background_hidden_; | 156 bool is_background_hidden_; |
159 | 157 |
160 DISALLOW_COPY_AND_ASSIGN(TestSessionStateAnimator); | 158 DISALLOW_COPY_AND_ASSIGN(TestSessionStateAnimator); |
161 }; | 159 }; |
162 | 160 |
163 } // namespace test | 161 } // namespace test |
164 } // namespace ash | 162 } // namespace ash |
165 | 163 |
166 #endif // ASH_TEST_TEST_SESSION_STATE_ANIMATOR_H_ | 164 #endif // ASH_TEST_TEST_SESSION_STATE_ANIMATOR_H_ |
OLD | NEW |