| 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 #include "ui/views/animation/test/test_ink_drop_ripple_observer.h" | 5 #include "ui/views/animation/test/test_ink_drop_ripple_observer.h" |
| 6 | 6 |
| 7 #include "ui/views/animation/ink_drop_ripple.h" | 7 #include "ui/views/animation/ink_drop_ripple.h" |
| 8 | 8 |
| 9 namespace views { | 9 namespace views { |
| 10 namespace test { | 10 namespace test { |
| 11 | 11 |
| 12 TestInkDropRippleObserver::TestInkDropRippleObserver() | 12 TestInkDropRippleObserver::TestInkDropRippleObserver() |
| 13 : target_state_at_last_animation_started_(InkDropState::HIDDEN), | 13 : target_state_at_last_animation_started_(InkDropState::HIDDEN), |
| 14 target_state_at_last_animation_ended_(InkDropState::HIDDEN) {} | 14 target_state_at_last_animation_ended_(InkDropState::HIDDEN) {} |
| 15 | 15 |
| 16 TestInkDropRippleObserver::~TestInkDropRippleObserver() {} | 16 TestInkDropRippleObserver::~TestInkDropRippleObserver() {} |
| 17 | 17 |
| 18 std::vector<InkDropState> |
| 19 TestInkDropRippleObserver::GetAndResetAnimationStartedStates() { |
| 20 std::vector<InkDropState> started_states; |
| 21 started_states.swap(animation_started_states_); |
| 22 return started_states; |
| 23 } |
| 24 |
| 25 std::vector<InkDropState> |
| 26 TestInkDropRippleObserver::GetAndResetAnimationEndedStates() { |
| 27 std::vector<InkDropState> ended_states; |
| 28 ended_states.swap(animation_ended_states_); |
| 29 return ended_states; |
| 30 } |
| 31 |
| 18 void TestInkDropRippleObserver::AnimationStarted(InkDropState ink_drop_state) { | 32 void TestInkDropRippleObserver::AnimationStarted(InkDropState ink_drop_state) { |
| 19 ObserverHelper::OnAnimationStarted(ink_drop_state); | 33 ObserverHelper::OnAnimationStarted(ink_drop_state); |
| 34 animation_started_states_.push_back(ink_drop_state); |
| 20 if (ink_drop_ripple_) { | 35 if (ink_drop_ripple_) { |
| 21 target_state_at_last_animation_started_ = | 36 target_state_at_last_animation_started_ = |
| 22 ink_drop_ripple_->target_ink_drop_state(); | 37 ink_drop_ripple_->target_ink_drop_state(); |
| 23 } | 38 } |
| 24 } | 39 } |
| 25 | 40 |
| 26 void TestInkDropRippleObserver::AnimationEnded( | 41 void TestInkDropRippleObserver::AnimationEnded( |
| 27 InkDropState ink_drop_state, | 42 InkDropState ink_drop_state, |
| 28 InkDropAnimationEndedReason reason) { | 43 InkDropAnimationEndedReason reason) { |
| 29 ObserverHelper::OnAnimationEnded(ink_drop_state, reason); | 44 ObserverHelper::OnAnimationEnded(ink_drop_state, reason); |
| 45 animation_ended_states_.push_back(ink_drop_state); |
| 30 if (ink_drop_ripple_) { | 46 if (ink_drop_ripple_) { |
| 31 target_state_at_last_animation_ended_ = | 47 target_state_at_last_animation_ended_ = |
| 32 ink_drop_ripple_->target_ink_drop_state(); | 48 ink_drop_ripple_->target_ink_drop_state(); |
| 33 } | 49 } |
| 34 } | 50 } |
| 35 | 51 |
| 36 } // namespace test | 52 } // namespace test |
| 37 } // namespace views | 53 } // namespace views |
| OLD | NEW |