| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/wm/window_positioner.h" | 5 #include "ash/wm/window_positioner.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell/toplevel_window.h" | 10 #include "ash/shell/toplevel_window.h" |
| 11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/test/test_shell_delegate.h" | 12 #include "ash/test/test_shell_delegate.h" |
| 13 #include "ash/wm/common/window_state.h" | 13 #include "ash/wm/common/window_state.h" |
| 14 #include "ash/wm/window_positioner.h" | 14 #include "ash/wm/window_positioner.h" |
| 15 #include "ash/wm/window_state_aura.h" | 15 #include "ash/wm/window_state_aura.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "ui/aura/window_event_dispatcher.h" | 17 #include "ui/aura/window_event_dispatcher.h" |
| 18 #include "ui/gfx/screen.h" | 18 #include "ui/display/screen.h" |
| 19 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
| 20 #include "ui/views/widget/widget_delegate.h" | 20 #include "ui/views/widget/widget_delegate.h" |
| 21 | 21 |
| 22 namespace ash { | 22 namespace ash { |
| 23 | 23 |
| 24 typedef test::AshTestBase WindowPositionerTest; | 24 typedef test::AshTestBase WindowPositionerTest; |
| 25 | 25 |
| 26 TEST_F(WindowPositionerTest, OpenMaximizedWindowOnSecondDisplay) { | 26 TEST_F(WindowPositionerTest, OpenMaximizedWindowOnSecondDisplay) { |
| 27 if (!SupportsMultipleDisplays()) | 27 if (!SupportsMultipleDisplays()) |
| 28 return; | 28 return; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 54 params.can_maximize = true; | 54 params.can_maximize = true; |
| 55 views::Widget* widget = | 55 views::Widget* widget = |
| 56 shell::ToplevelWindow::CreateToplevelWindow(params); | 56 shell::ToplevelWindow::CreateToplevelWindow(params); |
| 57 gfx::Rect bounds = widget->GetWindowBoundsInScreen(); | 57 gfx::Rect bounds = widget->GetWindowBoundsInScreen(); |
| 58 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 59 EXPECT_TRUE(widget->IsMaximized()); | 59 EXPECT_TRUE(widget->IsMaximized()); |
| 60 #else | 60 #else |
| 61 // The window should be in the 2nd display with the default size. | 61 // The window should be in the 2nd display with the default size. |
| 62 EXPECT_EQ("300x300", bounds.size().ToString()); | 62 EXPECT_EQ("300x300", bounds.size().ToString()); |
| 63 #endif | 63 #endif |
| 64 EXPECT_TRUE(gfx::Screen::GetScreen() | 64 EXPECT_TRUE(display::Screen::GetScreen() |
| 65 ->GetDisplayNearestWindow(second_root_window) | 65 ->GetDisplayNearestWindow(second_root_window) |
| 66 .bounds() | 66 .bounds() |
| 67 .Contains(bounds)); | 67 .Contains(bounds)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Tests that second window inherits first window's maximized state as well as | 70 // Tests that second window inherits first window's maximized state as well as |
| 71 // its restore bounds. | 71 // its restore bounds. |
| 72 #if defined(OS_WIN) && !defined(USE_ASH) | 72 #if defined(OS_WIN) && !defined(USE_ASH) |
| 73 // TODO(msw): Broken on Windows. http://crbug.com/584038 | 73 // TODO(msw): Broken on Windows. http://crbug.com/584038 |
| 74 #define MAYBE_SecondMaximizedWindowHasProperRestoreSize \ | 74 #define MAYBE_SecondMaximizedWindowHasProperRestoreSize \ |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 widget1->SetFullscreen(false); | 233 widget1->SetFullscreen(false); |
| 234 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); | 234 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); |
| 235 | 235 |
| 236 // Closing 2nd widget triggers the rearrange logic but the 1st | 236 // Closing 2nd widget triggers the rearrange logic but the 1st |
| 237 // widget should stay in the current size. | 237 // widget should stay in the current size. |
| 238 widget2->CloseNow(); | 238 widget2->CloseNow(); |
| 239 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); | 239 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace ash | 242 } // namespace ash |
| OLD | NEW |