Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: ui/views/animation/test/ink_drop_animation_test_api.h

Issue 1900283002: Added ui::test::MultiLayerAnimatorTestController and Delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated gn build. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 UI_VIEWS_ANIMATION_TEST_INK_DROP_ANIMATION_TEST_API_H_ 5 #ifndef UI_VIEWS_ANIMATION_TEST_INK_DROP_ANIMATION_TEST_API_H_
6 #define UI_VIEWS_ANIMATION_TEST_INK_DROP_ANIMATION_TEST_API_H_ 6 #define UI_VIEWS_ANIMATION_TEST_INK_DROP_ANIMATION_TEST_API_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "ui/compositor/test/multi_layer_animator_test_controller.h"
13 #include "ui/compositor/test/multi_layer_animator_test_controller_delegate.h"
12 14
13 namespace ui { 15 namespace ui {
14 class LayerAnimator; 16 class LayerAnimator;
15 } // namespace ui 17 } // namespace ui
16 18
17 namespace views { 19 namespace views {
18 class InkDropAnimation; 20 class InkDropAnimation;
19 21
20 namespace test { 22 namespace test {
21 23
22 // Base Test API used by test fixtures to validate all concrete implementations 24 // Base Test API used by test fixtures to validate all concrete implementations
23 // of the InkDropAnimation class. 25 // of the InkDropAnimation class.
24 class InkDropAnimationTestApi { 26 class InkDropAnimationTestApi
27 : public ui::test::MultiLayerAnimatorTestController,
28 public ui::test::MultiLayerAnimatorTestControllerDelegate {
25 public: 29 public:
26 explicit InkDropAnimationTestApi(InkDropAnimation* ink_drop_animation); 30 explicit InkDropAnimationTestApi(InkDropAnimation* ink_drop_animation);
27 virtual ~InkDropAnimationTestApi(); 31 ~InkDropAnimationTestApi() override;
28
29 // Disables the animation timers when |disable_timers| is true.
30 void SetDisableAnimationTimers(bool disable_timers);
31
32 // Returns true if any animations are active.
33 bool HasActiveAnimations() const;
34
35 // Completes all animations for all the Layer's owned by the InkDropAnimation.
36 void CompleteAnimations();
37 32
38 // Gets the opacity of the ink drop. 33 // Gets the opacity of the ink drop.
39 virtual float GetCurrentOpacity() const = 0; 34 virtual float GetCurrentOpacity() const = 0;
40 35
41 protected: 36 protected:
42 InkDropAnimation* ink_drop_animation() { 37 InkDropAnimation* ink_drop_animation() {
43 return static_cast<const InkDropAnimationTestApi*>(this) 38 return static_cast<const InkDropAnimationTestApi*>(this)
44 ->ink_drop_animation(); 39 ->ink_drop_animation();
45 } 40 }
46 41
47 InkDropAnimation* ink_drop_animation() const { return ink_drop_animation_; } 42 InkDropAnimation* ink_drop_animation() const { return ink_drop_animation_; }
48 43
49 // Get a list of all the LayerAnimator's used internally by the 44 // MultiLayerAnimatorTestControllerDelegate:
50 // InkDropAnimation. 45 std::vector<ui::LayerAnimator*> GetLayerAnimators() override;
51 std::vector<ui::LayerAnimator*> GetLayerAnimators();
52 virtual std::vector<ui::LayerAnimator*> GetLayerAnimators() const;
53 46
54 private: 47 private:
55 // Progresses all running LayerAnimationSequences by the given |duration|.
56 //
57 // NOTE: This function will NOT progress LayerAnimationSequences that are
58 // queued, only the running ones will be progressed.
59 void StepAnimations(const base::TimeDelta& duration);
60
61 // The InkDropedAnimation to provide internal access to. 48 // The InkDropedAnimation to provide internal access to.
62 InkDropAnimation* ink_drop_animation_; 49 InkDropAnimation* ink_drop_animation_;
63 50
64 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationTestApi); 51 DISALLOW_COPY_AND_ASSIGN(InkDropAnimationTestApi);
65 }; 52 };
66 53
67 } // namespace test 54 } // namespace test
68 } // namespace views 55 } // namespace views
69 56
70 #endif // UI_VIEWS_ANIMATION_TEST_INK_DROP_ANIMATION_TEST_API_H_ 57 #endif // UI_VIEWS_ANIMATION_TEST_INK_DROP_ANIMATION_TEST_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698