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