| 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> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 // Create synthetic mouse events for testing. Currently these are very | 30 // Create synthetic mouse events for testing. Currently these are very |
| 31 // basic, flesh out as needed. Points are all in window coordinates; | 31 // basic, flesh out as needed. Points are all in window coordinates; |
| 32 // where the window is not specified, coordinate system is undefined | 32 // where the window is not specified, coordinate system is undefined |
| 33 // (but will be repeated when the event is queried). | 33 // (but will be repeated when the event is queried). |
| 34 NSEvent* MouseEventWithType(NSEventType type, NSUInteger modifiers); | 34 NSEvent* MouseEventWithType(NSEventType type, NSUInteger modifiers); |
| 35 NSEvent* MouseEventAtPoint(NSPoint point, NSEventType type, | 35 NSEvent* MouseEventAtPoint(NSPoint point, NSEventType type, |
| 36 NSUInteger modifiers); | 36 NSUInteger modifiers); |
| 37 NSEvent* LeftMouseDownAtPoint(NSPoint point); | 37 NSEvent* LeftMouseDownAtPoint(NSPoint point); |
| 38 NSEvent* LeftMouseDownAtPointInWindow(NSPoint point, NSWindow* window); | 38 NSEvent* LeftMouseDownAtPointInWindow(NSPoint point, NSWindow* window); |
| 39 NSEvent* RightMouseDownAtPoint(NSPoint point); |
| 40 NSEvent* RightMouseDownAtPointInWindow(NSPoint point, NSWindow* window); |
| 39 | 41 |
| 40 // Return a mouse down and an up event with the given |clickCount| at | 42 // Return a mouse down and an up event with the given |clickCount| at |
| 41 // |view|'s midpoint. | 43 // |view|'s midpoint. |
| 42 std::pair<NSEvent*, NSEvent*> MouseClickInView(NSView* view, | 44 std::pair<NSEvent*, NSEvent*> MouseClickInView(NSView* view, |
| 43 NSUInteger clickCount); | 45 NSUInteger clickCount); |
| 44 | 46 |
| 45 // Returns a key event with the given character. | 47 // Returns a key event with the given character. |
| 46 NSEvent* KeyEventWithCharacter(unichar c); | 48 NSEvent* KeyEventWithCharacter(unichar c); |
| 47 | 49 |
| 48 // Returns a key event with the given type and modifier flags. | 50 // Returns a key event with the given type and modifier flags. |
| 49 NSEvent* KeyEventWithType(NSEventType event_type, NSUInteger modifiers); | 51 NSEvent* KeyEventWithType(NSEventType event_type, NSUInteger modifiers); |
| 50 | 52 |
| 51 // Returns a key event with the given key code, type, and modifier flags. | 53 // Returns a key event with the given key code, type, and modifier flags. |
| 52 NSEvent* KeyEventWithKeyCode(unsigned short key_code, | 54 NSEvent* KeyEventWithKeyCode(unsigned short key_code, |
| 53 unichar c, | 55 unichar c, |
| 54 NSEventType event_type, | 56 NSEventType event_type, |
| 55 NSUInteger modifiers); | 57 NSUInteger modifiers); |
| 56 | 58 |
| 57 // Returns a mouse enter/exit event with the given type. | 59 // Returns a mouse enter/exit event with the given type. |
| 58 NSEvent* EnterExitEventWithType(NSEventType event_type); | 60 NSEvent* EnterExitEventWithType(NSEventType event_type); |
| 59 | 61 |
| 60 // Return an "other" event with the given type. | 62 // Return an "other" event with the given type. |
| 61 NSEvent* OtherEventWithType(NSEventType event_type); | 63 NSEvent* OtherEventWithType(NSEventType event_type); |
| 62 | 64 |
| 63 } // namespace cocoa_test_event_utils | 65 } // namespace cocoa_test_event_utils |
| 64 | 66 |
| 65 #endif // UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_ | 67 #endif // UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_ |
| OLD | NEW |