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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
| 9 #include "ash/common/shelf/shelf_types.h" |
9 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
10 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 11 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
11 #include "ash/common/wm/panels/panel_layout_manager.h" | 12 #include "ash/common/wm/panels/panel_layout_manager.h" |
12 #include "ash/common/wm/window_state.h" | 13 #include "ash/common/wm/window_state.h" |
13 #include "ash/common/wm/wm_event.h" | 14 #include "ash/common/wm/wm_event.h" |
14 #include "ash/display/window_tree_host_manager.h" | 15 #include "ash/display/window_tree_host_manager.h" |
15 #include "ash/root_window_controller.h" | 16 #include "ash/root_window_controller.h" |
16 #include "ash/screen_util.h" | 17 #include "ash/screen_util.h" |
17 #include "ash/shelf/shelf.h" | 18 #include "ash/shelf/shelf.h" |
18 #include "ash/shelf/shelf_layout_manager.h" | 19 #include "ash/shelf/shelf_layout_manager.h" |
19 #include "ash/shelf/shelf_model.h" | 20 #include "ash/shelf/shelf_model.h" |
20 #include "ash/shelf/shelf_types.h" | |
21 #include "ash/shelf/shelf_widget.h" | 21 #include "ash/shelf/shelf_widget.h" |
22 #include "ash/shell.h" | 22 #include "ash/shell.h" |
23 #include "ash/test/ash_test_base.h" | 23 #include "ash/test/ash_test_base.h" |
24 #include "ash/test/cursor_manager_test_api.h" | 24 #include "ash/test/cursor_manager_test_api.h" |
25 #include "ash/test/shell_test_api.h" | 25 #include "ash/test/shell_test_api.h" |
26 #include "ash/test/test_shelf_delegate.h" | 26 #include "ash/test/test_shelf_delegate.h" |
27 #include "ash/wm/drag_window_resizer.h" | 27 #include "ash/wm/drag_window_resizer.h" |
28 #include "ash/wm/window_state_aura.h" | 28 #include "ash/wm/window_state_aura.h" |
29 #include "ash/wm/window_util.h" | 29 #include "ash/wm/window_util.h" |
30 #include "base/command_line.h" | 30 #include "base/command_line.h" |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 std::unique_ptr<aura::Window> window( | 373 std::unique_ptr<aura::Window> window( |
374 CreateTestWindow(gfx::Rect(0, 0, 201, 201))); | 374 CreateTestWindow(gfx::Rect(0, 0, 201, 201))); |
375 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0); | 375 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0); |
376 | 376 |
377 // The window should be docked at the right edge. | 377 // The window should be docked at the right edge. |
378 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), | 378 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), |
379 window->GetBoundsInScreen().right()); | 379 window->GetBoundsInScreen().right()); |
380 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); | 380 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); |
381 | 381 |
382 // set launcher shelf to be aligned on the right | 382 // set launcher shelf to be aligned on the right |
383 Shelf::ForPrimaryDisplay()->SetAlignment(wm::SHELF_ALIGNMENT_RIGHT); | 383 Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_RIGHT); |
384 // The window should have moved and get attached to the left dock. | 384 // The window should have moved and get attached to the left dock. |
385 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().x(), | 385 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().x(), |
386 window->GetBoundsInScreen().x()); | 386 window->GetBoundsInScreen().x()); |
387 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); | 387 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); |
388 | 388 |
389 // set launcher shelf to be aligned on the left | 389 // set launcher shelf to be aligned on the left |
390 Shelf::ForPrimaryDisplay()->SetAlignment(wm::SHELF_ALIGNMENT_LEFT); | 390 Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_LEFT); |
391 // The window should have moved and get attached to the right edge. | 391 // The window should have moved and get attached to the right edge. |
392 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), | 392 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), |
393 window->GetBoundsInScreen().right()); | 393 window->GetBoundsInScreen().right()); |
394 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); | 394 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); |
395 | 395 |
396 // set launcher shelf to be aligned at the bottom | 396 // set launcher shelf to be aligned at the bottom |
397 Shelf::ForPrimaryDisplay()->SetAlignment(wm::SHELF_ALIGNMENT_BOTTOM); | 397 Shelf::ForPrimaryDisplay()->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
398 // The window should stay in the right edge. | 398 // The window should stay in the right edge. |
399 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), | 399 EXPECT_EQ(window->GetRootWindow()->GetBoundsInScreen().right(), |
400 window->GetBoundsInScreen().right()); | 400 window->GetBoundsInScreen().right()); |
401 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); | 401 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); |
402 } | 402 } |
403 | 403 |
404 // Dock on the right side, try to undock, then drag more to really undock | 404 // Dock on the right side, try to undock, then drag more to really undock |
405 TEST_P(DockedWindowResizerTest, AttachTryDetach) { | 405 TEST_P(DockedWindowResizerTest, AttachTryDetach) { |
406 if (!SupportsHostWindowResize()) | 406 if (!SupportsHostWindowResize()) |
407 return; | 407 return; |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 EXPECT_TRUE(window_state->IsMaximized()); | 1613 EXPECT_TRUE(window_state->IsMaximized()); |
1614 } | 1614 } |
1615 | 1615 |
1616 // Tests run twice - on both panels and normal windows | 1616 // Tests run twice - on both panels and normal windows |
1617 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 1617 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
1618 DockedWindowResizerTest, | 1618 DockedWindowResizerTest, |
1619 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 1619 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
1620 ui::wm::WINDOW_TYPE_PANEL)); | 1620 ui::wm::WINDOW_TYPE_PANEL)); |
1621 | 1621 |
1622 } // namespace ash | 1622 } // namespace ash |
OLD | NEW |