Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3115)

Unified Diff: ash/wm/workspace/multi_window_resize_controller_unittest.cc

Issue 753933003: Dismiss the multi window resizer when the user clicks outside of the resizer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@toplevel_consume_press
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/wm/workspace/multi_window_resize_controller_unittest.cc
diff --git a/ash/wm/workspace/multi_window_resize_controller_unittest.cc b/ash/wm/workspace/multi_window_resize_controller_unittest.cc
index 4672a905e0a734d129dcb0d89b62bb7ffd99ad34..cc1c3a3e5b8513eca3af3717874cfb44015c1052 100644
--- a/ash/wm/workspace/multi_window_resize_controller_unittest.cc
+++ b/ash/wm/workspace/multi_window_resize_controller_unittest.cc
@@ -338,4 +338,39 @@ TEST_F(MultiWindowResizeControllerTest, Three) {
generator.PressLeftButton();
}
+// Tests that clicking outside of the resize handle dismisses it.
+TEST_F(MultiWindowResizeController, ClickOutside) {
+ aura::test::TestWindowDelegate delegate1;
+ scoped_ptr<aura::Window> w1(
+ CreateTestWindow(&delegate1, gfx::Rect(0, 0, 100, 100)));
+ delegate1.set_window_component(HTRIGHT);
+ aura::test::TestWindowDelegate delegate2;
+ scoped_ptr<aura::Window> w2(
+ CreateTestWindow(&delegate2, gfx::Rect(100, 0, 100, 100)));
+ delegate2.set_window_component(HTLEFT);
+
+ ui::test::EventGenerator& generator(GetEventGenerator());
+ gfx::Point w1_center_in_screen = w1->GetBoundsInScreen().CenterPoint();
+ generator.MoveMouseTo(w1_center_in_screen);
+ EXPECT_TRUE(HasPendingShow());
+ EXPECT_TRUE(IsShowing());
+ ShowNow();
+ EXPECT_TRUE(IsShowing());
+
+ gfx::Rect resize_widget_bounds_in_screen =
+ resize_widget()->GetWindowBoundsInScreen();
+
+ // Clicking on the resize handle should not do anything.
+ generator.MoveMouseTo(resize_widget_bounds_in_screen.CenterPoint());
+ generator.ClickLeftButton();
+ EXPECT_TRUE(IsShowing());
+
+ // Clicking outside the resize handle should immediately hide the resize
+ // handle.
+ EXPECT_FALSE(resize_widget_bounds_in_screen.Contains(w1_center_in_screen));
+ generator.MoveMouseTo(w1_center_in_screen));
+ generator.ClickLeftButton();
+ EXPECT_FALSE(IsShowing());
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698