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

Side by Side Diff: ui/base/test/cocoa_test_event_utils.mm

Issue 8332008: Cocoa: Support keyboard navigation in avatar menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 9 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/test/cocoa_test_event_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "ui/base/test/cocoa_test_event_utils.h" 7 #include "ui/base/test/cocoa_test_event_utils.h"
8 8
9 ScopedClassSwizzler::ScopedClassSwizzler(Class target, Class source, 9 ScopedClassSwizzler::ScopedClassSwizzler(Class target, Class source,
10 SEL selector) { 10 SEL selector) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 NSUInteger clickCount) { 76 NSUInteger clickCount) {
77 const NSRect bounds = [view convertRect:[view bounds] toView:nil]; 77 const NSRect bounds = [view convertRect:[view bounds] toView:nil];
78 const NSPoint mid_point = NSMakePoint(NSMidX(bounds), NSMidY(bounds)); 78 const NSPoint mid_point = NSMakePoint(NSMidX(bounds), NSMidY(bounds));
79 NSEvent* down = MouseEventAtPointInWindow(mid_point, NSLeftMouseDown, 79 NSEvent* down = MouseEventAtPointInWindow(mid_point, NSLeftMouseDown,
80 [view window], clickCount); 80 [view window], clickCount);
81 NSEvent* up = MouseEventAtPointInWindow(mid_point, NSLeftMouseUp, 81 NSEvent* up = MouseEventAtPointInWindow(mid_point, NSLeftMouseUp,
82 [view window], clickCount); 82 [view window], clickCount);
83 return std::make_pair(down, up); 83 return std::make_pair(down, up);
84 } 84 }
85 85
86 NSEvent* KeyEventWithCharacter(unichar c) {
87 NSString* chars = [NSString stringWithCharacters:&c length:1];
88 return [NSEvent keyEventWithType:NSKeyDown
89 location:NSZeroPoint
90 modifierFlags:0
91 timestamp:0.0
92 windowNumber:0
93 context:nil
94 characters:chars
95 charactersIgnoringModifiers:chars
96 isARepeat:NO
97 keyCode:0];
98 }
99
86 } // namespace cocoa_test_event_utils 100 } // namespace cocoa_test_event_utils
OLDNEW
« no previous file with comments | « ui/base/test/cocoa_test_event_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698