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/common/display/display_info.h" | 6 #include "ash/common/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_interactive_ui_test_base.h" | 9 #include "ash/test/ash_interactive_ui_test_base.h" |
10 #include "ash/test/cursor_manager_test_api.h" | 10 #include "ash/test/cursor_manager_test_api.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 const gfx::Rect& bounds, | 29 const gfx::Rect& bounds, |
30 float device_scale_factor) { | 30 float device_scale_factor) { |
31 DisplayInfo info(id, "", false); | 31 DisplayInfo 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; |
35 } | 35 } |
36 | 36 |
37 void MoveMouseSync(aura::Window* window, int x, int y) { | 37 void MoveMouseSync(aura::Window* window, int x, int y) { |
38 #if defined(USE_X11) | 38 #if defined(USE_X11) |
39 XWarpPointer(gfx::GetXDisplay(), | 39 XWarpPointer(gfx::GetXDisplay(), None, |
40 None, | 40 window->GetHost()->GetAcceleratedWidget(), 0, 0, 0, 0, x, y); |
41 window->GetHost()->GetAcceleratedWidget(), | |
42 0, 0, 0, 0, | |
43 x, y); | |
44 #endif | 41 #endif |
45 // Send and wait for a key event to make sure that mouse | 42 // Send and wait for a key event to make sure that mouse |
46 // events are fully processed. | 43 // events are fully processed. |
47 base::RunLoop loop; | 44 base::RunLoop loop; |
48 ui_controls::SendKeyPressNotifyWhenDone( | 45 ui_controls::SendKeyPressNotifyWhenDone(window, ui::VKEY_SPACE, false, false, |
49 window, | 46 false, false, loop.QuitClosure()); |
50 ui::VKEY_SPACE, | |
51 false, | |
52 false, | |
53 false, | |
54 false, | |
55 loop.QuitClosure()); | |
56 loop.Run(); | 47 loop.Run(); |
57 } | 48 } |
58 | 49 |
59 } // namespace | 50 } // namespace |
60 | 51 |
61 #if defined(USE_X11) | 52 #if defined(USE_X11) |
62 #define MAYBE_CursorChangeOnEnterNotify CursorChangeOnEnterNotify | 53 #define MAYBE_CursorChangeOnEnterNotify CursorChangeOnEnterNotify |
63 #else | 54 #else |
64 #define MAYBE_CursorChangeOnEnterNotify DISABLED_CursorChangeOnEnterNotify | 55 #define MAYBE_CursorChangeOnEnterNotify DISABLED_CursorChangeOnEnterNotify |
65 #endif | 56 #endif |
(...skipping 13 matching lines...) Expand all Loading... |
79 display_manager->OnNativeDisplaysChanged(display_info_list); | 70 display_manager->OnNativeDisplaysChanged(display_info_list); |
80 | 71 |
81 MoveMouseSync(Shell::GetAllRootWindows()[0], 10, 10); | 72 MoveMouseSync(Shell::GetAllRootWindows()[0], 10, 10); |
82 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); | 73 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); |
83 | 74 |
84 MoveMouseSync(Shell::GetAllRootWindows()[0], 600, 10); | 75 MoveMouseSync(Shell::GetAllRootWindows()[0], 600, 10); |
85 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); | 76 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); |
86 } | 77 } |
87 | 78 |
88 } // namespace ash | 79 } // namespace ash |
OLD | NEW |