Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "ash/wm/ash_native_cursor_manager.h" | 4 #include "ash/wm/native_cursor_manager_ash.h" |
|
James Cook
2017/06/13 00:49:27
nit: blank line above
Elliot Glaysher
2017/06/13 18:05:45
Done.
| |
| 5 | 5 |
| 6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
| 7 #include "ash/test/ash_interactive_ui_test_base.h" | 7 #include "ash/test/ash_interactive_ui_test_base.h" |
| 8 #include "ash/test/cursor_manager_test_api.h" | 8 #include "ash/test/cursor_manager_test_api.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 #include "ui/aura/window_tree_host.h" | 11 #include "ui/aura/window_tree_host.h" |
| 12 #include "ui/base/test/ui_controls.h" | 12 #include "ui/base/test/ui_controls.h" |
| 13 #include "ui/display/manager/display_manager.h" | 13 #include "ui/display/manager/display_manager.h" |
| 14 #include "ui/display/manager/managed_display_info.h" | 14 #include "ui/display/manager/managed_display_info.h" |
| 15 | 15 |
| 16 #if defined(USE_X11) | 16 #if defined(USE_X11) |
| 17 #include <X11/Xlib.h> | 17 #include <X11/Xlib.h> |
| 18 | 18 |
| 19 #include "ui/gfx/x/x11_types.h" | 19 #include "ui/gfx/x/x11_types.h" |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 namespace ash { | 22 namespace ash { |
| 23 | 23 |
| 24 using AshNativeCursorManagerTest = test::AshInteractiveUITestBase; | 24 using NativeCursorManagerAshTest = test::AshInteractiveUITestBase; |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 display::ManagedDisplayInfo CreateDisplayInfo(int64_t id, | 28 display::ManagedDisplayInfo CreateDisplayInfo(int64_t id, |
| 29 const gfx::Rect& bounds, | 29 const gfx::Rect& bounds, |
| 30 float device_scale_factor) { | 30 float device_scale_factor) { |
| 31 display::ManagedDisplayInfo info(id, "", false); | 31 display::ManagedDisplayInfo info(id, "", false); |
| 32 info.SetBounds(bounds); | 32 info.SetBounds(bounds); |
| 33 info.set_device_scale_factor(device_scale_factor); | 33 info.set_device_scale_factor(device_scale_factor); |
| 34 return info; | 34 return info; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 #if defined(USE_X11) | 52 #if defined(USE_X11) |
| 53 #define MAYBE_CursorChangeOnEnterNotify CursorChangeOnEnterNotify | 53 #define MAYBE_CursorChangeOnEnterNotify CursorChangeOnEnterNotify |
| 54 #else | 54 #else |
| 55 #define MAYBE_CursorChangeOnEnterNotify DISABLED_CursorChangeOnEnterNotify | 55 #define MAYBE_CursorChangeOnEnterNotify DISABLED_CursorChangeOnEnterNotify |
| 56 #endif | 56 #endif |
| 57 | 57 |
| 58 TEST_F(AshNativeCursorManagerTest, MAYBE_CursorChangeOnEnterNotify) { | 58 TEST_F(NativeCursorManagerAshTest, MAYBE_CursorChangeOnEnterNotify) { |
| 59 ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); | 59 ::wm::CursorManager* cursor_manager = Shell::Get()->cursor_manager(); |
| 60 test::CursorManagerTestApi test_api(cursor_manager); | 60 test::CursorManagerTestApi test_api(cursor_manager); |
| 61 | 61 |
| 62 display::ManagedDisplayInfo display_info1 = | 62 display::ManagedDisplayInfo display_info1 = |
| 63 CreateDisplayInfo(10, gfx::Rect(0, 0, 500, 300), 1.0f); | 63 CreateDisplayInfo(10, gfx::Rect(0, 0, 500, 300), 1.0f); |
| 64 display::ManagedDisplayInfo display_info2 = | 64 display::ManagedDisplayInfo display_info2 = |
| 65 CreateDisplayInfo(20, gfx::Rect(500, 0, 500, 300), 2.0f); | 65 CreateDisplayInfo(20, gfx::Rect(500, 0, 500, 300), 2.0f); |
| 66 std::vector<display::ManagedDisplayInfo> display_info_list; | 66 std::vector<display::ManagedDisplayInfo> display_info_list; |
| 67 display_info_list.push_back(display_info1); | 67 display_info_list.push_back(display_info1); |
| 68 display_info_list.push_back(display_info2); | 68 display_info_list.push_back(display_info2); |
| 69 display_manager()->OnNativeDisplaysChanged(display_info_list); | 69 display_manager()->OnNativeDisplaysChanged(display_info_list); |
| 70 | 70 |
| 71 MoveMouseSync(Shell::GetAllRootWindows()[0], 10, 10); | 71 MoveMouseSync(Shell::GetAllRootWindows()[0], 10, 10); |
| 72 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); | 72 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); |
| 73 | 73 |
| 74 MoveMouseSync(Shell::GetAllRootWindows()[0], 600, 10); | 74 MoveMouseSync(Shell::GetAllRootWindows()[0], 600, 10); |
| 75 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); | 75 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace ash | 78 } // namespace ash |
| OLD | NEW |