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