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

Side by Side Diff: content/browser/cocoa/system_hotkey_map_unittest.mm

Issue 1853533002: Add default hotkey dictionary for com.apple.symbolichotkeys.plist (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: avi's review Created 4 years, 8 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 | « content/browser/cocoa/system_hotkey_map.mm ('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 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 #include <gtest/gtest.h> 5 #include <gtest/gtest.h>
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 NSData* data = DataFromTestFile("mac/mac_system_hotkeys_sparse.plist"); 127 NSData* data = DataFromTestFile("mac/mac_system_hotkeys_sparse.plist");
128 ASSERT_TRUE(data); 128 ASSERT_TRUE(data);
129 129
130 NSDictionary* dictionary = SystemHotkeyMap::DictionaryFromData(data); 130 NSDictionary* dictionary = SystemHotkeyMap::DictionaryFromData(data);
131 ASSERT_TRUE(dictionary); 131 ASSERT_TRUE(dictionary);
132 132
133 SystemHotkeyMap map; 133 SystemHotkeyMap map;
134 bool result = map.ParseDictionary(dictionary); 134 bool result = map.ParseDictionary(dictionary);
135 EXPECT_TRUE(result); 135 EXPECT_TRUE(result);
136 136
137 // Command + ` is a common key binding. It is missing. 137 // Command + ` is a common key binding. It is missing, but since OS X uses the
138 // TODO(erikchen): OSX uses the default value when the keybinding is missing, 138 // default value the hotkey should still be reserved.
139 // so the hotkey should still be reserved. 139 // https://crbug.com/383558
140 // http://crbug.com/383558 140 // https://crbug.com/145062
141 unsigned short key_code = kVK_ANSI_Grave; 141 unsigned short key_code = kVK_ANSI_Grave;
142 NSUInteger modifiers = NSCommandKeyMask; 142 NSUInteger modifiers = NSCommandKeyMask;
143 EXPECT_FALSE(map.IsHotkeyReserved(key_code, modifiers)); 143 EXPECT_TRUE(map.IsHotkeyReserved(key_code, modifiers));
144 144
145 // There is a mouse keybinding for 0x08. It should not apply to keyboard 145 // There is a mouse keybinding for 0x08. It should not apply to keyboard
146 // hotkeys. 146 // hotkeys.
147 key_code = kVK_ANSI_C; 147 key_code = kVK_ANSI_C;
148 modifiers = 0; 148 modifiers = 0;
149 EXPECT_FALSE(map.IsHotkeyReserved(key_code, modifiers)); 149 EXPECT_FALSE(map.IsHotkeyReserved(key_code, modifiers));
150 150
151 // Command + Alt + = is an accessibility shortcut. Its entry in the plist is 151 // Command + Alt + = is an accessibility shortcut. Its entry in the plist is
152 // incomplete. 152 // incomplete.
153 // TODO(erikchen): OSX uses the default bindings, so this hotkey should still 153 // TODO(erikchen): OSX uses the default bindings, so this hotkey should still
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Disabled entries should not be reserved. 187 // Disabled entries should not be reserved.
188 EXPECT_FALSE(map.IsHotkeyReserved(key_code, NSAlternateKeyMask)); 188 EXPECT_FALSE(map.IsHotkeyReserved(key_code, NSAlternateKeyMask));
189 189
190 // Other entries should be reserved. 190 // Other entries should be reserved.
191 EXPECT_TRUE(map.IsHotkeyReserved(key_code, NSControlKeyMask)); 191 EXPECT_TRUE(map.IsHotkeyReserved(key_code, NSControlKeyMask));
192 EXPECT_TRUE( 192 EXPECT_TRUE(
193 map.IsHotkeyReserved(key_code, NSFunctionKeyMask | NSControlKeyMask)); 193 map.IsHotkeyReserved(key_code, NSFunctionKeyMask | NSControlKeyMask));
194 } 194 }
195 195
196 } // namespace content 196 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/cocoa/system_hotkey_map.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698