OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ash/common/wm/dock/docked_window_resizer.h" | 5 #include "ash/common/wm/dock/docked_window_resizer.h" |
6 | 6 |
7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/common/shelf/shelf_widget.h" | 8 #include "ash/common/shelf/shelf_widget.h" |
9 #include "ash/common/shelf/wm_shelf.h" | 9 #include "ash/common/shelf/wm_shelf.h" |
10 #include "ash/common/test/test_shelf_delegate.h" | 10 #include "ash/common/test/test_shelf_delegate.h" |
11 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 11 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
12 #include "ash/common/wm/panels/panel_layout_manager.h" | 12 #include "ash/common/wm/panels/panel_layout_manager.h" |
13 #include "ash/common/wm/window_state.h" | 13 #include "ash/common/wm/window_state.h" |
14 #include "ash/common/wm/wm_event.h" | 14 #include "ash/common/wm/wm_event.h" |
15 #include "ash/common/wm_shell.h" | 15 #include "ash/common/wm_shell.h" |
16 #include "ash/display/window_tree_host_manager.h" | 16 #include "ash/display/window_tree_host_manager.h" |
17 #include "ash/public/cpp/shelf_types.h" | 17 #include "ash/public/cpp/shelf_types.h" |
18 #include "ash/public/cpp/shell_window_ids.h" | 18 #include "ash/public/cpp/shell_window_ids.h" |
19 #include "ash/root_window_controller.h" | 19 #include "ash/root_window_controller.h" |
20 #include "ash/screen_util.h" | 20 #include "ash/screen_util.h" |
21 #include "ash/shell.h" | 21 #include "ash/shell.h" |
22 #include "ash/test/ash_test_base.h" | 22 #include "ash/test/ash_test_base.h" |
23 #include "ash/test/cursor_manager_test_api.h" | 23 #include "ash/test/cursor_manager_test_api.h" |
24 #include "ash/wm/drag_window_resizer.h" | 24 #include "ash/wm/drag_window_resizer.h" |
| 25 #include "ash/wm/window_properties.h" |
25 #include "ash/wm/window_state_aura.h" | 26 #include "ash/wm/window_state_aura.h" |
26 #include "ash/wm/window_util.h" | 27 #include "ash/wm/window_util.h" |
27 #include "base/command_line.h" | 28 #include "base/command_line.h" |
28 #include "ui/aura/client/aura_constants.h" | 29 #include "ui/aura/client/aura_constants.h" |
29 #include "ui/aura/client/window_parenting_client.h" | 30 #include "ui/aura/client/window_parenting_client.h" |
30 #include "ui/aura/test/test_window_delegate.h" | 31 #include "ui/aura/test/test_window_delegate.h" |
31 #include "ui/aura/window_event_dispatcher.h" | 32 #include "ui/aura/window_event_dispatcher.h" |
32 #include "ui/base/hit_test.h" | 33 #include "ui/base/hit_test.h" |
33 #include "ui/base/ui_base_types.h" | 34 #include "ui/base/ui_base_types.h" |
34 #include "ui/events/test/event_generator.h" | 35 #include "ui/events/test/event_generator.h" |
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 // Drag down almost to shelf. A panel will snap, a regular window won't. | 1301 // Drag down almost to shelf. A panel will snap, a regular window won't. |
1301 const int shelf_y = | 1302 const int shelf_y = |
1302 GetPrimaryShelf()->shelf_widget()->GetWindowBoundsInScreen().y(); | 1303 GetPrimaryShelf()->shelf_widget()->GetWindowBoundsInScreen().y(); |
1303 const int kDistanceFromShelf = 10; | 1304 const int kDistanceFromShelf = 10; |
1304 ASSERT_NO_FATAL_FAILURE(DragStart(w1.get())); | 1305 ASSERT_NO_FATAL_FAILURE(DragStart(w1.get())); |
1305 DragMove(0, -kDistanceFromShelf + shelf_y - w1->bounds().bottom()); | 1306 DragMove(0, -kDistanceFromShelf + shelf_y - w1->bounds().bottom()); |
1306 DragEnd(); | 1307 DragEnd(); |
1307 if (test_panels()) { | 1308 if (test_panels()) { |
1308 // The panel should be touching the shelf and attached. | 1309 // The panel should be touching the shelf and attached. |
1309 EXPECT_EQ(shelf_y, w1->bounds().bottom()); | 1310 EXPECT_EQ(shelf_y, w1->bounds().bottom()); |
1310 EXPECT_TRUE(wm::GetWindowState(w1.get())->panel_attached()); | 1311 EXPECT_TRUE(w1->GetProperty(kPanelAttachedKey)); |
1311 } else { | 1312 } else { |
1312 // The window should not be touching the shelf. | 1313 // The window should not be touching the shelf. |
1313 EXPECT_EQ(shelf_y - kDistanceFromShelf, w1->bounds().bottom()); | 1314 EXPECT_EQ(shelf_y - kDistanceFromShelf, w1->bounds().bottom()); |
1314 } | 1315 } |
1315 } | 1316 } |
1316 | 1317 |
1317 // Tests that docking and undocking a |window| with a transient child properly | 1318 // Tests that docking and undocking a |window| with a transient child properly |
1318 // maintains the parent of that transient child to be the same as the |window|. | 1319 // maintains the parent of that transient child to be the same as the |window|. |
1319 TEST_P(DockedWindowResizerTest, DragWindowWithTransientChild) { | 1320 TEST_P(DockedWindowResizerTest, DragWindowWithTransientChild) { |
1320 // Create a window with a transient child. | 1321 // Create a window with a transient child. |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 EXPECT_TRUE(window_state->IsMaximized()); | 1492 EXPECT_TRUE(window_state->IsMaximized()); |
1492 } | 1493 } |
1493 | 1494 |
1494 // Tests run twice - on both panels and normal windows | 1495 // Tests run twice - on both panels and normal windows |
1495 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 1496 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
1496 DockedWindowResizerTest, | 1497 DockedWindowResizerTest, |
1497 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 1498 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
1498 ui::wm::WINDOW_TYPE_PANEL)); | 1499 ui::wm::WINDOW_TYPE_PANEL)); |
1499 | 1500 |
1500 } // namespace ash | 1501 } // namespace ash |
OLD | NEW |