Chromium Code Reviews

Side by Side Diff: chrome/browser/ui/cocoa/nsmenuitem_additions_unittest.mm

Issue 5576002: Fix BrowserKeyEventsTest.ReservedAccelerators on Mac 10.6 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update comment. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/ui/cocoa/nsmenuitem_additions.h" 5 #import "chrome/browser/ui/cocoa/nsmenuitem_additions.h"
6 6
7 #include <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 8
9 #include <ostream> 9 #include <ostream>
10 10
(...skipping 80 matching lines...)
91 // Sanity 91 // Sanity
92 item = MenuItem(@"", 0); 92 item = MenuItem(@"", 0);
93 EXPECT_TRUE([item isEnabled]); 93 EXPECT_TRUE([item isEnabled]);
94 94
95 // a 95 // a
96 key = KeyEvent(0x100, @"a", @"a", 0); 96 key = KeyEvent(0x100, @"a", @"a", 0);
97 item = MenuItem(@"a", 0); 97 item = MenuItem(@"a", 0);
98 ExpectKeyFiresItem(key, item); 98 ExpectKeyFiresItem(key, item);
99 ExpectKeyDoesntFireItem(KeyEvent(0x20102, @"A", @"A", 0), item); 99 ExpectKeyDoesntFireItem(KeyEvent(0x20102, @"A", @"A", 0), item);
100 100
101 // Disabled menu item
102 key = KeyEvent(0x100, @"a", @"a", 0);
103 item = MenuItem(@"a", 0);
104 [item setEnabled:NO];
105 ExpectKeyDoesntFireItem(key, item, false);
106
107 // shift-a 101 // shift-a
108 key = KeyEvent(0x20102, @"A", @"A", 0); 102 key = KeyEvent(0x20102, @"A", @"A", 0);
109 item = MenuItem(@"A", 0); 103 item = MenuItem(@"A", 0);
110 ExpectKeyFiresItem(key, item); 104 ExpectKeyFiresItem(key, item);
111 ExpectKeyDoesntFireItem(KeyEvent(0x100, @"a", @"a", 0), item); 105 ExpectKeyDoesntFireItem(KeyEvent(0x100, @"a", @"a", 0), item);
112 106
113 // cmd-opt-shift-a 107 // cmd-opt-shift-a
114 key = KeyEvent(0x1a012a, @"\u00c5", @"A", 0); 108 key = KeyEvent(0x1a012a, @"\u00c5", @"A", 0);
115 item = MenuItem(@"A", 0x180000); 109 item = MenuItem(@"A", 0x180000);
116 ExpectKeyFiresItem(key, item); 110 ExpectKeyFiresItem(key, item);
(...skipping 225 matching lines...)
342 } 336 }
343 337
344 EventModifiers modifiers = cmdKey >> 8; 338 EventModifiers modifiers = cmdKey >> 8;
345 NSString* chars = keyCodeToCharacter(keyCode, modifiers, ref); 339 NSString* chars = keyCodeToCharacter(keyCode, modifiers, ref);
346 NSString* charsIgnoringMods = keyCodeToCharacter(keyCode, 0, ref); 340 NSString* charsIgnoringMods = keyCodeToCharacter(keyCode, 0, ref);
347 NSEvent* key = KeyEvent(0x100000, chars, charsIgnoringMods, keyCode); 341 NSEvent* key = KeyEvent(0x100000, chars, charsIgnoringMods, keyCode);
348 ExpectKeyFiresItem(key, item, false); 342 ExpectKeyFiresItem(key, item, false);
349 } 343 }
350 CFRelease(list); 344 CFRelease(list);
351 } 345 }
OLDNEW

Powered by Google App Engine