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/display/display_layout.h" | 7 #include "ash/display/display_layout.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/screen_ash.h" | 10 #include "ash/screen_ash.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 EXPECT_EQ(Shell::GetPrimaryRootWindow(), window->GetRootWindow()); | 90 EXPECT_EQ(Shell::GetPrimaryRootWindow(), window->GetRootWindow()); |
91 EXPECT_TRUE( | 91 EXPECT_TRUE( |
92 Shell::GetPrimaryRootWindow()->bounds().Intersects(window->bounds())); | 92 Shell::GetPrimaryRootWindow()->bounds().Intersects(window->bounds())); |
93 } | 93 } |
94 | 94 |
95 TEST_F(WorkspaceLayoutManagerTest, KeepMinimumVisibilityInDisplays) { | 95 TEST_F(WorkspaceLayoutManagerTest, KeepMinimumVisibilityInDisplays) { |
96 if (!SupportsMultipleDisplays()) | 96 if (!SupportsMultipleDisplays()) |
97 return; | 97 return; |
98 | 98 |
99 UpdateDisplay("300x400,400x500"); | 99 UpdateDisplay("300x400,400x500"); |
100 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 100 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
101 | 101 |
102 DisplayLayout layout(DisplayLayout::TOP, 0); | 102 DisplayLayout layout(DisplayLayout::TOP, 0); |
103 Shell::GetInstance()->display_manager()-> | 103 Shell::GetInstance()->display_manager()-> |
104 SetLayoutForCurrentDisplays(layout); | 104 SetLayoutForCurrentDisplays(layout); |
105 EXPECT_EQ("0,-500 400x500", root_windows[1]->GetBoundsInScreen().ToString()); | 105 EXPECT_EQ("0,-500 400x500", root_windows[1]->GetBoundsInScreen().ToString()); |
106 | 106 |
107 scoped_ptr<aura::Window> window1( | 107 scoped_ptr<aura::Window> window1( |
108 CreateTestWindowInShellWithBounds(gfx::Rect(10, -400, 200, 200))); | 108 CreateTestWindowInShellWithBounds(gfx::Rect(10, -400, 200, 200))); |
109 EXPECT_EQ("10,-400 200x200", window1->GetBoundsInScreen().ToString()); | 109 EXPECT_EQ("10,-400 200x200", window1->GetBoundsInScreen().ToString()); |
110 | 110 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 Shell::GetPrimaryRootWindow()->bounds().Intersects(window->bounds())); | 153 Shell::GetPrimaryRootWindow()->bounds().Intersects(window->bounds())); |
154 // Y bounds should not be negative. | 154 // Y bounds should not be negative. |
155 EXPECT_EQ("-20,0 30x40", window->bounds().ToString()); | 155 EXPECT_EQ("-20,0 30x40", window->bounds().ToString()); |
156 } | 156 } |
157 | 157 |
158 TEST_F(WorkspaceLayoutManagerTest, MaximizeInDisplayToBeRestored) { | 158 TEST_F(WorkspaceLayoutManagerTest, MaximizeInDisplayToBeRestored) { |
159 if (!SupportsMultipleDisplays()) | 159 if (!SupportsMultipleDisplays()) |
160 return; | 160 return; |
161 UpdateDisplay("300x400,400x500"); | 161 UpdateDisplay("300x400,400x500"); |
162 | 162 |
163 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 163 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
164 | 164 |
165 scoped_ptr<aura::Window> window( | 165 scoped_ptr<aura::Window> window( |
166 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 30, 40))); | 166 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 30, 40))); |
167 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 167 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
168 | 168 |
169 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 169 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
170 window_state->SetRestoreBoundsInScreen(gfx::Rect(400, 0, 30, 40)); | 170 window_state->SetRestoreBoundsInScreen(gfx::Rect(400, 0, 30, 40)); |
171 // Maximize the window in 2nd display as the restore bounds | 171 // Maximize the window in 2nd display as the restore bounds |
172 // is inside 2nd display. | 172 // is inside 2nd display. |
173 window_state->Maximize(); | 173 window_state->Maximize(); |
(...skipping 29 matching lines...) Expand all Loading... |
203 w1->Restore(); | 203 w1->Restore(); |
204 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); | 204 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); |
205 EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString()); | 205 EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString()); |
206 } | 206 } |
207 | 207 |
208 TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) { | 208 TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) { |
209 if (!SupportsMultipleDisplays()) | 209 if (!SupportsMultipleDisplays()) |
210 return; | 210 return; |
211 UpdateDisplay("300x400,400x500"); | 211 UpdateDisplay("300x400,400x500"); |
212 | 212 |
213 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 213 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
214 | 214 |
215 scoped_ptr<aura::Window> window( | 215 scoped_ptr<aura::Window> window( |
216 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 30, 40))); | 216 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 30, 40))); |
217 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 217 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
218 | 218 |
219 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 219 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
220 window_state->SetRestoreBoundsInScreen(gfx::Rect(400, 0, 30, 40)); | 220 window_state->SetRestoreBoundsInScreen(gfx::Rect(400, 0, 30, 40)); |
221 // Maximize the window in 2nd display as the restore bounds | 221 // Maximize the window in 2nd display as the restore bounds |
222 // is inside 2nd display. | 222 // is inside 2nd display. |
223 window->SetProperty(aura::client::kShowStateKey, | 223 window->SetProperty(aura::client::kShowStateKey, |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 window->bounds().ToString()); | 401 window->bounds().ToString()); |
402 | 402 |
403 // Directly setting the bounds triggers a slightly different code path. Verify | 403 // Directly setting the bounds triggers a slightly different code path. Verify |
404 // that too. | 404 // that too. |
405 window->SetBounds(window_bounds); | 405 window->SetBounds(window_bounds); |
406 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), | 406 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), |
407 window->bounds().ToString()); | 407 window->bounds().ToString()); |
408 } | 408 } |
409 | 409 |
410 } // namespace ash | 410 } // namespace ash |
OLD | NEW |