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

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

Issue 2484863004: Mac: Consolidate test mouse event generation into a single codepath.
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | ui/events/test/cocoa_test_event_utils.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #import <objc/objc-class.h> 9 #import <objc/objc-class.h>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Return a mouse down and an up event with the given |clickCount| at 43 // Return a mouse down and an up event with the given |clickCount| at
44 // |view|'s midpoint. 44 // |view|'s midpoint.
45 std::pair<NSEvent*, NSEvent*> MouseClickInView(NSView* view, 45 std::pair<NSEvent*, NSEvent*> MouseClickInView(NSView* view,
46 NSUInteger clickCount); 46 NSUInteger clickCount);
47 47
48 // Return a right mouse down and an up event with the given |clickCount| at 48 // Return a right mouse down and an up event with the given |clickCount| at
49 // |view|'s midpoint. 49 // |view|'s midpoint.
50 std::pair<NSEvent*, NSEvent*> RightMouseClickInView(NSView* view, 50 std::pair<NSEvent*, NSEvent*> RightMouseClickInView(NSView* view,
51 NSUInteger clickCount); 51 NSUInteger clickCount);
52 52
53 NSEvent* TestMouseEvent(NSPoint window_point,
54 NSEventType type,
55 NSWindow* window,
56 NSUInteger modifiers,
57 NSUInteger clickCount);
58
53 // Creates a test scroll event. |has_precise_deltas| determines the value of 59 // Creates a test scroll event. |has_precise_deltas| determines the value of
54 // -[NSEvent hasPreciseScrollingDeltas] - usually NO for a mouse wheel and YES 60 // -[NSEvent hasPreciseScrollingDeltas] - usually NO for a mouse wheel and YES
55 // for a trackpad. If |window| is nil, |location| is assumed to be AppKit screen 61 // for a trackpad. If |window| is nil, |location| is assumed to be AppKit screen
56 // coordinates (origin in bottom left of primary screen). 62 // coordinates (origin in bottom left of primary screen).
57 NSEvent* TestScrollEvent(NSPoint location, 63 NSEvent* TestScrollEvent(NSPoint location,
58 NSWindow* window, 64 NSWindow* window,
59 CGFloat delta_x, 65 CGFloat delta_x,
60 CGFloat delta_y, 66 CGFloat delta_y,
61 bool has_precise_deltas, 67 bool has_precise_deltas,
62 NSEventPhase event_phase, 68 NSEventPhase event_phase,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Creates a key event in a particular window. 102 // Creates a key event in a particular window.
97 NSEvent* SynthesizeKeyEvent(NSWindow* window, 103 NSEvent* SynthesizeKeyEvent(NSWindow* window,
98 bool keyDown, 104 bool keyDown,
99 ui::KeyboardCode keycode, 105 ui::KeyboardCode keycode,
100 NSUInteger flags, 106 NSUInteger flags,
101 ui::DomKey dom_key = ui::DomKey::NONE); 107 ui::DomKey dom_key = ui::DomKey::NONE);
102 108
103 } // namespace cocoa_test_event_utils 109 } // namespace cocoa_test_event_utils
104 110
105 #endif // UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_ 111 #endif // UI_EVENTS_TEST_COCOA_TEST_EVENT_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | ui/events/test/cocoa_test_event_utils.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698