| 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/ash_native_cursor_manager.h" |
| 5 | 5 |
| 6 #include "ash/display/display_info.h" | 6 #include "ash/display/display_info.h" |
| 7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/test/cursor_manager_test_api.h" | 10 #include "ash/test/cursor_manager_test_api.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/aura/window_tree_host.h" | 14 #include "ui/aura/window_tree_host.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/base/test/ui_controls.h" | 16 #include "ui/base/test/ui_controls.h" |
| 17 #include "ui/base/ui_base_paths.h" | 17 #include "ui/base/ui_base_paths.h" |
| 18 #include "ui/gl/gl_surface.h" | 18 #include "ui/gl/gl_surface.h" |
| 19 | 19 |
| 20 #if defined(USE_X11) | 20 #if defined(USE_X11) |
| 21 #include <X11/Xlib.h> | 21 #include <X11/Xlib.h> |
| 22 | 22 |
| 23 #include "base/message_loop/message_pump_x11.h" | 23 #include "ui/gfx/x/x11_types.h" |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 namespace ash { | 26 namespace ash { |
| 27 | 27 |
| 28 class AshNativeCursorManagerTest : public test::AshTestBase { | 28 class AshNativeCursorManagerTest : public test::AshTestBase { |
| 29 public: | 29 public: |
| 30 AshNativeCursorManagerTest() {} | 30 AshNativeCursorManagerTest() {} |
| 31 virtual ~AshNativeCursorManagerTest() {} | 31 virtual ~AshNativeCursorManagerTest() {} |
| 32 | 32 |
| 33 virtual void SetUp() OVERRIDE { | 33 virtual void SetUp() OVERRIDE { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 52 const gfx::Rect& bounds, | 52 const gfx::Rect& bounds, |
| 53 float device_scale_factor) { | 53 float device_scale_factor) { |
| 54 DisplayInfo info(id, "", false); | 54 DisplayInfo info(id, "", false); |
| 55 info.SetBounds(bounds); | 55 info.SetBounds(bounds); |
| 56 info.set_device_scale_factor(device_scale_factor); | 56 info.set_device_scale_factor(device_scale_factor); |
| 57 return info; | 57 return info; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void MoveMouseSync(aura::Window* window, int x, int y) { | 60 void MoveMouseSync(aura::Window* window, int x, int y) { |
| 61 #if defined(USE_X11) | 61 #if defined(USE_X11) |
| 62 XWarpPointer(base::MessagePumpX11::GetDefaultXDisplay(), | 62 XWarpPointer(gfx::GetXDisplay(), |
| 63 None, | 63 None, |
| 64 window->GetHost()->GetAcceleratedWidget(), | 64 window->GetHost()->GetAcceleratedWidget(), |
| 65 0, 0, 0, 0, | 65 0, 0, 0, 0, |
| 66 x, y); | 66 x, y); |
| 67 #endif | 67 #endif |
| 68 // Send and wait for a key event to make sure that mouse | 68 // Send and wait for a key event to make sure that mouse |
| 69 // events are fully processed. | 69 // events are fully processed. |
| 70 base::RunLoop loop; | 70 base::RunLoop loop; |
| 71 ui_controls::SendKeyPressNotifyWhenDone( | 71 ui_controls::SendKeyPressNotifyWhenDone( |
| 72 window, | 72 window, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 102 display_manager->OnNativeDisplaysChanged(display_info_list); | 102 display_manager->OnNativeDisplaysChanged(display_info_list); |
| 103 | 103 |
| 104 MoveMouseSync(Shell::GetAllRootWindows()[0], 10, 10); | 104 MoveMouseSync(Shell::GetAllRootWindows()[0], 10, 10); |
| 105 EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); | 105 EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); |
| 106 | 106 |
| 107 MoveMouseSync(Shell::GetAllRootWindows()[0], 600, 10); | 107 MoveMouseSync(Shell::GetAllRootWindows()[0], 600, 10); |
| 108 EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); | 108 EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace ash | 111 } // namespace ash |
| OLD | NEW |