| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COCOA_TEST_EVENT_UTILS_H_ | 5 #ifndef UI_BASE_TEST_COCOA_TEST_EVENT_UTILS_H_ |
| 6 #define UI_BASE_TEST_COCOA_TEST_EVENT_UTILS_H_ | 6 #define UI_BASE_TEST_COCOA_TEST_EVENT_UTILS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 DISALLOW_COPY_AND_ASSIGN(ScopedClassSwizzler); | 26 DISALLOW_COPY_AND_ASSIGN(ScopedClassSwizzler); |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 namespace cocoa_test_event_utils { | 29 namespace cocoa_test_event_utils { |
| 30 | 30 |
| 31 // Create synthetic mouse events for testing. Currently these are very | 31 // Create synthetic mouse events for testing. Currently these are very |
| 32 // basic, flesh out as needed. Points are all in window coordinates; | 32 // basic, flesh out as needed. Points are all in window coordinates; |
| 33 // where the window is not specified, coordinate system is undefined | 33 // where the window is not specified, coordinate system is undefined |
| 34 // (but will be repeated when the event is queried). | 34 // (but will be repeated when the event is queried). |
| 35 NSEvent* MakeMouseEvent(NSEventType type, NSUInteger modifiers); | 35 NSEvent* MouseEventWithType(NSEventType type, NSUInteger modifiers); |
| 36 NSEvent* MouseEventAtPoint(NSPoint point, NSEventType type, | 36 NSEvent* MouseEventAtPoint(NSPoint point, NSEventType type, |
| 37 NSUInteger modifiers); | 37 NSUInteger modifiers); |
| 38 NSEvent* LeftMouseDownAtPoint(NSPoint point); | 38 NSEvent* LeftMouseDownAtPoint(NSPoint point); |
| 39 NSEvent* LeftMouseDownAtPointInWindow(NSPoint point, NSWindow* window); | 39 NSEvent* LeftMouseDownAtPointInWindow(NSPoint point, NSWindow* window); |
| 40 | 40 |
| 41 // Return a mouse down and an up event with the given |clickCount| at | 41 // Return a mouse down and an up event with the given |clickCount| at |
| 42 // |view|'s midpoint. | 42 // |view|'s midpoint. |
| 43 std::pair<NSEvent*, NSEvent*> MouseClickInView(NSView* view, | 43 std::pair<NSEvent*, NSEvent*> MouseClickInView(NSView* view, |
| 44 NSUInteger clickCount); | 44 NSUInteger clickCount); |
| 45 | 45 |
| 46 // Returns a key event with the given character. | 46 // Returns a key event with the given character. |
| 47 NSEvent* KeyEventWithCharacter(unichar c); | 47 NSEvent* KeyEventWithCharacter(unichar c); |
| 48 | 48 |
| 49 // Returns a key event with the given type and modifier flags. |
| 50 NSEvent* KeyEventWithType(NSEventType event_type, NSUInteger modifiers); |
| 51 |
| 52 // Returns a mouse enter/exit event with the given type. |
| 53 NSEvent* EnterExitEventWithType(NSEventType event_type); |
| 54 |
| 55 // Return an "other" event with the given type. |
| 56 NSEvent* OtherEventWithType(NSEventType event_type); |
| 57 |
| 49 } // namespace cocoa_test_event_utils | 58 } // namespace cocoa_test_event_utils |
| 50 | 59 |
| 51 #endif // UI_BASE_TEST_COCOA_TEST_EVENT_UTILS_H_ | 60 #endif // UI_BASE_TEST_COCOA_TEST_EVENT_UTILS_H_ |
| OLD | NEW |