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/common/wm/workspace/workspace_layout_manager.h" | 5 #include "ash/common/wm/workspace/workspace_layout_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "ash/aura/wm_window_aura.h" | 10 #include "ash/aura/wm_window_aura.h" |
11 #include "ash/common/session/session_state_delegate.h" | 11 #include "ash/common/session/session_state_delegate.h" |
12 #include "ash/common/shelf/shelf_constants.h" | 12 #include "ash/common/shelf/shelf_constants.h" |
13 #include "ash/common/shelf/shelf_layout_manager.h" | 13 #include "ash/common/shelf/shelf_layout_manager.h" |
14 #include "ash/common/shelf/wm_shelf.h" | 14 #include "ash/common/shelf/wm_shelf.h" |
15 #include "ash/common/shell_observer.h" | 15 #include "ash/common/shell_observer.h" |
16 #include "ash/common/test/ash_test.h" | 16 #include "ash/common/test/ash_test.h" |
17 #include "ash/common/test/test_session_state_delegate.h" | 17 #include "ash/common/test/test_session_state_delegate.h" |
18 #include "ash/common/wm/fullscreen_window_finder.h" | 18 #include "ash/common/wm/fullscreen_window_finder.h" |
19 #include "ash/common/wm/maximize_mode/workspace_backdrop_delegate.h" | 19 #include "ash/common/wm/maximize_mode/workspace_backdrop_delegate.h" |
20 #include "ash/common/wm/window_state.h" | 20 #include "ash/common/wm/window_state.h" |
21 #include "ash/common/wm/wm_event.h" | 21 #include "ash/common/wm/wm_event.h" |
22 #include "ash/common/wm/wm_screen_util.h" | 22 #include "ash/common/wm/wm_screen_util.h" |
23 #include "ash/common/wm/workspace/workspace_window_resizer.h" | 23 #include "ash/common/wm/workspace/workspace_window_resizer.h" |
24 #include "ash/common/wm_lookup.h" | 24 #include "ash/common/wm_lookup.h" |
25 #include "ash/common/wm_root_window_controller.h" | 25 #include "ash/common/wm_root_window_controller.h" |
26 #include "ash/common/wm_shell.h" | 26 #include "ash/common/wm_shell.h" |
27 #include "ash/display/display_manager.h" | |
28 #include "ash/public/cpp/shell_window_ids.h" | 27 #include "ash/public/cpp/shell_window_ids.h" |
29 #include "ash/root_window_controller.h" | 28 #include "ash/root_window_controller.h" |
30 #include "ash/screen_util.h" | 29 #include "ash/screen_util.h" |
31 #include "ash/shell.h" | 30 #include "ash/shell.h" |
32 #include "ash/test/ash_test_base.h" | 31 #include "ash/test/ash_test_base.h" |
33 #include "ash/test/display_manager_test_api.h" | |
34 #include "ash/wm/window_state_aura.h" | 32 #include "ash/wm/window_state_aura.h" |
35 #include "ash/wm/window_util.h" | 33 #include "ash/wm/window_util.h" |
36 #include "base/command_line.h" | 34 #include "base/command_line.h" |
37 #include "base/compiler_specific.h" | 35 #include "base/compiler_specific.h" |
38 #include "base/run_loop.h" | 36 #include "base/run_loop.h" |
39 #include "ui/base/ui_base_switches.h" | 37 #include "ui/base/ui_base_switches.h" |
40 #include "ui/base/ui_base_types.h" | 38 #include "ui/base/ui_base_types.h" |
41 #include "ui/display/manager/display_layout.h" | 39 #include "ui/display/manager/display_layout.h" |
| 40 #include "ui/display/manager/display_manager.h" |
42 #include "ui/display/screen.h" | 41 #include "ui/display/screen.h" |
| 42 #include "ui/display/test/display_manager_test_api.h" |
43 #include "ui/gfx/geometry/insets.h" | 43 #include "ui/gfx/geometry/insets.h" |
44 #include "ui/keyboard/keyboard_controller.h" | 44 #include "ui/keyboard/keyboard_controller.h" |
45 #include "ui/keyboard/keyboard_ui.h" | 45 #include "ui/keyboard/keyboard_ui.h" |
46 #include "ui/keyboard/keyboard_util.h" | 46 #include "ui/keyboard/keyboard_util.h" |
47 #include "ui/views/widget/widget.h" | 47 #include "ui/views/widget/widget.h" |
48 #include "ui/views/widget/widget_delegate.h" | 48 #include "ui/views/widget/widget_delegate.h" |
49 #include "ui/wm/core/window_util.h" | 49 #include "ui/wm/core/window_util.h" |
50 | 50 |
51 namespace ash { | 51 namespace ash { |
52 namespace { | 52 namespace { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 TEST_F(WorkspaceLayoutManagerTest, KeepMinimumVisibilityInDisplays) { | 144 TEST_F(WorkspaceLayoutManagerTest, KeepMinimumVisibilityInDisplays) { |
145 if (!SupportsMultipleDisplays()) | 145 if (!SupportsMultipleDisplays()) |
146 return; | 146 return; |
147 | 147 |
148 UpdateDisplay("300x400,400x500"); | 148 UpdateDisplay("300x400,400x500"); |
149 WmWindow::Windows root_windows = WmShell::Get()->GetAllRootWindows(); | 149 WmWindow::Windows root_windows = WmShell::Get()->GetAllRootWindows(); |
150 | 150 |
151 if (!SetSecondaryDisplayPlacement(display::DisplayPlacement::TOP, 0)) | 151 if (!SetSecondaryDisplayPlacement(display::DisplayPlacement::TOP, 0)) |
152 return; | 152 return; |
153 | 153 |
| 154 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
| 155 display::test::CreateDisplayLayout(display_manager(), |
| 156 display::DisplayPlacement::TOP, 0)); |
154 EXPECT_EQ("0,-500 400x500", root_windows[1]->GetBoundsInScreen().ToString()); | 157 EXPECT_EQ("0,-500 400x500", root_windows[1]->GetBoundsInScreen().ToString()); |
155 | 158 |
156 std::unique_ptr<WindowOwner> window1_owner( | 159 std::unique_ptr<WindowOwner> window1_owner( |
157 CreateTestWindow(gfx::Rect(10, -400, 200, 200))); | 160 CreateTestWindow(gfx::Rect(10, -400, 200, 200))); |
158 EXPECT_EQ("10,-400 200x200", | 161 EXPECT_EQ("10,-400 200x200", |
159 window1_owner->window()->GetBoundsInScreen().ToString()); | 162 window1_owner->window()->GetBoundsInScreen().ToString()); |
160 | 163 |
161 // Make sure the caption is visible. | 164 // Make sure the caption is visible. |
162 std::unique_ptr<WindowOwner> window2_owner( | 165 std::unique_ptr<WindowOwner> window2_owner( |
163 CreateTestWindow(gfx::Rect(10, -600, 200, 200))); | 166 CreateTestWindow(gfx::Rect(10, -600, 200, 200))); |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 changed_window_bounds.Offset(0, -shift); | 1326 changed_window_bounds.Offset(0, -shift); |
1324 // Window should be shifted up. | 1327 // Window should be shifted up. |
1325 EXPECT_EQ(changed_window_bounds, window->GetBounds()); | 1328 EXPECT_EQ(changed_window_bounds, window->GetBounds()); |
1326 | 1329 |
1327 kb_controller->HideKeyboard( | 1330 kb_controller->HideKeyboard( |
1328 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); | 1331 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); |
1329 EXPECT_EQ(orig_window_bounds, window->GetBounds()); | 1332 EXPECT_EQ(orig_window_bounds, window->GetBounds()); |
1330 } | 1333 } |
1331 | 1334 |
1332 } // namespace ash | 1335 } // namespace ash |
OLD | NEW |