OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/wm/workspace/multi_window_resize_controller.h" | 5 #include "ash/wm/workspace/multi_window_resize_controller.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
8 #include "ash/frame/custom_frame_view_ash.h" | 8 #include "ash/frame/custom_frame_view_ash.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 EXPECT_TRUE(HasTarget(w3.get())); | 332 EXPECT_TRUE(HasTarget(w3.get())); |
333 | 333 |
334 // Release the mouse. The resizer should still be visible and a subsequent | 334 // Release the mouse. The resizer should still be visible and a subsequent |
335 // press should not trigger a DCHECK. | 335 // press should not trigger a DCHECK. |
336 generator.ReleaseLeftButton(); | 336 generator.ReleaseLeftButton(); |
337 EXPECT_TRUE(IsShowing()); | 337 EXPECT_TRUE(IsShowing()); |
338 generator.PressLeftButton(); | 338 generator.PressLeftButton(); |
339 } | 339 } |
340 | 340 |
| 341 // Tests that clicking outside of the resize handle dismisses it. |
| 342 TEST_F(MultiWindowResizeControllerTest, ClickOutside) { |
| 343 aura::test::TestWindowDelegate delegate1; |
| 344 scoped_ptr<aura::Window> w1( |
| 345 CreateTestWindow(&delegate1, gfx::Rect(0, 0, 100, 100))); |
| 346 delegate1.set_window_component(HTRIGHT); |
| 347 aura::test::TestWindowDelegate delegate2; |
| 348 scoped_ptr<aura::Window> w2( |
| 349 CreateTestWindow(&delegate2, gfx::Rect(100, 0, 100, 100))); |
| 350 delegate2.set_window_component(HTLEFT); |
| 351 |
| 352 ui::test::EventGenerator& generator(GetEventGenerator()); |
| 353 gfx::Point w1_center_in_screen = w1->GetBoundsInScreen().CenterPoint(); |
| 354 generator.MoveMouseTo(w1_center_in_screen); |
| 355 EXPECT_TRUE(HasPendingShow()); |
| 356 EXPECT_TRUE(IsShowing()); |
| 357 ShowNow(); |
| 358 EXPECT_TRUE(IsShowing()); |
| 359 |
| 360 gfx::Rect resize_widget_bounds_in_screen = |
| 361 resize_widget()->GetWindowBoundsInScreen(); |
| 362 |
| 363 // Clicking on the resize handle should not do anything. |
| 364 generator.MoveMouseTo(resize_widget_bounds_in_screen.CenterPoint()); |
| 365 generator.ClickLeftButton(); |
| 366 EXPECT_TRUE(IsShowing()); |
| 367 |
| 368 // Clicking outside the resize handle should immediately hide the resize |
| 369 // handle. |
| 370 EXPECT_FALSE(resize_widget_bounds_in_screen.Contains(w1_center_in_screen)); |
| 371 generator.MoveMouseTo(w1_center_in_screen); |
| 372 generator.ClickLeftButton(); |
| 373 EXPECT_FALSE(IsShowing()); |
| 374 } |
| 375 |
341 } // namespace ash | 376 } // namespace ash |
OLD | NEW |