Chromium Code Reviews| Index: ash/wm/gestures/overview_gesture_handler_unittest.cc |
| diff --git a/ash/wm/gestures/overview_gesture_handler_unittest.cc b/ash/wm/gestures/overview_gesture_handler_unittest.cc |
| index bba37173b707c02e48fa75f01172a56895eecc61..83b7430acb4d7f80de882bfcd89f72f2f1071037 100644 |
| --- a/ash/wm/gestures/overview_gesture_handler_unittest.cc |
| +++ b/ash/wm/gestures/overview_gesture_handler_unittest.cc |
| @@ -7,6 +7,7 @@ |
| #include "ash/root_window_controller.h" |
| #include "ash/shell.h" |
| #include "ash/test/ash_test_base.h" |
| +#include "ash/wm/window_util.h" |
| #include "ui/aura/test/test_window_delegate.h" |
| #include "ui/aura/test/test_windows.h" |
| #include "ui/aura/window.h" |
| @@ -63,6 +64,45 @@ TEST_F(OverviewGestureHandlerTest, VerticalSwipes) { |
| EXPECT_FALSE(IsSelecting()); |
| } |
| +// Tests a swipe up with three fingers to enter overview and a swipe right or |
| +// left to move selection. |
| +TEST_F(OverviewGestureHandlerTest, VerticalThenHorizontalSwipe) { |
| + gfx::Rect bounds(0, 0, 400, 400); |
| + aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
| + std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); |
| + std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); |
| + std::unique_ptr<aura::Window> window3(CreateWindow(bounds)); |
| + std::unique_ptr<aura::Window> window4(CreateWindow(bounds)); |
| + std::unique_ptr<aura::Window> window5(CreateWindow(bounds)); |
| + ui::test::EventGenerator generator(root_window, root_window); |
| + generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5), |
| + 0, -500, 100, 3); |
|
tdanderson
2017/02/06 20:13:58
nit: It might be nice to make use of kVerticalSwip
varkha
2017/02/08 20:41:13
Done.
|
| + EXPECT_TRUE(IsSelecting()); |
| + |
| + // Long swipe right moves selection to the fourth window. |
|
tdanderson
2017/02/06 20:13:58
Consider adding a test to verify that horizontal t
varkha
2017/02/08 20:41:13
(Or come to think of it, maybe we would want three
|
| + generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5), |
| + 500, 0, 100, 3); |
| + EXPECT_TRUE(IsSelecting()); |
| + |
| + // Short swipe left moves selection to the third window. |
| + generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5), |
| + -200, 0, 100, 3); |
| + EXPECT_TRUE(IsSelecting()); |
| + |
| + // Short swipe left moves selection to the second window. |
| + generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5), |
| + -150, 0, 100, 3); |
| + EXPECT_TRUE(IsSelecting()); |
| + |
| + // Swiping down exits. |
|
tdanderson
2017/02/06 20:13:58
nit: swiping down exists and selects the currently
varkha
2017/02/08 20:41:13
Done.
|
| + generator.ScrollSequence(gfx::Point(), base::TimeDelta::FromMilliseconds(5), |
| + 0, 500, 100, 3); |
| + EXPECT_FALSE(IsSelecting()); |
| + |
| + // Second MRU window is selected (i.e. |window4|). |
| + EXPECT_EQ(window4.get(), wm::GetActiveWindow()); |
| +} |
| + |
| // Tests that a mostly horizontal swipe does not trigger overview. |
| TEST_F(OverviewGestureHandlerTest, HorizontalSwipes) { |
| gfx::Rect bounds(0, 0, 400, 400); |