| 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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/session_state_delegate.h" | 8 #include "ash/session_state_delegate.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 return widget; | 111 return widget; |
| 112 } | 112 } |
| 113 | 113 |
| 114 aura::Window* GetModalContainer(aura::RootWindow* root_window) { | 114 aura::Window* GetModalContainer(aura::RootWindow* root_window) { |
| 115 return Shell::GetContainer( | 115 return Shell::GetContainer( |
| 116 root_window, | 116 root_window, |
| 117 ash::internal::kShellWindowId_SystemModalContainer); | 117 ash::internal::kShellWindowId_SystemModalContainer); |
| 118 } | 118 } |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 #if defined(OS_WIN) | 121 TEST_F(RootWindowControllerTest, MoveWindows_Basic) { |
| 122 // Multiple displays are not supported on Windows Ash. http://crbug.com/165962 | 122 if (!SupportsMultipleDisplays()) |
| 123 #define MAYBE_MoveWindows_Basic DISABLED_MoveWindows_Basic | 123 return; |
| 124 #else | |
| 125 #define MAYBE_MoveWindows_Basic MoveWindows_Basic | |
| 126 #endif | |
| 127 | 124 |
| 128 TEST_F(RootWindowControllerTest, MAYBE_MoveWindows_Basic) { | |
| 129 UpdateDisplay("600x600,500x500"); | 125 UpdateDisplay("600x600,500x500"); |
| 130 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 126 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 131 internal::RootWindowController* controller = | 127 internal::RootWindowController* controller = |
| 132 Shell::GetPrimaryRootWindowController(); | 128 Shell::GetPrimaryRootWindowController(); |
| 133 internal::ShelfLayoutManager* shelf_layout_manager = | 129 internal::ShelfLayoutManager* shelf_layout_manager = |
| 134 controller->GetShelfLayoutManager(); | 130 controller->GetShelfLayoutManager(); |
| 135 shelf_layout_manager->SetAutoHideBehavior( | 131 shelf_layout_manager->SetAutoHideBehavior( |
| 136 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 132 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 137 | 133 |
| 138 views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100)); | 134 views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100)); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 EXPECT_EQ(root_windows[0], | 230 EXPECT_EQ(root_windows[0], |
| 235 unparented_control->GetNativeView()->GetRootWindow()); | 231 unparented_control->GetNativeView()->GetRootWindow()); |
| 236 EXPECT_EQ(internal::kShellWindowId_UnparentedControlContainer, | 232 EXPECT_EQ(internal::kShellWindowId_UnparentedControlContainer, |
| 237 unparented_control->GetNativeView()->parent()->id()); | 233 unparented_control->GetNativeView()->parent()->id()); |
| 238 | 234 |
| 239 // Test if the panel has moved. | 235 // Test if the panel has moved. |
| 240 EXPECT_EQ(root_windows[0], panel->GetRootWindow()); | 236 EXPECT_EQ(root_windows[0], panel->GetRootWindow()); |
| 241 EXPECT_EQ(internal::kShellWindowId_PanelContainer, panel->parent()->id()); | 237 EXPECT_EQ(internal::kShellWindowId_PanelContainer, panel->parent()->id()); |
| 242 } | 238 } |
| 243 | 239 |
| 244 #if defined(OS_WIN) | 240 TEST_F(RootWindowControllerTest, MoveWindows_Modal) { |
| 245 // Multiple displays are not supported on Windows Ash. http://crbug.com/165962 | 241 if (!SupportsMultipleDisplays()) |
| 246 #define MAYBE_MoveWindows_Modal DISABLED_MoveWindows_Modal | 242 return; |
| 247 #else | |
| 248 #define MAYBE_MoveWindows_Modal MoveWindows_Modal | |
| 249 #endif | |
| 250 | 243 |
| 251 TEST_F(RootWindowControllerTest, MAYBE_MoveWindows_Modal) { | |
| 252 UpdateDisplay("500x500,500x500"); | 244 UpdateDisplay("500x500,500x500"); |
| 253 | 245 |
| 254 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 246 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 255 // Emulate virtual screen coordinate system. | 247 // Emulate virtual screen coordinate system. |
| 256 root_windows[0]->SetBounds(gfx::Rect(0, 0, 500, 500)); | 248 root_windows[0]->SetBounds(gfx::Rect(0, 0, 500, 500)); |
| 257 root_windows[1]->SetBounds(gfx::Rect(500, 0, 500, 500)); | 249 root_windows[1]->SetBounds(gfx::Rect(500, 0, 500, 500)); |
| 258 | 250 |
| 259 views::Widget* normal = CreateTestWidget(gfx::Rect(300, 10, 100, 100)); | 251 views::Widget* normal = CreateTestWidget(gfx::Rect(300, 10, 100, 100)); |
| 260 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); | 252 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); |
| 261 EXPECT_TRUE(wm::IsActiveWindow(normal->GetNativeView())); | 253 EXPECT_TRUE(wm::IsActiveWindow(normal->GetNativeView())); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 w1->Activate(); | 383 w1->Activate(); |
| 392 EXPECT_FALSE(controller->GetFullscreenWindow()); | 384 EXPECT_FALSE(controller->GetFullscreenWindow()); |
| 393 | 385 |
| 394 // If the fullscreen window is active, GetFullscreenWindow() should find it. | 386 // If the fullscreen window is active, GetFullscreenWindow() should find it. |
| 395 w2->Activate(); | 387 w2->Activate(); |
| 396 EXPECT_EQ(w2->GetNativeWindow(), controller->GetFullscreenWindow()); | 388 EXPECT_EQ(w2->GetNativeWindow(), controller->GetFullscreenWindow()); |
| 397 } | 389 } |
| 398 | 390 |
| 399 } // namespace test | 391 } // namespace test |
| 400 } // namespace ash | 392 } // namespace ash |
| OLD | NEW |