Chromium Code Reviews| 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "ui/views/animation/ink_drop_impl.h" | 7 #include "ui/views/animation/ink_drop_impl.h" |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 ink_drop()->SetHovered(false); | 471 ink_drop()->SetHovered(false); |
| 472 ink_drop()->SetFocused(false); | 472 ink_drop()->SetFocused(false); |
| 473 | 473 |
| 474 ink_drop()->SetHovered(true); | 474 ink_drop()->SetHovered(true); |
| 475 ink_drop()->SetFocused(true); | 475 ink_drop()->SetFocused(true); |
| 476 | 476 |
| 477 EXPECT_FALSE(test_api()->IsHighlightFadingInOrVisible()); | 477 EXPECT_FALSE(test_api()->IsHighlightFadingInOrVisible()); |
| 478 EXPECT_TRUE(test_api()->ShouldHighlight()); | 478 EXPECT_TRUE(test_api()->ShouldHighlight()); |
| 479 } | 479 } |
| 480 | 480 |
| 481 // Verifies there is no crash when animations are started during the destruction | |
| 482 // of the InkDropRipple. See https://crbug.com/663335. | |
|
tdanderson
2016/11/08 18:59:14
Thanks for adding a test
| |
| 483 TEST_P(InkDropImplHideAutoHighlightTest, NoCrashDuringRippleTearDown) { | |
| 484 ink_drop()->SetShowHighlightOnFocus(true); | |
| 485 ink_drop()->SetFocused(true); | |
| 486 ink_drop()->AnimateToState(InkDropState::ACTIVATED); | |
| 487 ink_drop()->AnimateToState(InkDropState::DEACTIVATED); | |
| 488 ink_drop()->AnimateToState(InkDropState::DEACTIVATED); | |
| 489 DestroyInkDrop(); | |
| 490 } | |
| 491 | |
| 481 //////////////////////////////////////////////////////////////////////////////// | 492 //////////////////////////////////////////////////////////////////////////////// |
| 482 // | 493 // |
| 483 // InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE specific tests | 494 // InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE specific tests |
| 484 // | 495 // |
| 485 | 496 |
| 486 typedef InkDropImplAutoHighlightTest InkDropImplShowAutoHighlightTest; | 497 typedef InkDropImplAutoHighlightTest InkDropImplShowAutoHighlightTest; |
| 487 // Note: First argument is optional and intentionally left blank. | 498 // Note: First argument is optional and intentionally left blank. |
| 488 // (it's a prefix for the generated test cases) | 499 // (it's a prefix for the generated test cases) |
| 489 INSTANTIATE_TEST_CASE_P( | 500 INSTANTIATE_TEST_CASE_P( |
| 490 , | 501 , |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 525 EXPECT_TRUE(test_api()->IsHighlightFadingInOrVisible()); | 536 EXPECT_TRUE(test_api()->IsHighlightFadingInOrVisible()); |
| 526 | 537 |
| 527 ink_drop()->SetHovered(false); | 538 ink_drop()->SetHovered(false); |
| 528 ink_drop()->SetFocused(false); | 539 ink_drop()->SetFocused(false); |
| 529 | 540 |
| 530 EXPECT_TRUE(test_api()->IsHighlightFadingInOrVisible()); | 541 EXPECT_TRUE(test_api()->IsHighlightFadingInOrVisible()); |
| 531 EXPECT_FALSE(test_api()->ShouldHighlight()); | 542 EXPECT_FALSE(test_api()->ShouldHighlight()); |
| 532 } | 543 } |
| 533 | 544 |
| 534 } // namespace views | 545 } // namespace views |
| OLD | NEW |