| OLD | NEW |
| 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 #include "ui/views/animation/ink_drop_animation_controller_factory.h" | 5 #include "ui/views/animation/ink_drop_animation_controller_factory.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/test/test_mock_time_task_runner.h" | 10 #include "base/test/test_mock_time_task_runner.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Note: First argument is optional and intentionally left blank. | 95 // Note: First argument is optional and intentionally left blank. |
| 96 // (it's a prefix for the generated test cases) | 96 // (it's a prefix for the generated test cases) |
| 97 INSTANTIATE_TEST_CASE_P( | 97 INSTANTIATE_TEST_CASE_P( |
| 98 , | 98 , |
| 99 InkDropAnimationControllerFactoryTest, | 99 InkDropAnimationControllerFactoryTest, |
| 100 testing::Values(ui::MaterialDesignController::NON_MATERIAL, | 100 testing::Values(ui::MaterialDesignController::NON_MATERIAL, |
| 101 ui::MaterialDesignController::MATERIAL_NORMAL, | 101 ui::MaterialDesignController::MATERIAL_NORMAL, |
| 102 ui::MaterialDesignController::MATERIAL_HYBRID)); | 102 ui::MaterialDesignController::MATERIAL_HYBRID)); |
| 103 | 103 |
| 104 TEST_P(InkDropAnimationControllerFactoryTest, | 104 TEST_P(InkDropAnimationControllerFactoryTest, |
| 105 VerifyAllInkDropLayersRemovedAfterDestruction) { | 105 VerifyInkDropLayersRemovedAfterDestructionWhenRippleIsActive) { |
| 106 ink_drop_animation_controller_->AnimateToState(InkDropState::ACTION_PENDING); | 106 ink_drop_animation_controller_->AnimateToState(InkDropState::ACTION_PENDING); |
| 107 ink_drop_animation_controller_.reset(); | 107 ink_drop_animation_controller_.reset(); |
| 108 EXPECT_EQ(0, test_ink_drop_host_.num_ink_drop_layers()); | 108 EXPECT_EQ(0, test_ink_drop_host_.num_ink_drop_layers()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 TEST_P(InkDropAnimationControllerFactoryTest, |
| 112 VerifyInkDropLayersRemovedAfterDestructionWhenHoverIsActive) { |
| 113 test_ink_drop_host_.set_should_show_hover(true); |
| 114 ink_drop_animation_controller_->SetHovered(true); |
| 115 ink_drop_animation_controller_.reset(); |
| 116 EXPECT_EQ(0, test_ink_drop_host_.num_ink_drop_layers()); |
| 117 } |
| 118 |
| 111 TEST_P(InkDropAnimationControllerFactoryTest, StateIsHiddenInitially) { | 119 TEST_P(InkDropAnimationControllerFactoryTest, StateIsHiddenInitially) { |
| 112 EXPECT_EQ(InkDropState::HIDDEN, | 120 EXPECT_EQ(InkDropState::HIDDEN, |
| 113 ink_drop_animation_controller_->GetTargetInkDropState()); | 121 ink_drop_animation_controller_->GetTargetInkDropState()); |
| 114 } | 122 } |
| 115 | 123 |
| 116 TEST_P(InkDropAnimationControllerFactoryTest, TypicalQuickAction) { | 124 TEST_P(InkDropAnimationControllerFactoryTest, TypicalQuickAction) { |
| 117 ink_drop_animation_controller_->AnimateToState(InkDropState::ACTION_PENDING); | 125 ink_drop_animation_controller_->AnimateToState(InkDropState::ACTION_PENDING); |
| 118 ink_drop_animation_controller_->AnimateToState( | 126 ink_drop_animation_controller_->AnimateToState( |
| 119 InkDropState::ACTION_TRIGGERED); | 127 InkDropState::ACTION_TRIGGERED); |
| 120 EXPECT_EQ(InkDropState::HIDDEN, | 128 EXPECT_EQ(InkDropState::HIDDEN, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 ink_drop_animation_controller_->AnimateToState(InkDropState::ACTION_PENDING); | 167 ink_drop_animation_controller_->AnimateToState(InkDropState::ACTION_PENDING); |
| 160 ink_drop_animation_controller_->AnimateToState( | 168 ink_drop_animation_controller_->AnimateToState( |
| 161 InkDropState::ALTERNATE_ACTION_PENDING); | 169 InkDropState::ALTERNATE_ACTION_PENDING); |
| 162 ink_drop_animation_controller_->AnimateToState(InkDropState::ACTIVATED); | 170 ink_drop_animation_controller_->AnimateToState(InkDropState::ACTIVATED); |
| 163 ink_drop_animation_controller_->AnimateToState(InkDropState::DEACTIVATED); | 171 ink_drop_animation_controller_->AnimateToState(InkDropState::DEACTIVATED); |
| 164 EXPECT_EQ(InkDropState::HIDDEN, | 172 EXPECT_EQ(InkDropState::HIDDEN, |
| 165 ink_drop_animation_controller_->GetTargetInkDropState()); | 173 ink_drop_animation_controller_->GetTargetInkDropState()); |
| 166 } | 174 } |
| 167 | 175 |
| 168 } // namespace views | 176 } // namespace views |
| OLD | NEW |