OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_ | 5 #ifndef UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_ |
6 #define UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_ | 6 #define UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #import <objc/objc-class.h> | 10 #import <objc/objc-class.h> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "ui/events/keycodes/keyboard_codes.h" |
13 | 14 |
14 namespace cocoa_test_event_utils { | 15 namespace cocoa_test_event_utils { |
15 | 16 |
16 // Create synthetic mouse events for testing. Currently these are very | 17 // Create synthetic mouse events for testing. Currently these are very |
17 // basic, flesh out as needed. Points are all in window coordinates; | 18 // basic, flesh out as needed. Points are all in window coordinates; |
18 // where the window is not specified, coordinate system is undefined | 19 // where the window is not specified, coordinate system is undefined |
19 // (but will be repeated when the event is queried). | 20 // (but will be repeated when the event is queried). |
20 NSEvent* MouseEventWithType(NSEventType type, NSUInteger modifiers); | 21 NSEvent* MouseEventWithType(NSEventType type, NSUInteger modifiers); |
21 NSEvent* MouseEventAtPoint(NSPoint point, NSEventType type, | 22 NSEvent* MouseEventAtPoint(NSPoint point, NSEventType type, |
22 NSUInteger modifiers); | 23 NSUInteger modifiers); |
(...skipping 18 matching lines...) Expand all Loading... |
41 unichar c, | 42 unichar c, |
42 NSEventType event_type, | 43 NSEventType event_type, |
43 NSUInteger modifiers); | 44 NSUInteger modifiers); |
44 | 45 |
45 // Returns a mouse enter/exit event with the given type. | 46 // Returns a mouse enter/exit event with the given type. |
46 NSEvent* EnterExitEventWithType(NSEventType event_type); | 47 NSEvent* EnterExitEventWithType(NSEventType event_type); |
47 | 48 |
48 // Return an "other" event with the given type. | 49 // Return an "other" event with the given type. |
49 NSEvent* OtherEventWithType(NSEventType event_type); | 50 NSEvent* OtherEventWithType(NSEventType event_type); |
50 | 51 |
| 52 // Time interval since system startup. Tests shouldn't rely on this. |
| 53 NSTimeInterval TimeIntervalSinceSystemStartup(); |
| 54 |
| 55 // Creates a key event in a particular window. |
| 56 NSEvent* SynthesizeKeyEvent(NSWindow* window, |
| 57 bool keyDown, |
| 58 ui::KeyboardCode keycode, |
| 59 NSUInteger flags); |
| 60 |
51 } // namespace cocoa_test_event_utils | 61 } // namespace cocoa_test_event_utils |
52 | 62 |
53 #endif // UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_ | 63 #endif // UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_ |
OLD | NEW |