diff options
author | pkotwicz <pkotwicz@chromium.org> | 2015-03-11 15:48:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-11 22:49:05 +0000 |
commit | 21a9d207e9e1f861bbd0e33e5b72481e4876a2e1 (patch) | |
tree | 04c85b1983abfa70dd9dd6fe8e198e473510a769 /ash/display/display_manager_unittest.cc | |
parent | 7364f80c3ba3c77f66ae06b6f4cc36c7c159d905 (diff) | |
download | chromium_src-21a9d207e9e1f861bbd0e33e5b72481e4876a2e1.zip chromium_src-21a9d207e9e1f861bbd0e33e5b72481e4876a2e1.tar.gz chromium_src-21a9d207e9e1f861bbd0e33e5b72481e4876a2e1.tar.bz2 |
Add more tests for mouse rotation,scale&position after display change
This CL also makes CursorWindowController::SetDisplay() update the cursor
rotation. This is consistent with the behavior of native cursors when
AshNativeCursorManager::SetDisplay() is called.
BUG=450860
TEST=See CL
Review URL: https://codereview.chromium.org/948583005
Cr-Commit-Position: refs/heads/master@{#320173}
Diffstat (limited to 'ash/display/display_manager_unittest.cc')
-rw-r--r-- | ash/display/display_manager_unittest.cc | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index 3d3bbec..fe240c6 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc @@ -701,90 +701,6 @@ TEST_F(DisplayManagerTest, MAYBE_TestNativeDisplaysChangedNoInternal) { GetBounds().size().ToString()); } -#if defined(OS_WIN) -// Tests that rely on the actual host size/location does not work on windows. -#define MAYBE_EnsurePointerInDisplays DISABLED_EnsurePointerInDisplays -#define MAYBE_EnsurePointerInDisplays_2ndOnLeft DISABLED_EnsurePointerInDisplays_2ndOnLeft -#else -#define MAYBE_EnsurePointerInDisplays EnsurePointerInDisplays -#define MAYBE_EnsurePointerInDisplays_2ndOnLeft EnsurePointerInDisplays_2ndOnLeft -#endif - -TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays) { - UpdateDisplay("200x200,300x300"); - aura::Window::Windows root_windows = Shell::GetAllRootWindows(); - - aura::Env* env = aura::Env::GetInstance(); - - ui::test::EventGenerator generator(root_windows[0]); - - // Set the initial position. - generator.MoveMouseToInHost(350, 150); - EXPECT_EQ("350,150", env->last_mouse_location().ToString()); - - // A mouse pointer will stay in the 2nd display. - UpdateDisplay("300x300,200x200"); - EXPECT_EQ("450,50", env->last_mouse_location().ToString()); - - // A mouse pointer will be outside of displays and move to the - // center of 2nd display. - UpdateDisplay("300x300,100x100"); - EXPECT_EQ("350,50", env->last_mouse_location().ToString()); - - // 2nd display was disconnected, and the cursor is - // now in the 1st display. - UpdateDisplay("400x400"); - EXPECT_EQ("50,350", env->last_mouse_location().ToString()); - - // 1st display's resolution has changed, and the mouse pointer is - // now outside. Move the mouse pointer to the center of 1st display. - UpdateDisplay("300x300"); - EXPECT_EQ("150,150", env->last_mouse_location().ToString()); - - // Move the mouse pointer to the bottom of 1st display. - generator.MoveMouseToInHost(150, 290); - EXPECT_EQ("150,290", env->last_mouse_location().ToString()); - - // The mouse pointer is now on 2nd display. - UpdateDisplay("300x280,200x200"); - EXPECT_EQ("450,10", env->last_mouse_location().ToString()); -} - -TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays_2ndOnLeft) { - // Set the 2nd display on the left. - DisplayLayoutStore* layout_store = - Shell::GetInstance()->display_manager()->layout_store(); - DisplayLayout layout = layout_store->default_display_layout(); - layout.position = DisplayLayout::LEFT; - layout_store->SetDefaultDisplayLayout(layout); - - UpdateDisplay("200x200,300x300"); - aura::Window::Windows root_windows = Shell::GetAllRootWindows(); - - EXPECT_EQ("-300,0 300x300", - ScreenUtil::GetSecondaryDisplay().bounds().ToString()); - - aura::Env* env = aura::Env::GetInstance(); - - // Set the initial position. - root_windows[0]->MoveCursorTo(gfx::Point(-150, 250)); - EXPECT_EQ("-150,250", env->last_mouse_location().ToString()); - - // A mouse pointer will stay in 2nd display. - UpdateDisplay("300x300,200x300"); - EXPECT_EQ("-50,150", env->last_mouse_location().ToString()); - - // A mouse pointer will be outside of displays and move to the - // center of 2nd display. - UpdateDisplay("300x300,200x100"); - EXPECT_EQ("-100,50", env->last_mouse_location().ToString()); - - // 2nd display was disconnected. Mouse pointer should move to - // 1st display. - UpdateDisplay("300x300"); - EXPECT_EQ("150,150", env->last_mouse_location().ToString()); -} - TEST_F(DisplayManagerTest, NativeDisplaysChangedAfterPrimaryChange) { if (!SupportsMultipleDisplays()) return; |