OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/window_state.h" | 5 #include "ash/common/wm/window_state.h" |
6 #include "ash/display/display_manager.h" | |
7 #include "ash/public/cpp/shell_window_ids.h" | 6 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
9 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
10 #include "ash/shell.h" | 9 #include "ash/shell.h" |
11 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
12 #include "ash/wm/window_state_aura.h" | 11 #include "ash/wm/window_state_aura.h" |
13 #include "base/command_line.h" | 12 #include "base/command_line.h" |
14 #include "ui/aura/client/aura_constants.h" | 13 #include "ui/aura/client/aura_constants.h" |
15 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 15 #include "ui/display/manager/display_manager.h" |
16 #include "ui/display/screen.h" | 16 #include "ui/display/screen.h" |
17 #include "ui/keyboard/keyboard_controller.h" | 17 #include "ui/keyboard/keyboard_controller.h" |
18 #include "ui/keyboard/keyboard_switches.h" | 18 #include "ui/keyboard/keyboard_switches.h" |
19 #include "ui/keyboard/keyboard_ui.h" | 19 #include "ui/keyboard/keyboard_ui.h" |
20 #include "ui/keyboard/keyboard_util.h" | 20 #include "ui/keyboard/keyboard_util.h" |
21 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
22 #include "ui/views/widget/widget_delegate.h" | 22 #include "ui/views/widget/widget_delegate.h" |
23 | 23 |
24 namespace ash { | 24 namespace ash { |
25 namespace test { | 25 namespace test { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 // When keyboard is hidden make sure that rotating the screen gives 100% of | 206 // When keyboard is hidden make sure that rotating the screen gives 100% of |
207 // screen size to window. | 207 // screen size to window. |
208 // Repro steps for http://crbug.com/401667: | 208 // Repro steps for http://crbug.com/401667: |
209 // 1. Set up login screen defaults: VK override disabled | 209 // 1. Set up login screen defaults: VK override disabled |
210 // 2. Show/hide keyboard, make sure that no stale keyboard bounds are cached. | 210 // 2. Show/hide keyboard, make sure that no stale keyboard bounds are cached. |
211 keyboard::SetKeyboardOverscrollOverride( | 211 keyboard::SetKeyboardOverscrollOverride( |
212 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED); | 212 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED); |
213 ShowKeyboard(true); | 213 ShowKeyboard(true); |
214 ShowKeyboard(false); | 214 ShowKeyboard(false); |
215 ash::DisplayManager* display_manager = | 215 display_manager()->SetDisplayRotation( |
216 Shell::GetInstance()->display_manager(); | 216 primary_display.id(), display::Display::ROTATE_90, |
217 display_manager->SetDisplayRotation(primary_display.id(), | 217 display::Display::ROTATION_SOURCE_ACTIVE); |
218 display::Display::ROTATE_90, | |
219 display::Display::ROTATION_SOURCE_ACTIVE); | |
220 primary_display = display::Screen::GetScreen()->GetPrimaryDisplay(); | 218 primary_display = display::Screen::GetScreen()->GetPrimaryDisplay(); |
221 screen_bounds = primary_display.bounds(); | 219 screen_bounds = primary_display.bounds(); |
222 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 220 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
223 display_manager->SetDisplayRotation(primary_display.id(), | 221 display_manager()->SetDisplayRotation( |
224 display::Display::ROTATE_0, | 222 primary_display.id(), display::Display::ROTATE_0, |
225 display::Display::ROTATION_SOURCE_ACTIVE); | 223 display::Display::ROTATION_SOURCE_ACTIVE); |
226 | 224 |
227 // When virtual keyboard overscroll is disabled keyboard bounds do | 225 // When virtual keyboard overscroll is disabled keyboard bounds do |
228 // affect window bounds. | 226 // affect window bounds. |
229 keyboard::SetKeyboardOverscrollOverride( | 227 keyboard::SetKeyboardOverscrollOverride( |
230 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED); | 228 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED); |
231 ShowKeyboard(true); | 229 ShowKeyboard(true); |
232 keyboard::KeyboardController* keyboard = | 230 keyboard::KeyboardController* keyboard = |
233 keyboard::KeyboardController::GetInstance(); | 231 keyboard::KeyboardController::GetInstance(); |
234 primary_display = display::Screen::GetScreen()->GetPrimaryDisplay(); | 232 primary_display = display::Screen::GetScreen()->GetPrimaryDisplay(); |
235 screen_bounds = primary_display.bounds(); | 233 screen_bounds = primary_display.bounds(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()); | 288 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()); |
291 window->SetBounds(work_area); | 289 window->SetBounds(work_area); |
292 // Usually work_area takes Shelf into account but that doesn't affect | 290 // Usually work_area takes Shelf into account but that doesn't affect |
293 // LockScreen container windows. | 291 // LockScreen container windows. |
294 EXPECT_NE(work_area.ToString(), window->GetBoundsInScreen().ToString()); | 292 EXPECT_NE(work_area.ToString(), window->GetBoundsInScreen().ToString()); |
295 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 293 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
296 } | 294 } |
297 | 295 |
298 } // namespace test | 296 } // namespace test |
299 } // namespace ash | 297 } // namespace ash |
OLD | NEW |