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