OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <AppKit/NSEvent.h> | 5 #include <AppKit/NSEvent.h> |
6 #include <Carbon/Carbon.h> | 6 #include <Carbon/Carbon.h> |
7 | 7 |
8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
9 | 9 |
10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_command_ids.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 TEST(GlobalKeyboardShortcuts, ShortcutsToWindowCommand) { | 13 TEST(GlobalKeyboardShortcuts, ShortcutsToWindowCommand) { |
14 // Test that an invalid shortcut translates into an invalid command id. | 14 // Test that an invalid shortcut translates into an invalid command id. |
15 ASSERT_EQ( | 15 ASSERT_EQ( |
16 -1, CommandForWindowKeyboardShortcut(false, false, false, false, 0, 0)); | 16 -1, CommandForWindowKeyboardShortcut(false, false, false, false, 0, 0)); |
17 | 17 |
18 // Check that all known keyboard shortcuts return valid results. | 18 // Check that all known keyboard shortcuts return valid results. |
19 size_t num_shortcuts = 0; | 19 size_t num_shortcuts = 0; |
20 const KeyboardShortcutData *it = | 20 const KeyboardShortcutData *it = |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // cmd-'{' / cmd-shift-'[' on ansi | 125 // cmd-'{' / cmd-shift-'[' on ansi |
126 ASSERT_EQ('{', KeyCharacterForEvent( | 126 ASSERT_EQ('{', KeyCharacterForEvent( |
127 KeyEvent(true, true, false, false, @"[", @"{"))); | 127 KeyEvent(true, true, false, false, @"[", @"{"))); |
128 // cmd-'z' / cmd-shift-';' on dvorak-qwerty | 128 // cmd-'z' / cmd-shift-';' on dvorak-qwerty |
129 ASSERT_EQ('z', KeyCharacterForEvent( | 129 ASSERT_EQ('z', KeyCharacterForEvent( |
130 KeyEvent(true, true, false, false, @"z", @":"))); | 130 KeyEvent(true, true, false, false, @"z", @":"))); |
131 // Test if getting dead-key events return 0 and do not hang. | 131 // Test if getting dead-key events return 0 and do not hang. |
132 ASSERT_EQ(0, KeyCharacterForEvent( | 132 ASSERT_EQ(0, KeyCharacterForEvent( |
133 KeyEvent(false, false, false, false, @"", @""))); | 133 KeyEvent(false, false, false, false, @"", @""))); |
134 } | 134 } |
OLD | NEW |