| 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_impl.h" | 5 #include "ui/views/animation/ink_drop_impl.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/test/test_simple_task_runner.h" | 8 #include "base/test/test_simple_task_runner.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 ink_drop_.SetHovered(true); | 56 ink_drop_.SetHovered(true); |
| 57 EXPECT_TRUE(test_api_.IsHoverFadingInOrVisible()); | 57 EXPECT_TRUE(test_api_.IsHoverFadingInOrVisible()); |
| 58 | 58 |
| 59 test_api_.CompleteAnimations(); | 59 test_api_.CompleteAnimations(); |
| 60 | 60 |
| 61 ink_drop_.SetHovered(false); | 61 ink_drop_.SetHovered(false); |
| 62 EXPECT_FALSE(test_api_.IsHoverFadingInOrVisible()); | 62 EXPECT_FALSE(test_api_.IsHoverFadingInOrVisible()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 TEST_F(InkDropImplTest, FocusAndHoverAtSameTime) { |
| 66 ink_drop_host_.set_should_show_hover(true); |
| 67 EXPECT_FALSE(test_api_.IsHoverFadingInOrVisible()); |
| 68 |
| 69 ink_drop_.SetFocused(true); |
| 70 EXPECT_TRUE(test_api_.IsHoverFadingInOrVisible()); |
| 71 |
| 72 test_api_.CompleteAnimations(); |
| 73 ink_drop_.SetHovered(false); |
| 74 EXPECT_TRUE(test_api_.IsHoverFadingInOrVisible()); |
| 75 |
| 76 test_api_.CompleteAnimations(); |
| 77 ink_drop_.SetHovered(true); |
| 78 EXPECT_TRUE(test_api_.IsHoverFadingInOrVisible()); |
| 79 |
| 80 test_api_.CompleteAnimations(); |
| 81 ink_drop_.SetFocused(false); |
| 82 EXPECT_TRUE(test_api_.IsHoverFadingInOrVisible()); |
| 83 |
| 84 test_api_.CompleteAnimations(); |
| 85 ink_drop_.SetHovered(false); |
| 86 EXPECT_FALSE(test_api_.IsHoverFadingInOrVisible()); |
| 87 } |
| 88 |
| 65 TEST_F(InkDropImplTest, HoverDoesntFadeInAfterAnimationIfHoverNotSet) { | 89 TEST_F(InkDropImplTest, HoverDoesntFadeInAfterAnimationIfHoverNotSet) { |
| 66 ink_drop_host_.set_should_show_hover(true); | 90 ink_drop_host_.set_should_show_hover(true); |
| 67 ink_drop_.SetHovered(false); | 91 ink_drop_.SetHovered(false); |
| 68 ink_drop_.AnimateToState(InkDropState::ACTION_TRIGGERED); | 92 ink_drop_.AnimateToState(InkDropState::ACTION_TRIGGERED); |
| 69 test_api_.CompleteAnimations(); | 93 test_api_.CompleteAnimations(); |
| 70 | 94 |
| 71 EXPECT_FALSE(task_runner_->HasPendingTask()); | 95 EXPECT_FALSE(task_runner_->HasPendingTask()); |
| 72 EXPECT_FALSE(test_api_.IsHoverFadingInOrVisible()); | 96 EXPECT_FALSE(test_api_.IsHoverFadingInOrVisible()); |
| 73 } | 97 } |
| 74 | 98 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 test_api_.CompleteAnimations(); | 246 test_api_.CompleteAnimations(); |
| 223 | 247 |
| 224 ink_drop_.SetHovered(false); | 248 ink_drop_.SetHovered(false); |
| 225 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); | 249 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); |
| 226 | 250 |
| 227 ink_drop_.SetHovered(true); | 251 ink_drop_.SetHovered(true); |
| 228 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); | 252 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); |
| 229 } | 253 } |
| 230 | 254 |
| 231 } // namespace views | 255 } // namespace views |
| OLD | NEW |