| 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/wm/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 13 #include "ash/wm/property_util.h" | 13 #include "ash/wm/property_util.h" |
| 14 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 15 #include "ui/aura/client/aura_constants.h" | 15 #include "ui/aura/client/aura_constants.h" |
| 16 #include "ui/aura/root_window.h" | 16 #include "ui/aura/root_window.h" |
| 17 #include "ui/aura/test/test_windows.h" | 17 #include "ui/aura/test/test_windows.h" |
| 18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
| 19 #include "ui/gfx/insets.h" | 19 #include "ui/gfx/insets.h" |
| 20 | 20 |
| 21 namespace ash { | 21 namespace ash { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 typedef test::AshTestBase WorkspaceLayoutManagerTest; | 25 typedef test::AshTestBase WorkspaceLayoutManagerTest; |
| 26 | 26 |
| 27 // Multi root doesn't work on Win8/metro. crbug.com/240628. | |
| 28 #if defined(OS_WIN) && defined(USE_AURA) | |
| 29 #define MAYBE_RestoreFromMinimizeKeepsRestore \ | |
| 30 DISABLED_RestoreFromMinimizeKeepsRestore | |
| 31 #else | |
| 32 #define MAYBE_RestoreFromMinimizeKeepsRestore RestoreFromMinimizeKeepsRestore | |
| 33 #endif | |
| 34 | |
| 35 // Verifies that a window containing a restore coordinate will be restored to | 27 // Verifies that a window containing a restore coordinate will be restored to |
| 36 // to the size prior to minimize, keeping the restore rectangle in tact (if | 28 // to the size prior to minimize, keeping the restore rectangle in tact (if |
| 37 // there is one). | 29 // there is one). |
| 38 TEST_F(WorkspaceLayoutManagerTest, MAYBE_RestoreFromMinimizeKeepsRestore) { | 30 TEST_F(WorkspaceLayoutManagerTest, RestoreFromMinimizeKeepsRestore) { |
| 39 scoped_ptr<aura::Window> window( | 31 scoped_ptr<aura::Window> window( |
| 40 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4))); | 32 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4))); |
| 41 gfx::Rect bounds(10, 15, 25, 35); | 33 gfx::Rect bounds(10, 15, 25, 35); |
| 42 window->SetBounds(bounds); | 34 window->SetBounds(bounds); |
| 43 // This will not be used for un-minimizing window. | 35 // This will not be used for un-minimizing window. |
| 44 SetRestoreBoundsInScreen(window.get(), gfx::Rect(0, 0, 100, 100)); | 36 SetRestoreBoundsInScreen(window.get(), gfx::Rect(0, 0, 100, 100)); |
| 45 wm::MinimizeWindow(window.get()); | 37 wm::MinimizeWindow(window.get()); |
| 46 wm::RestoreWindow(window.get()); | 38 wm::RestoreWindow(window.get()); |
| 47 EXPECT_EQ("0,0 100x100", GetRestoreBoundsInScreen(window.get())->ToString()); | 39 EXPECT_EQ("0,0 100x100", GetRestoreBoundsInScreen(window.get())->ToString()); |
| 48 EXPECT_EQ("10,15 25x35", window.get()->bounds().ToString()); | 40 EXPECT_EQ("10,15 25x35", window.get()->bounds().ToString()); |
| 49 | 41 |
| 42 if (!SupportsMultipleDisplays()) |
| 43 return; |
| 44 |
| 50 UpdateDisplay("400x300,500x400"); | 45 UpdateDisplay("400x300,500x400"); |
| 51 window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100), | 46 window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100), |
| 52 ScreenAsh::GetSecondaryDisplay()); | 47 ScreenAsh::GetSecondaryDisplay()); |
| 53 EXPECT_EQ(Shell::GetAllRootWindows()[1], window->GetRootWindow()); | 48 EXPECT_EQ(Shell::GetAllRootWindows()[1], window->GetRootWindow()); |
| 54 wm::MinimizeWindow(window.get()); | 49 wm::MinimizeWindow(window.get()); |
| 55 // This will not be used for un-minimizing window. | 50 // This will not be used for un-minimizing window. |
| 56 SetRestoreBoundsInScreen(window.get(), gfx::Rect(0, 0, 100, 100)); | 51 SetRestoreBoundsInScreen(window.get(), gfx::Rect(0, 0, 100, 100)); |
| 57 wm::RestoreWindow(window.get()); | 52 wm::RestoreWindow(window.get()); |
| 58 EXPECT_EQ("600,0 100x100", window->GetBoundsInScreen().ToString()); | 53 EXPECT_EQ("600,0 100x100", window->GetBoundsInScreen().ToString()); |
| 59 | 54 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 173 |
| 179 // Directly setting the bounds triggers a slightly different code path. Verify | 174 // Directly setting the bounds triggers a slightly different code path. Verify |
| 180 // that too. | 175 // that too. |
| 181 window->SetBounds(window_bounds); | 176 window->SetBounds(window_bounds); |
| 182 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), | 177 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), |
| 183 window->bounds().ToString()); | 178 window->bounds().ToString()); |
| 184 } | 179 } |
| 185 | 180 |
| 186 } // namespace | 181 } // namespace |
| 187 } // namespace ash | 182 } // namespace ash |
| OLD | NEW |