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

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

Issue 1282543002: Fix NSMenuItemAdditionsTest.TestMOnDifferentLayouts on 10.11 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | 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 "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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 for (id layout in list) { 323 for (id layout in list) {
324 TISInputSourceRef ref = (TISInputSourceRef)layout; 324 TISInputSourceRef ref = (TISInputSourceRef)layout;
325 325
326 NSUInteger keyCode = 0x2e; // "m" on a US layout and most other layouts. 326 NSUInteger keyCode = 0x2e; // "m" on a US layout and most other layouts.
327 327
328 // On a few layouts, "m" has a different key code. 328 // On a few layouts, "m" has a different key code.
329 NSString* layoutId = (NSString*)TISGetInputSourceProperty( 329 NSString* layoutId = (NSString*)TISGetInputSourceProperty(
330 ref, kTISPropertyInputSourceID); 330 ref, kTISPropertyInputSourceID);
331 if ([layoutId isEqualToString:@"com.apple.keylayout.Belgian"] || 331 if ([layoutId isEqualToString:@"com.apple.keylayout.Belgian"] ||
332 [layoutId isEqualToString:@"com.apple.keylayout.Italian"] || 332 [layoutId isEqualToString:@"com.apple.keylayout.Italian"] ||
333 [layoutId isEqualToString:@"com.apple.keylayout.ABC-AZERTY"] ||
333 [layoutId hasPrefix:@"com.apple.keylayout.French"]) { 334 [layoutId hasPrefix:@"com.apple.keylayout.French"]) {
334 keyCode = 0x29; 335 keyCode = 0x29;
335 } else if ([layoutId isEqualToString:@"com.apple.keylayout.Turkish"]) { 336 } else if ([layoutId isEqualToString:@"com.apple.keylayout.Turkish"]) {
336 keyCode = 0x28; 337 keyCode = 0x28;
337 } else if ([layoutId isEqualToString:@"com.apple.keylayout.Dvorak-Left"]) { 338 } else if ([layoutId isEqualToString:@"com.apple.keylayout.Dvorak-Left"]) {
338 keyCode = 0x16; 339 keyCode = 0x16;
339 } else if ([layoutId isEqualToString:@"com.apple.keylayout.Dvorak-Right"]) { 340 } else if ([layoutId isEqualToString:@"com.apple.keylayout.Dvorak-Right"]) {
340 keyCode = 0x1a; 341 keyCode = 0x1a;
341 } 342 }
342 343
343 EventModifiers modifiers = cmdKey >> 8; 344 EventModifiers modifiers = cmdKey >> 8;
344 NSString* chars = keyCodeToCharacter(keyCode, modifiers, ref); 345 NSString* chars = keyCodeToCharacter(keyCode, modifiers, ref);
345 NSString* charsIgnoringMods = keyCodeToCharacter(keyCode, 0, ref); 346 NSString* charsIgnoringMods = keyCodeToCharacter(keyCode, 0, ref);
346 NSEvent* key = KeyEvent(0x100000, chars, charsIgnoringMods, keyCode); 347 NSEvent* key = KeyEvent(0x100000, chars, charsIgnoringMods, keyCode);
347 ExpectKeyFiresItem(key, item, false); 348 ExpectKeyFiresItem(key, item, false);
348 } 349 }
349 CFRelease(list); 350 CFRelease(list);
350 } 351 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698