| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_TEST_INK_DROP_ANIMATION_OBSERVER_H_ | 5 #ifndef UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_RIPPLE_OBSERVER_H_ |
| 6 #define UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_ANIMATION_OBSERVER_H_ | 6 #define UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_RIPPLE_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/views/animation/ink_drop_animation_observer.h" | 9 #include "ui/views/animation/ink_drop_ripple_observer.h" |
| 10 #include "ui/views/animation/ink_drop_state.h" | 10 #include "ui/views/animation/ink_drop_state.h" |
| 11 #include "ui/views/animation/test/test_ink_drop_animation_observer_helper.h" | 11 #include "ui/views/animation/test/test_ink_drop_animation_observer_helper.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 class InkDropAnimation; | 14 class InkDropRipple; |
| 15 | 15 |
| 16 namespace test { | 16 namespace test { |
| 17 | 17 |
| 18 // Simple InkDropAnimationObserver test double that tracks if | 18 // Simple InkDropRippleObserver test double that tracks if InkDropRippleObserver |
| 19 // InkDropAnimationObserver methods are invoked and the parameters used for the | 19 // methods are invoked and the parameters used for the last invocation. |
| 20 // last invocation. | 20 class TestInkDropRippleObserver |
| 21 class TestInkDropAnimationObserver | 21 : public InkDropRippleObserver, |
| 22 : public InkDropAnimationObserver, | |
| 23 public TestInkDropAnimationObserverHelper<InkDropState> { | 22 public TestInkDropAnimationObserverHelper<InkDropState> { |
| 24 public: | 23 public: |
| 25 TestInkDropAnimationObserver(); | 24 TestInkDropRippleObserver(); |
| 26 ~TestInkDropAnimationObserver() override; | 25 ~TestInkDropRippleObserver() override; |
| 27 | 26 |
| 28 void set_ink_drop_animation(InkDropAnimation* ink_drop_animation) { | 27 void set_ink_drop_ripple(InkDropRipple* ink_drop_ripple) { |
| 29 ink_drop_animation_ = ink_drop_animation; | 28 ink_drop_ripple_ = ink_drop_ripple; |
| 30 } | 29 } |
| 31 | 30 |
| 32 InkDropState target_state_at_last_animation_started() const { | 31 InkDropState target_state_at_last_animation_started() const { |
| 33 return target_state_at_last_animation_started_; | 32 return target_state_at_last_animation_started_; |
| 34 } | 33 } |
| 35 | 34 |
| 36 InkDropState target_state_at_last_animation_ended() const { | 35 InkDropState target_state_at_last_animation_ended() const { |
| 37 return target_state_at_last_animation_ended_; | 36 return target_state_at_last_animation_ended_; |
| 38 } | 37 } |
| 39 | 38 |
| 40 // InkDropAnimationObserver: | 39 // InkDropRippleObserver: |
| 41 void AnimationStarted(InkDropState ink_drop_state) override; | 40 void AnimationStarted(InkDropState ink_drop_state) override; |
| 42 void AnimationEnded(InkDropState ink_drop_state, | 41 void AnimationEnded(InkDropState ink_drop_state, |
| 43 InkDropAnimationEndedReason reason) override; | 42 InkDropAnimationEndedReason reason) override; |
| 44 | 43 |
| 45 private: | 44 private: |
| 46 // The type this inherits from. Reduces verbosity in .cc file. | 45 // The type this inherits from. Reduces verbosity in .cc file. |
| 47 using ObserverHelper = TestInkDropAnimationObserverHelper<InkDropState>; | 46 using ObserverHelper = TestInkDropAnimationObserverHelper<InkDropState>; |
| 48 | 47 |
| 49 // The value of InkDropAnimation::GetTargetInkDropState() the last time an | 48 // The value of InkDropRipple::GetTargetInkDropState() the last time an |
| 50 // InkDropAnimationStarted() event was handled. This is only valid if | 49 // AnimationStarted() event was handled. This is only valid if |
| 51 // |ink_drop_animation_| is not null. | 50 // |ink_drop_ripple_| is not null. |
| 52 InkDropState target_state_at_last_animation_started_; | 51 InkDropState target_state_at_last_animation_started_; |
| 53 | 52 |
| 54 // The value of InkDropAnimation::GetTargetInkDropState() the last time an | 53 // The value of InkDropRipple::GetTargetInkDropState() the last time an |
| 55 // AnimationEnded() event was handled. This is only valid if | 54 // AnimationEnded() event was handled. This is only valid if |
| 56 // |ink_drop_animation_| is not null. | 55 // |ink_drop_ripple_| is not null. |
| 57 InkDropState target_state_at_last_animation_ended_; | 56 InkDropState target_state_at_last_animation_ended_; |
| 58 | 57 |
| 59 // An InkDropAnimation to spy info from when notifications are handled. | 58 // An InkDropRipple to spy info from when notifications are handled. |
| 60 InkDropAnimation* ink_drop_animation_; | 59 InkDropRipple* ink_drop_ripple_; |
| 61 | 60 |
| 62 DISALLOW_COPY_AND_ASSIGN(TestInkDropAnimationObserver); | 61 DISALLOW_COPY_AND_ASSIGN(TestInkDropRippleObserver); |
| 63 }; | 62 }; |
| 64 | 63 |
| 65 } // namespace test | 64 } // namespace test |
| 66 } // namespace views | 65 } // namespace views |
| 67 | 66 |
| 68 #endif // UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_ANIMATION_OBSERVER_H_ | 67 #endif // UI_VIEWS_ANIMATION_TEST_TEST_INK_DROP_RIPPLE_OBSERVER_H_ |
| OLD | NEW |