diff options
author | rsadam@chromium.org <rsadam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-11 15:41:22 +0000 |
---|---|---|
committer | rsadam@chromium.org <rsadam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-11 15:42:34 +0000 |
commit | d100aa3cba8e519c9912d577270f53e75df4fe42 (patch) | |
tree | 337a5bc0a627d4a441af0798b3cff0088ceb31ae /ash/wm/overview | |
parent | a96a24ba956a7522c8b81961bae6e5cdb52e3c4c (diff) | |
download | chromium_src-d100aa3cba8e519c9912d577270f53e75df4fe42.zip chromium_src-d100aa3cba8e519c9912d577270f53e75df4fe42.tar.gz chromium_src-d100aa3cba8e519c9912d577270f53e75df4fe42.tar.bz2 |
Adds test for cancelling overview mode on click/tap.
Adds unittests to verify that clicking/tapping on the desktop iteself while in overview mode causes the user to leave overview mode.
BUG=364507
TEST=WindowSelectorTest.CancelOverviewOnTap, WindowSelectorTest.CancelOverviewOnClick
Review URL: https://codereview.chromium.org/445693004
Cr-Commit-Position: refs/heads/master@{#288719}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288719 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/overview')
-rw-r--r-- | ash/wm/overview/window_selector_unittest.cc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc index 057c1a0..ccfa7c2 100644 --- a/ash/wm/overview/window_selector_unittest.cc +++ b/ash/wm/overview/window_selector_unittest.cc @@ -1138,4 +1138,61 @@ TEST_F(WindowSelectorTest, TextFilteringSelection) { EXPECT_EQ(GetSelectedWindow(), window2.get()); } +// Tests clicking on the desktop itself to cancel overview mode. +TEST_F(WindowSelectorTest, CancelOverviewOnMouseClick) { + // Overview disabled by default. + EXPECT_FALSE(IsSelecting()); + + // Point and bounds selected so that they don't intersect. This causes + // events located at the point to be passed to DesktopBackgroundController, + // and not the window. + gfx::Point point_in_background_page(0, 0); + gfx::Rect bounds(10, 10, 100, 100); + scoped_ptr<aura::Window> window1(CreateWindow(bounds)); + ui::test::EventGenerator& generator = GetEventGenerator(); + // Move mouse to point in the background page. Sending an event here will pass + // it to the DesktopBackgroundController in both regular and overview mode. + generator.MoveMouseTo(point_in_background_page); + + // Clicking on the background page while not in overview should not toggle + // overview. + generator.ClickLeftButton(); + EXPECT_FALSE(IsSelecting()); + + // Switch to overview mode. + ToggleOverview(); + ASSERT_TRUE(IsSelecting()); + + // Click should now exit overview mode. + generator.ClickLeftButton(); + EXPECT_FALSE(IsSelecting()); +} + +// Tests tapping on the desktop itself to cancel overview mode. +TEST_F(WindowSelectorTest, CancelOverviewOnTap) { + // Overview disabled by default. + EXPECT_FALSE(IsSelecting()); + + // Point and bounds selected so that they don't intersect. This causes + // events located at the point to be passed to DesktopBackgroundController, + // and not the window. + gfx::Point point_in_background_page(0, 0); + gfx::Rect bounds(10, 10, 100, 100); + scoped_ptr<aura::Window> window1(CreateWindow(bounds)); + ui::test::EventGenerator& generator = GetEventGenerator(); + + // Tapping on the background page while not in overview should not toggle + // overview. + generator.GestureTapAt(point_in_background_page); + EXPECT_FALSE(IsSelecting()); + + // Switch to overview mode. + ToggleOverview(); + ASSERT_TRUE(IsSelecting()); + + // Tap should now exit overview mode. + generator.GestureTapAt(point_in_background_page); + EXPECT_FALSE(IsSelecting()); +} + } // namespace ash |