Chromium Code Reviews| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| 11 #include "ash/common/session/session_state_delegate.h" | 11 #include "ash/common/session/session_state_delegate.h" |
| 12 #include "ash/common/system/tray/system_tray_delegate.h" | 12 #include "ash/common/system/tray/system_tray_delegate.h" |
| 13 #include "ash/common/wm/system_modal_container_layout_manager.h" | 13 #include "ash/common/wm/system_modal_container_layout_manager.h" |
| 14 #include "ash/common/wm/window_state.h" | 14 #include "ash/common/wm/window_state.h" |
| 15 #include "ash/common/wm_lookup.h" | 15 #include "ash/common/wm_lookup.h" |
| 16 #include "ash/common/wm_root_window_controller.h" | 16 #include "ash/common/wm_root_window_controller.h" |
| 17 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
| 18 #include "ash/common/wm_window.h" | 18 #include "ash/common/wm_window.h" |
| 19 #include "ash/display/display_manager.h" | |
| 20 #include "ash/public/cpp/shell_window_ids.h" | 19 #include "ash/public/cpp/shell_window_ids.h" |
| 21 #include "ash/shell.h" | 20 #include "ash/shell.h" |
| 22 #include "ash/test/ash_md_test_base.h" | 21 #include "ash/test/ash_md_test_base.h" |
| 23 #include "ash/test/ash_test_base.h" | 22 #include "ash/test/ash_test_base.h" |
| 24 #include "ash/test/display_manager_test_api.h" | |
| 25 #include "ash/wm/window_properties.h" | 23 #include "ash/wm/window_properties.h" |
| 26 #include "ash/wm/window_state_aura.h" | 24 #include "ash/wm/window_state_aura.h" |
| 27 #include "ash/wm/window_util.h" | 25 #include "ash/wm/window_util.h" |
| 28 #include "base/command_line.h" | 26 #include "base/command_line.h" |
| 29 #include "ui/aura/client/focus_change_observer.h" | 27 #include "ui/aura/client/focus_change_observer.h" |
| 30 #include "ui/aura/client/focus_client.h" | 28 #include "ui/aura/client/focus_client.h" |
| 31 #include "ui/aura/client/window_parenting_client.h" | 29 #include "ui/aura/client/window_parenting_client.h" |
| 32 #include "ui/aura/env.h" | 30 #include "ui/aura/env.h" |
| 33 #include "ui/aura/test/test_window_delegate.h" | 31 #include "ui/aura/test/test_window_delegate.h" |
| 34 #include "ui/aura/test/test_windows.h" | 32 #include "ui/aura/test/test_windows.h" |
| 35 #include "ui/aura/window.h" | 33 #include "ui/aura/window.h" |
| 36 #include "ui/aura/window_event_dispatcher.h" | 34 #include "ui/aura/window_event_dispatcher.h" |
| 37 #include "ui/aura/window_tracker.h" | 35 #include "ui/aura/window_tracker.h" |
| 38 #include "ui/base/ime/dummy_text_input_client.h" | 36 #include "ui/base/ime/dummy_text_input_client.h" |
| 39 #include "ui/base/ime/input_method.h" | 37 #include "ui/base/ime/input_method.h" |
| 40 #include "ui/base/ime/text_input_client.h" | 38 #include "ui/base/ime/text_input_client.h" |
| 39 #include "ui/display/manager/display_manager.h" | |
| 40 #include "ui/display/test/display_manager_test_api.h" | |
|
oshima
2016/10/24 19:29:16
ditto
rjkroege
2016/10/25 23:30:26
Done.
| |
| 41 #include "ui/events/test/event_generator.h" | 41 #include "ui/events/test/event_generator.h" |
| 42 #include "ui/events/test/test_event_handler.h" | 42 #include "ui/events/test/test_event_handler.h" |
| 43 #include "ui/keyboard/keyboard_controller.h" | 43 #include "ui/keyboard/keyboard_controller.h" |
| 44 #include "ui/keyboard/keyboard_switches.h" | 44 #include "ui/keyboard/keyboard_switches.h" |
| 45 #include "ui/keyboard/keyboard_ui.h" | 45 #include "ui/keyboard/keyboard_ui.h" |
| 46 #include "ui/keyboard/keyboard_util.h" | 46 #include "ui/keyboard/keyboard_util.h" |
| 47 #include "ui/views/controls/menu/menu_controller.h" | 47 #include "ui/views/controls/menu/menu_controller.h" |
| 48 #include "ui/views/widget/widget.h" | 48 #include "ui/views/widget/widget.h" |
| 49 #include "ui/views/widget/widget_delegate.h" | 49 #include "ui/views/widget/widget_delegate.h" |
| 50 | 50 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow()); | 291 EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow()); |
| 292 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); | 292 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); |
| 293 generator_1st.ClickLeftButton(); | 293 generator_1st.ClickLeftButton(); |
| 294 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); | 294 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); |
| 295 } | 295 } |
| 296 | 296 |
| 297 // Make sure lock related windows moves. | 297 // Make sure lock related windows moves. |
| 298 TEST_P(RootWindowControllerTest, MoveWindows_LockWindowsInUnified) { | 298 TEST_P(RootWindowControllerTest, MoveWindows_LockWindowsInUnified) { |
| 299 if (!SupportsMultipleDisplays()) | 299 if (!SupportsMultipleDisplays()) |
| 300 return; | 300 return; |
| 301 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); | 301 display_manager()->SetUnifiedDesktopEnabled(true); |
| 302 | 302 |
| 303 UpdateDisplay("500x500"); | 303 UpdateDisplay("500x500"); |
| 304 const int kLockScreenWindowId = 1000; | 304 const int kLockScreenWindowId = 1000; |
| 305 const int kLockWallpaperWindowId = 1001; | 305 const int kLockWallpaperWindowId = 1001; |
| 306 | 306 |
| 307 RootWindowController* controller = Shell::GetPrimaryRootWindowController(); | 307 RootWindowController* controller = Shell::GetPrimaryRootWindowController(); |
| 308 | 308 |
| 309 aura::Window* lock_container = | 309 aura::Window* lock_container = |
| 310 controller->GetContainer(kShellWindowId_LockScreenContainer); | 310 controller->GetContainer(kShellWindowId_LockScreenContainer); |
| 311 aura::Window* lock_wallpaper_container = | 311 aura::Window* lock_wallpaper_container = |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 332 // In unified mode, RWC is created | 332 // In unified mode, RWC is created |
| 333 controller = Shell::GetPrimaryRootWindowController(); | 333 controller = Shell::GetPrimaryRootWindowController(); |
| 334 | 334 |
| 335 ASSERT_EQ(lock_screen->GetNativeWindow(), | 335 ASSERT_EQ(lock_screen->GetNativeWindow(), |
| 336 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); | 336 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); |
| 337 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), | 337 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), |
| 338 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); | 338 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); |
| 339 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); | 339 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); |
| 340 | 340 |
| 341 // Switch to mirror. | 341 // Switch to mirror. |
| 342 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 342 display_manager()->SetMirrorMode(true); |
| 343 display_manager->SetMirrorMode(true); | 343 EXPECT_TRUE(display_manager()->IsInMirrorMode()); |
| 344 EXPECT_TRUE(display_manager->IsInMirrorMode()); | |
| 345 | 344 |
| 346 controller = Shell::GetPrimaryRootWindowController(); | 345 controller = Shell::GetPrimaryRootWindowController(); |
| 347 ASSERT_EQ(lock_screen->GetNativeWindow(), | 346 ASSERT_EQ(lock_screen->GetNativeWindow(), |
| 348 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); | 347 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); |
| 349 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), | 348 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), |
| 350 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); | 349 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); |
| 351 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); | 350 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); |
| 352 | 351 |
| 353 // Switch to unified. | 352 // Switch to unified. |
| 354 display_manager->SetMirrorMode(false); | 353 display_manager()->SetMirrorMode(false); |
| 355 EXPECT_TRUE(display_manager->IsInUnifiedMode()); | 354 EXPECT_TRUE(display_manager()->IsInUnifiedMode()); |
| 356 | 355 |
| 357 controller = Shell::GetPrimaryRootWindowController(); | 356 controller = Shell::GetPrimaryRootWindowController(); |
| 358 | 357 |
| 359 ASSERT_EQ(lock_screen->GetNativeWindow(), | 358 ASSERT_EQ(lock_screen->GetNativeWindow(), |
| 360 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); | 359 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); |
| 361 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), | 360 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), |
| 362 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); | 361 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); |
| 363 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); | 362 EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); |
| 364 | 363 |
| 365 // Switch to single display. | 364 // Switch to single display. |
| 366 UpdateDisplay("600x500"); | 365 UpdateDisplay("600x500"); |
| 367 EXPECT_FALSE(display_manager->IsInUnifiedMode()); | 366 EXPECT_FALSE(display_manager()->IsInUnifiedMode()); |
| 368 EXPECT_FALSE(display_manager->IsInMirrorMode()); | 367 EXPECT_FALSE(display_manager()->IsInMirrorMode()); |
| 369 | 368 |
| 370 controller = Shell::GetPrimaryRootWindowController(); | 369 controller = Shell::GetPrimaryRootWindowController(); |
| 371 | 370 |
| 372 ASSERT_EQ(lock_screen->GetNativeWindow(), | 371 ASSERT_EQ(lock_screen->GetNativeWindow(), |
| 373 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); | 372 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); |
| 374 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), | 373 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), |
| 375 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); | 374 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); |
| 376 EXPECT_EQ("0,0 600x500", lock_screen->GetNativeWindow()->bounds().ToString()); | 375 EXPECT_EQ("0,0 600x500", lock_screen->GetNativeWindow()->bounds().ToString()); |
| 377 } | 376 } |
| 378 | 377 |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1033 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( | 1032 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( |
| 1034 gfx::Rect(0, 400, 800, 200)); | 1033 gfx::Rect(0, 400, 800, 200)); |
| 1035 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); | 1034 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); |
| 1036 | 1035 |
| 1037 UpdateDisplay("600x800"); | 1036 UpdateDisplay("600x800"); |
| 1038 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); | 1037 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); |
| 1039 } | 1038 } |
| 1040 | 1039 |
| 1041 } // namespace test | 1040 } // namespace test |
| 1042 } // namespace ash | 1041 } // namespace ash |
| OLD | NEW |