Chromium Code Reviews| Index: ui/views/animation/ink_drop_host_view_unittest.cc |
| diff --git a/ui/views/animation/ink_drop_host_view_unittest.cc b/ui/views/animation/ink_drop_host_view_unittest.cc |
| index 367239e74f801aa83d9f1c29180067f85b6813c6..7cd87c4c590302e38560c1f4ddd2dd8e20f77a02 100644 |
| --- a/ui/views/animation/ink_drop_host_view_unittest.cc |
| +++ b/ui/views/animation/ink_drop_host_view_unittest.cc |
| @@ -9,6 +9,7 @@ |
| #include "ui/events/event.h" |
| #include "ui/events/event_constants.h" |
| #include "ui/events/event_utils.h" |
| +#include "ui/gfx/color_palette.h" |
| #include "ui/gfx/geometry/point.h" |
| #include "ui/gfx/geometry/size.h" |
| #include "ui/views/animation/test/ink_drop_host_view_test_api.h" |
| @@ -16,6 +17,13 @@ |
| namespace views { |
| namespace test { |
| +class InkDropHostViewColor : public InkDropHostView { |
| + protected: |
| + SkColor GetInkDropBaseColor() const override { |
| + return gfx::kPlaceholderColor; |
| + } |
|
kylix_rd
2016/06/30 21:45:53
Added this override to work around the NOTREACHED
|
| +}; |
| + |
| class InkDropHostViewTest : public testing::Test { |
| public: |
| InkDropHostViewTest(); |
| @@ -23,7 +31,7 @@ class InkDropHostViewTest : public testing::Test { |
| protected: |
| // Test target. |
| - InkDropHostView host_view_; |
| + InkDropHostViewColor host_view_; |
| // Provides internal access to |host_view_| test target. |
| InkDropHostViewTestApi test_api_; |
| @@ -71,5 +79,54 @@ TEST_F(InkDropHostViewTest, SetHasInkDropGestureHandler) { |
| EXPECT_FALSE(test_api_.HasGestureHandler()); |
| } |
| +#if defined(OS_WIN) |
| +TEST_F(InkDropHostViewTest, NoInkDropOnTouchOrGestureEvents) { |
| + host_view_.SetSize(gfx::Size(20, 20)); |
| + |
| + test_api_.SetHasInkDrop(true); |
| + |
| + // Ensure the target ink drop is in the expected state. |
| + EXPECT_EQ(test_api_.ink_drop()->GetTargetInkDropState(), |
| + InkDropState::HIDDEN); |
| + |
| + ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, gfx::Point(5, 6), 1, |
| + ui::EventTimeForNow()); |
| + |
| + test_api_.AnimateInkDrop(InkDropState::ACTION_PENDING, &touch_event); |
| + EXPECT_EQ(test_api_.ink_drop()->GetTargetInkDropState(), |
| + InkDropState::HIDDEN); |
| + |
| + test_api_.AnimateInkDrop(InkDropState::ALTERNATE_ACTION_PENDING, |
| + &touch_event); |
| + EXPECT_EQ(test_api_.ink_drop()->GetTargetInkDropState(), |
| + InkDropState::HIDDEN); |
| +} |
| + |
| +TEST_F(InkDropHostViewTest, DismissInkDropOnTouchOrGestureEvents) { |
| + host_view_.SetSize(gfx::Size(20, 20)); |
| + |
| + test_api_.SetHasInkDrop(true); |
| + |
| + // Ensure the target ink drop is in the expected state. |
| + EXPECT_EQ(test_api_.ink_drop()->GetTargetInkDropState(), |
| + InkDropState::HIDDEN); |
| + |
| + ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, gfx::Point(5, 6), |
| + gfx::Point(5, 6), ui::EventTimeForNow(), |
| + ui::EF_LEFT_MOUSE_BUTTON, 0); |
| + |
| + test_api_.AnimateInkDrop(InkDropState::ACTION_PENDING, &mouse_event); |
| + EXPECT_EQ(test_api_.ink_drop()->GetTargetInkDropState(), |
| + InkDropState::ACTION_PENDING); |
| + |
| + ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, gfx::Point(5, 6), 1, |
| + ui::EventTimeForNow()); |
| + |
| + test_api_.AnimateInkDrop(InkDropState::ACTION_TRIGGERED, &touch_event); |
| + EXPECT_EQ(test_api_.ink_drop()->GetTargetInkDropState(), |
| + InkDropState::ACTION_TRIGGERED); |
| +} |
| +#endif |
| + |
| } // namespace test |
| } // namespace views |