Chromium Code Reviews| 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 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #import <objc/objc-class.h> | 9 #import <objc/objc-class.h> |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 | 67 |
| 68 // Returns a key event with the given type and modifier flags. | 68 // Returns a key event with the given type and modifier flags. |
| 69 NSEvent* KeyEventWithType(NSEventType event_type, NSUInteger modifiers); | 69 NSEvent* KeyEventWithType(NSEventType event_type, NSUInteger modifiers); |
| 70 | 70 |
| 71 // Returns a key event with the given key code, type, and modifier flags. | 71 // Returns a key event with the given key code, type, and modifier flags. |
| 72 NSEvent* KeyEventWithKeyCode(unsigned short key_code, | 72 NSEvent* KeyEventWithKeyCode(unsigned short key_code, |
| 73 unichar c, | 73 unichar c, |
| 74 NSEventType event_type, | 74 NSEventType event_type, |
| 75 NSUInteger modifiers); | 75 NSUInteger modifiers); |
| 76 | 76 |
| 77 // Returns a key event for pressing or releasing a modifier key (aka | |
| 78 // NSFlagsChanged). For example |key_code| == kVK_Shift with |modifiers| & | |
| 79 // NSShiftKeyMask == true means Shift is pressed and |key_code| == kVK_Shift | |
|
tapted
2016/10/25 06:55:10
nit: `|modifiers| & NSShiftKeyMask == true` -> `(|
alshabalin
2016/10/28 19:58:14
Done.
| |
| 80 // with |modifiers| & NSShiftKeyMask == false means Shift is released. | |
|
tapted
2016/10/25 06:55:10
`|modifiers| & NSShiftKeyMask == false` -> `(|modi
alshabalin
2016/10/28 19:58:14
Done.
| |
| 81 NSEvent* KeyEventWithModifierOnly(unsigned short key_code, | |
| 82 NSUInteger modifiers); | |
| 83 | |
| 77 // Returns a mouse enter event. | 84 // Returns a mouse enter event. |
| 78 NSEvent* EnterEvent(); | 85 NSEvent* EnterEvent(); |
| 79 | 86 |
| 80 // Returns a mouse exit event. | 87 // Returns a mouse exit event. |
| 81 NSEvent* ExitEvent(); | 88 NSEvent* ExitEvent(); |
| 82 | 89 |
| 83 // Return an "other" event with the given type. | 90 // Return an "other" event with the given type. |
| 84 NSEvent* OtherEventWithType(NSEventType event_type); | 91 NSEvent* OtherEventWithType(NSEventType event_type); |
| 85 | 92 |
| 86 // Time interval since system startup. Tests shouldn't rely on this. | 93 // Time interval since system startup. Tests shouldn't rely on this. |
| 87 NSTimeInterval TimeIntervalSinceSystemStartup(); | 94 NSTimeInterval TimeIntervalSinceSystemStartup(); |
| 88 | 95 |
| 89 // Creates a key event in a particular window. | 96 // Creates a key event in a particular window. |
| 90 NSEvent* SynthesizeKeyEvent(NSWindow* window, | 97 NSEvent* SynthesizeKeyEvent(NSWindow* window, |
| 91 bool keyDown, | 98 bool keyDown, |
| 92 ui::KeyboardCode keycode, | 99 ui::KeyboardCode keycode, |
| 93 NSUInteger flags, | 100 NSUInteger flags, |
| 94 ui::DomKey dom_key = ui::DomKey::NONE); | 101 ui::DomKey dom_key = ui::DomKey::NONE); |
| 95 | 102 |
| 96 } // namespace cocoa_test_event_utils | 103 } // namespace cocoa_test_event_utils |
| 97 | 104 |
| 98 #endif // UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_ | 105 #endif // UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_ |
| OLD | NEW |