| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 test_api_.CompleteAnimations(); | 363 test_api_.CompleteAnimations(); |
| 364 EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers()); | 364 EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers()); |
| 365 | 365 |
| 366 ink_drop_.SnapToActivated(); | 366 ink_drop_.SnapToActivated(); |
| 367 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); | 367 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); |
| 368 ink_drop_.SetHovered(true); | 368 ink_drop_.SetHovered(true); |
| 369 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); | 369 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); |
| 370 EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible()); | 370 EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible()); |
| 371 } | 371 } |
| 372 | 372 |
| 373 // Test that (re-)hiding or un-hovering a hidden ink drop doesn't add layers. |
| 374 TEST_F(InkDropImplTest, AlwaysHiddenInkDropHasNoLayers) { |
| 375 ink_drop_host_.set_should_show_highlight(true); |
| 376 |
| 377 EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers_added()); |
| 378 |
| 379 ink_drop_.AnimateToState(InkDropState::HIDDEN); |
| 380 EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers_added()); |
| 381 |
| 382 ink_drop_.SetHovered(false); |
| 383 EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers_added()); |
| 384 } |
| 385 |
| 373 } // namespace views | 386 } // namespace views |
| OLD | NEW |