| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "ash/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
| 9 #include "ash/common/accessibility_delegate.h" | 9 #include "ash/common/accessibility_delegate.h" |
| 10 #include "ash/common/accessibility_types.h" | 10 #include "ash/common/accessibility_types.h" |
| (...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1970 ToggleOverview(); | 1970 ToggleOverview(); |
| 1971 ASSERT_FALSE(IsSelecting()); | 1971 ASSERT_FALSE(IsSelecting()); |
| 1972 } | 1972 } |
| 1973 | 1973 |
| 1974 // Tests clicking on the desktop itself to cancel overview mode. | 1974 // Tests clicking on the desktop itself to cancel overview mode. |
| 1975 TEST_P(WindowSelectorTest, CancelOverviewOnMouseClick) { | 1975 TEST_P(WindowSelectorTest, CancelOverviewOnMouseClick) { |
| 1976 // Overview disabled by default. | 1976 // Overview disabled by default. |
| 1977 EXPECT_FALSE(IsSelecting()); | 1977 EXPECT_FALSE(IsSelecting()); |
| 1978 | 1978 |
| 1979 // Point and bounds selected so that they don't intersect. This causes | 1979 // Point and bounds selected so that they don't intersect. This causes |
| 1980 // events located at the point to be passed to DesktopBackgroundController, | 1980 // events located at the point to be passed to WallpaperController, |
| 1981 // and not the window. | 1981 // and not the window. |
| 1982 gfx::Point point_in_background_page(0, 0); | 1982 gfx::Point point_in_background_page(0, 0); |
| 1983 gfx::Rect bounds(10, 10, 100, 100); | 1983 gfx::Rect bounds(10, 10, 100, 100); |
| 1984 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); | 1984 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); |
| 1985 ui::test::EventGenerator& generator = GetEventGenerator(); | 1985 ui::test::EventGenerator& generator = GetEventGenerator(); |
| 1986 // Move mouse to point in the background page. Sending an event here will pass | 1986 // Move mouse to point in the background page. Sending an event here will pass |
| 1987 // it to the DesktopBackgroundController in both regular and overview mode. | 1987 // it to the WallpaperController in both regular and overview mode. |
| 1988 generator.MoveMouseTo(point_in_background_page); | 1988 generator.MoveMouseTo(point_in_background_page); |
| 1989 | 1989 |
| 1990 // Clicking on the background page while not in overview should not toggle | 1990 // Clicking on the background page while not in overview should not toggle |
| 1991 // overview. | 1991 // overview. |
| 1992 generator.ClickLeftButton(); | 1992 generator.ClickLeftButton(); |
| 1993 EXPECT_FALSE(IsSelecting()); | 1993 EXPECT_FALSE(IsSelecting()); |
| 1994 | 1994 |
| 1995 // Switch to overview mode. | 1995 // Switch to overview mode. |
| 1996 ToggleOverview(); | 1996 ToggleOverview(); |
| 1997 ASSERT_TRUE(IsSelecting()); | 1997 ASSERT_TRUE(IsSelecting()); |
| 1998 | 1998 |
| 1999 // Click should now exit overview mode. | 1999 // Click should now exit overview mode. |
| 2000 generator.ClickLeftButton(); | 2000 generator.ClickLeftButton(); |
| 2001 EXPECT_FALSE(IsSelecting()); | 2001 EXPECT_FALSE(IsSelecting()); |
| 2002 } | 2002 } |
| 2003 | 2003 |
| 2004 // Tests tapping on the desktop itself to cancel overview mode. | 2004 // Tests tapping on the desktop itself to cancel overview mode. |
| 2005 TEST_P(WindowSelectorTest, CancelOverviewOnTap) { | 2005 TEST_P(WindowSelectorTest, CancelOverviewOnTap) { |
| 2006 // Overview disabled by default. | 2006 // Overview disabled by default. |
| 2007 EXPECT_FALSE(IsSelecting()); | 2007 EXPECT_FALSE(IsSelecting()); |
| 2008 | 2008 |
| 2009 // Point and bounds selected so that they don't intersect. This causes | 2009 // Point and bounds selected so that they don't intersect. This causes |
| 2010 // events located at the point to be passed to DesktopBackgroundController, | 2010 // events located at the point to be passed to WallpaperController, |
| 2011 // and not the window. | 2011 // and not the window. |
| 2012 gfx::Point point_in_background_page(0, 0); | 2012 gfx::Point point_in_background_page(0, 0); |
| 2013 gfx::Rect bounds(10, 10, 100, 100); | 2013 gfx::Rect bounds(10, 10, 100, 100); |
| 2014 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); | 2014 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); |
| 2015 ui::test::EventGenerator& generator = GetEventGenerator(); | 2015 ui::test::EventGenerator& generator = GetEventGenerator(); |
| 2016 | 2016 |
| 2017 // Tapping on the background page while not in overview should not toggle | 2017 // Tapping on the background page while not in overview should not toggle |
| 2018 // overview. | 2018 // overview. |
| 2019 generator.GestureTapAt(point_in_background_page); | 2019 generator.GestureTapAt(point_in_background_page); |
| 2020 EXPECT_FALSE(IsSelecting()); | 2020 EXPECT_FALSE(IsSelecting()); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 bounds.y()); | 2120 bounds.y()); |
| 2121 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); | 2121 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); |
| 2122 EXPECT_NEAR(transformed_rect.x() - bounds.x(), | 2122 EXPECT_NEAR(transformed_rect.x() - bounds.x(), |
| 2123 bounds.right() - transformed_rect.right(), 1); | 2123 bounds.right() - transformed_rect.right(), 1); |
| 2124 EXPECT_NEAR( | 2124 EXPECT_NEAR( |
| 2125 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), | 2125 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), |
| 2126 bounds.bottom() - transformed_rect.bottom(), 1); | 2126 bounds.bottom() - transformed_rect.bottom(), 1); |
| 2127 } | 2127 } |
| 2128 | 2128 |
| 2129 } // namespace ash | 2129 } // namespace ash |
| OLD | NEW |