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 | 4 |
5 #ifndef UI_BASE_TEST_UI_CONTROLS_H_ | 5 #ifndef UI_BASE_TEST_UI_CONTROLS_H_ |
6 #define UI_BASE_TEST_UI_CONTROLS_H_ | 6 #define UI_BASE_TEST_UI_CONTROLS_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "ui/events/keycodes/keyboard_codes.h" | 10 #include "ui/events/keycodes/keyboard_codes.h" |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 | 12 |
| 13 namespace gfx { |
| 14 class Point; |
| 15 } // namespace gfx |
| 16 |
13 namespace ui_controls { | 17 namespace ui_controls { |
14 | 18 |
15 // A set of utility functions to generate native events in platform | 19 // A set of utility functions to generate native events in platform |
16 // independent way. Note that since the implementations depend on a window being | 20 // independent way. Note that since the implementations depend on a window being |
17 // top level, these can only be called from test suites that are not sharded. | 21 // top level, these can only be called from test suites that are not sharded. |
18 // For aura tests, please look into |aura::test:EventGenerator| first. This | 22 // For aura tests, please look into |aura::test:EventGenerator| first. This |
19 // class provides a way to emulate events in synchronous way and it is often | 23 // class provides a way to emulate events in synchronous way and it is often |
20 // easier to write tests with this class than using |ui_controls|. | 24 // easier to write tests with this class than using |ui_controls|. |
21 // | 25 // |
22 // Many of the functions in this class include a variant that takes a Closure. | 26 // Many of the functions in this class include a variant that takes a Closure. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 #if defined(USE_AURA) | 103 #if defined(USE_AURA) |
100 class UIControlsAura; | 104 class UIControlsAura; |
101 void InstallUIControlsAura(UIControlsAura* instance); | 105 void InstallUIControlsAura(UIControlsAura* instance); |
102 #endif | 106 #endif |
103 | 107 |
104 #if defined(OS_MACOSX) | 108 #if defined(OS_MACOSX) |
105 // Returns true when tests need to use extra Tab and Shift-Tab key events | 109 // Returns true when tests need to use extra Tab and Shift-Tab key events |
106 // to traverse to the desired item; because the application is configured to | 110 // to traverse to the desired item; because the application is configured to |
107 // traverse more elements for accessibility reasons. | 111 // traverse more elements for accessibility reasons. |
108 bool IsFullKeyboardAccessEnabled(); | 112 bool IsFullKeyboardAccessEnabled(); |
| 113 |
| 114 // When |enable_cgevents| is true, all simulated mouse events will be posted to |
| 115 // the WindowServer, and the actual mouse will move on the screen. |
| 116 void SetSendMouseEventsAsCGEvents(bool enable_cgevents); |
| 117 bool SendMouseEventsAsCGEvents(); |
| 118 |
| 119 // Invokes |task| when an application starts processing an event that matches |
| 120 // |event|. |
| 121 void NotifyWhenEventIsProcessed(NSEvent* event, const base::Closure& task); |
| 122 |
| 123 // If |enable_override| is true, overrides result returned by +[NSEvent |
| 124 // mouseLocation] to |p| without generating mouse move events. Override is in |
| 125 // effect until called with |enable_override| == false. |
| 126 void SetMousePositionOverride(bool enable_override, const gfx::Point& p); |
109 #endif | 127 #endif |
110 | 128 |
111 } // namespace ui_controls | 129 } // namespace ui_controls |
112 | 130 |
113 #endif // UI_BASE_TEST_UI_CONTROLS_H_ | 131 #endif // UI_BASE_TEST_UI_CONTROLS_H_ |
OLD | NEW |