Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: ui/events/test/cocoa_test_event_utils.h

Issue 916523003: Bring up fast user switcher on right-click of the avatar menu on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "ui/events/keycodes/keyboard_codes.h"
14 14
15 namespace cocoa_test_event_utils { 15 namespace cocoa_test_event_utils {
16 16
17 // Create synthetic mouse events for testing. Currently these are very 17 // Create synthetic mouse events for testing. Currently these are very
18 // basic, flesh out as needed. Points are all in window coordinates; 18 // basic, flesh out as needed. Points are all in window coordinates;
19 // where the window is not specified, coordinate system is undefined 19 // where the window is not specified, coordinate system is undefined
20 // (but will be repeated when the event is queried). 20 // (but will be repeated when the event is queried).
21 NSEvent* MouseEventWithType(NSEventType type, NSUInteger modifiers);
22 NSEvent* MouseEventAtPoint(NSPoint point, NSEventType type, 21 NSEvent* MouseEventAtPoint(NSPoint point, NSEventType type,
23 NSUInteger modifiers); 22 NSUInteger modifiers);
23 NSEvent* MouseEventWithType(NSEventType type, NSUInteger modifiers);
24 NSEvent* MouseEventAtPointInWindow(NSPoint point,
25 NSEventType type,
26 NSWindow* window,
27 NSUInteger clickCount);
28 NSEvent* RightMouseDownAtPoint(NSPoint point);
29 NSEvent* RightMouseDownAtPointInWindow(NSPoint point, NSWindow* window);
24 NSEvent* LeftMouseDownAtPoint(NSPoint point); 30 NSEvent* LeftMouseDownAtPoint(NSPoint point);
25 NSEvent* LeftMouseDownAtPointInWindow(NSPoint point, NSWindow* window); 31 NSEvent* LeftMouseDownAtPointInWindow(NSPoint point, NSWindow* window);
26 NSEvent* RightMouseDownAtPoint(NSPoint point);
27 NSEvent* RightMouseDownAtPointInWindow(NSPoint point, NSWindow* window);
28 32
29 // Return a mouse down and an up event with the given |clickCount| at 33 // Return a mouse down and an up event with the given |clickCount| at
30 // |view|'s midpoint. 34 // |view|'s midpoint.
31 std::pair<NSEvent*, NSEvent*> MouseClickInView(NSView* view, 35 std::pair<NSEvent*, NSEvent*> MouseClickInView(NSView* view,
32 NSUInteger clickCount); 36 NSUInteger clickCount);
33 37
38 // Return a right mouse down and an up event with the given |clickCount| at
39 // |view|'s midpoint.
40 std::pair<NSEvent*, NSEvent*> RightMouseClickInView(NSView* view,
41 NSUInteger clickCount);
42
34 // Returns a key event with the given character. 43 // Returns a key event with the given character.
35 NSEvent* KeyEventWithCharacter(unichar c); 44 NSEvent* KeyEventWithCharacter(unichar c);
36 45
37 // Returns a key event with the given type and modifier flags. 46 // Returns a key event with the given type and modifier flags.
38 NSEvent* KeyEventWithType(NSEventType event_type, NSUInteger modifiers); 47 NSEvent* KeyEventWithType(NSEventType event_type, NSUInteger modifiers);
39 48
40 // Returns a key event with the given key code, type, and modifier flags. 49 // Returns a key event with the given key code, type, and modifier flags.
41 NSEvent* KeyEventWithKeyCode(unsigned short key_code, 50 NSEvent* KeyEventWithKeyCode(unsigned short key_code,
42 unichar c, 51 unichar c,
43 NSEventType event_type, 52 NSEventType event_type,
(...skipping 10 matching lines...) Expand all
54 63
55 // Creates a key event in a particular window. 64 // Creates a key event in a particular window.
56 NSEvent* SynthesizeKeyEvent(NSWindow* window, 65 NSEvent* SynthesizeKeyEvent(NSWindow* window,
57 bool keyDown, 66 bool keyDown,
58 ui::KeyboardCode keycode, 67 ui::KeyboardCode keycode,
59 NSUInteger flags); 68 NSUInteger flags);
60 69
61 } // namespace cocoa_test_event_utils 70 } // namespace cocoa_test_event_utils
62 71
63 #endif // UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_ 72 #endif // UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698