| 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/public/cpp/shell_window_ids.h" | 6 #include "ash/public/cpp/shell_window_ids.h" |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.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" |
| 11 #include "ash/wm/window_state_aura.h" | 11 #include "ash/wm/window_state_aura.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 13 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
| 14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 15 #include "ui/display/manager/display_manager.h" | 16 #include "ui/display/manager/display_manager.h" |
| 16 #include "ui/display/screen.h" | 17 #include "ui/display/screen.h" |
| 17 #include "ui/keyboard/keyboard_controller.h" | 18 #include "ui/keyboard/keyboard_controller.h" |
| 18 #include "ui/keyboard/keyboard_switches.h" | 19 #include "ui/keyboard/keyboard_switches.h" |
| 19 #include "ui/keyboard/keyboard_ui.h" | 20 #include "ui/keyboard/keyboard_ui.h" |
| 20 #include "ui/keyboard/keyboard_util.h" | 21 #include "ui/keyboard/keyboard_util.h" |
| 21 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 22 #include "ui/views/widget/widget_delegate.h" | 23 #include "ui/views/widget/widget_delegate.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 UpdateDisplay("300x400,400x500"); | 250 UpdateDisplay("300x400,400x500"); |
| 250 gfx::Rect screen_bounds = | 251 gfx::Rect screen_bounds = |
| 251 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); | 252 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); |
| 252 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 253 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 253 | 254 |
| 254 views::Widget::InitParams widget_params( | 255 views::Widget::InitParams widget_params( |
| 255 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 256 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 256 widget_params.show_state = ui::SHOW_STATE_FULLSCREEN; | 257 widget_params.show_state = ui::SHOW_STATE_FULLSCREEN; |
| 257 std::unique_ptr<aura::Window> window( | 258 std::unique_ptr<aura::Window> window( |
| 258 CreateTestLoginWindow(widget_params, false /* use_delegate */)); | 259 CreateTestLoginWindow(widget_params, false /* use_delegate */)); |
| 259 window->SetProperty(aura::client::kCanMaximizeKey, true); | 260 window->SetProperty(aura::client::kResizeBehaviorKey, |
| 261 ui::mojom::kResizeBehaviorCanMaximize); |
| 260 | 262 |
| 261 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 263 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 262 | 264 |
| 263 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 265 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 264 | 266 |
| 265 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 267 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 266 window_state->SetRestoreBoundsInScreen(gfx::Rect(400, 0, 30, 40)); | 268 window_state->SetRestoreBoundsInScreen(gfx::Rect(400, 0, 30, 40)); |
| 267 | 269 |
| 268 // Maximize the window with as the restore bounds is inside 2nd display but | 270 // Maximize the window with as the restore bounds is inside 2nd display but |
| 269 // lock container windows are always on primary display. | 271 // lock container windows are always on primary display. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 288 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()); | 290 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()); |
| 289 window->SetBounds(work_area); | 291 window->SetBounds(work_area); |
| 290 // Usually work_area takes Shelf into account but that doesn't affect | 292 // Usually work_area takes Shelf into account but that doesn't affect |
| 291 // LockScreen container windows. | 293 // LockScreen container windows. |
| 292 EXPECT_NE(work_area.ToString(), window->GetBoundsInScreen().ToString()); | 294 EXPECT_NE(work_area.ToString(), window->GetBoundsInScreen().ToString()); |
| 293 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 295 EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 294 } | 296 } |
| 295 | 297 |
| 296 } // namespace test | 298 } // namespace test |
| 297 } // namespace ash | 299 } // namespace ash |
| OLD | NEW |