diff options
author | oshima <oshima@chromium.org> | 2015-04-30 17:15:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-01 00:15:34 +0000 |
commit | 022a9548a7eb8dd937c27e604d8916ffaf3f3740 (patch) | |
tree | 1be4e7ca9af8b7622472598c3f75a27fa09f1111 /ash/root_window_controller_unittest.cc | |
parent | fd2c19309ad364b7a5697f0a502667ae575c2e04 (diff) | |
download | chromium_src-022a9548a7eb8dd937c27e604d8916ffaf3f3740.zip chromium_src-022a9548a7eb8dd937c27e604d8916ffaf3f3740.tar.gz chromium_src-022a9548a7eb8dd937c27e604d8916ffaf3f3740.tar.bz2 |
Move login windows to/from unified desktop. This is necessary because in Unified desktop mode, the WTF for primary display gets recreated.
A few cleanups:
* Removed DisplayManager::multi_display_mode() and use IsInUnifiedMode() instead. It simply meant that it will use UNIFIED mode when there are two displays, and it's hard to use it correctly.
* Moved software_mirroring_enabled() to private, and changed clients to use SoftwareMirroringEnable() instead.
* Moved SetDefaultMultiDisplayMode to test api
* Removed unused function decl and unnecessary comment.
BUG=365662
TEST=RootWindowControllerTest.MoveWindows_LockWindowsInUnified
Review URL: https://codereview.chromium.org/1120563002
Cr-Commit-Position: refs/heads/master@{#327842}
Diffstat (limited to 'ash/root_window_controller_unittest.cc')
-rw-r--r-- | ash/root_window_controller_unittest.cc | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc index 8c5c516..8807851 100644 --- a/ash/root_window_controller_unittest.cc +++ b/ash/root_window_controller_unittest.cc @@ -10,6 +10,7 @@ #include "ash/shell_window_ids.h" #include "ash/system/tray/system_tray_delegate.h" #include "ash/test/ash_test_base.h" +#include "ash/test/display_manager_test_api.h" #include "ash/wm/system_modal_container_layout_manager.h" #include "ash/wm/window_properties.h" #include "ash/wm/window_state.h" @@ -289,6 +290,92 @@ TEST_F(RootWindowControllerTest, MoveWindows_Modal) { EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); } +// Make sure lock related windows moves. +TEST_F(RootWindowControllerTest, MoveWindows_LockWindowsInUnified) { + if (!SupportsMultipleDisplays()) + return; + DisplayManager* display_manager = Shell::GetInstance()->display_manager(); + DisplayManagerTestApi test_api(display_manager); + test_api.SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); + display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED); + UpdateDisplay("500x500"); + const int kLockScreenWindowId = 1000; + const int kLockBackgroundWindowId = 1001; + + RootWindowController* controller = + Shell::GetInstance()->GetPrimaryRootWindowController(); + + aura::Window* lock_container = + controller->GetContainer(kShellWindowId_LockScreenContainer); + aura::Window* lock_background_container = + controller->GetContainer(kShellWindowId_LockScreenBackgroundContainer); + + views::Widget* lock_screen = + CreateModalWidgetWithParent(gfx::Rect(10, 10, 100, 100), lock_container); + lock_screen->GetNativeWindow()->set_id(kLockScreenWindowId); + lock_screen->SetFullscreen(true); + + views::Widget* lock_background = CreateModalWidgetWithParent( + gfx::Rect(10, 10, 100, 100), lock_background_container); + lock_background->GetNativeWindow()->set_id(kLockBackgroundWindowId); + + ASSERT_EQ(lock_screen->GetNativeWindow(), + controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); + ASSERT_EQ(lock_background->GetNativeWindow(), + controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); + EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); + + // Switch to unified. + UpdateDisplay("500x500,500x500"); + + // In unified mode, RWC is created + controller = Shell::GetInstance()->GetPrimaryRootWindowController(); + + ASSERT_EQ(lock_screen->GetNativeWindow(), + controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); + ASSERT_EQ(lock_background->GetNativeWindow(), + controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); + EXPECT_EQ("0,0 1000x500", + lock_screen->GetNativeWindow()->bounds().ToString()); + + // Switch to mirror. + display_manager->SetMirrorMode(true); + EXPECT_TRUE(display_manager->IsInMirrorMode()); + + controller = Shell::GetInstance()->GetPrimaryRootWindowController(); + ASSERT_EQ(lock_screen->GetNativeWindow(), + controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); + ASSERT_EQ(lock_background->GetNativeWindow(), + controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); + EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); + + // Switch to unified. + display_manager->SetMirrorMode(false); + EXPECT_TRUE(display_manager->IsInUnifiedMode()); + + controller = Shell::GetInstance()->GetPrimaryRootWindowController(); + + ASSERT_EQ(lock_screen->GetNativeWindow(), + controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); + ASSERT_EQ(lock_background->GetNativeWindow(), + controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); + EXPECT_EQ("0,0 1000x500", + lock_screen->GetNativeWindow()->bounds().ToString()); + + // Switch to single display. + UpdateDisplay("600x500"); + EXPECT_FALSE(display_manager->IsInUnifiedMode()); + EXPECT_FALSE(display_manager->IsInMirrorMode()); + + controller = Shell::GetInstance()->GetPrimaryRootWindowController(); + + ASSERT_EQ(lock_screen->GetNativeWindow(), + controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); + ASSERT_EQ(lock_background->GetNativeWindow(), + controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); + EXPECT_EQ("0,0 600x500", lock_screen->GetNativeWindow()->bounds().ToString()); +} + TEST_F(RootWindowControllerTest, ModalContainer) { UpdateDisplay("600x600"); Shell* shell = Shell::GetInstance(); |