| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/dock/docked_window_layout_manager.h" | 5 #include "ash/wm/dock/docked_window_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0); | 230 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0); |
| 231 | 231 |
| 232 // The window should be attached and docked at the right edge. | 232 // The window should be attached and docked at the right edge. |
| 233 // Its width should shrink or grow to ideal width. | 233 // Its width should shrink or grow to ideal width. |
| 234 EXPECT_EQ(window->GetRootWindow()->bounds().right(), | 234 EXPECT_EQ(window->GetRootWindow()->bounds().right(), |
| 235 window->GetBoundsInScreen().right()); | 235 window->GetBoundsInScreen().right()); |
| 236 EXPECT_EQ(ideal_width(), window->bounds().width()); | 236 EXPECT_EQ(ideal_width(), window->bounds().width()); |
| 237 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); | 237 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); |
| 238 } | 238 } |
| 239 | 239 |
| 240 // Tests that a docked window's bounds cannot be changed programmatically. |
| 241 TEST_P(DockedWindowLayoutManagerTest, DockedWindowBoundsDontChange) { |
| 242 if (!SupportsHostWindowResize()) |
| 243 return; |
| 244 |
| 245 gfx::Rect bounds(0, 0, 201, 201); |
| 246 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); |
| 247 DragRelativeToEdge(DOCKED_EDGE_RIGHT, window.get(), 0); |
| 248 |
| 249 // The window should be attached and docked at the right edge. |
| 250 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); |
| 251 |
| 252 bounds = window->GetBoundsInScreen(); |
| 253 window->SetBounds(gfx::Rect(210, 210, 210, 210)); |
| 254 EXPECT_EQ(bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 255 } |
| 256 |
| 240 // Tests that with a window docked on the left the auto-placing logic in | 257 // Tests that with a window docked on the left the auto-placing logic in |
| 241 // RearrangeVisibleWindowOnShow places windows flush with work area edges. | 258 // RearrangeVisibleWindowOnShow places windows flush with work area edges. |
| 242 TEST_P(DockedWindowLayoutManagerTest, AutoPlacingLeft) { | 259 TEST_P(DockedWindowLayoutManagerTest, AutoPlacingLeft) { |
| 243 if (!SupportsHostWindowResize()) | 260 if (!SupportsHostWindowResize()) |
| 244 return; | 261 return; |
| 245 | 262 |
| 246 gfx::Rect bounds(0, 0, 201, 201); | 263 gfx::Rect bounds(0, 0, 201, 201); |
| 247 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); | 264 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); |
| 248 DragRelativeToEdge(DOCKED_EDGE_LEFT, window.get(), 0); | 265 DragRelativeToEdge(DOCKED_EDGE_LEFT, window.get(), 0); |
| 249 | 266 |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); | 851 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); |
| 835 } | 852 } |
| 836 | 853 |
| 837 // Tests run twice - on both panels and normal windows | 854 // Tests run twice - on both panels and normal windows |
| 838 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 855 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
| 839 DockedWindowLayoutManagerTest, | 856 DockedWindowLayoutManagerTest, |
| 840 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 857 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 841 ui::wm::WINDOW_TYPE_PANEL)); | 858 ui::wm::WINDOW_TYPE_PANEL)); |
| 842 | 859 |
| 843 } // namespace ash | 860 } // namespace ash |
| OLD | NEW |