| 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 #include <stddef.h> |
| 7 | 8 |
| 8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 9 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| 9 | 10 |
| 11 #include "base/macros.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 14 |
| 13 TEST(GlobalKeyboardShortcuts, ShortcutsToWindowCommand) { | 15 TEST(GlobalKeyboardShortcuts, ShortcutsToWindowCommand) { |
| 14 // Test that an invalid shortcut translates into an invalid command id. | 16 // Test that an invalid shortcut translates into an invalid command id. |
| 15 EXPECT_EQ( | 17 EXPECT_EQ( |
| 16 -1, CommandForWindowKeyboardShortcut(false, false, false, false, 0, 0)); | 18 -1, CommandForWindowKeyboardShortcut(false, false, false, false, 0, 0)); |
| 17 | 19 |
| 18 // Check that all known keyboard shortcuts return valid results. | 20 // Check that all known keyboard shortcuts return valid results. |
| 19 size_t num_shortcuts = 0; | 21 size_t num_shortcuts = 0; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // cmd-shift-'[' in an RTL context pre 10.9. | 187 // cmd-shift-'[' in an RTL context pre 10.9. |
| 186 EXPECT_EQ('{', KeyCharacterForEvent( | 188 EXPECT_EQ('{', KeyCharacterForEvent( |
| 187 KeyEvent(true, true, false, false, @"{", @"}"))); | 189 KeyEvent(true, true, false, false, @"{", @"}"))); |
| 188 // cmd-shift-'[' in an RTL context on 10.9. | 190 // cmd-shift-'[' in an RTL context on 10.9. |
| 189 EXPECT_EQ('{', KeyCharacterForEvent( | 191 EXPECT_EQ('{', KeyCharacterForEvent( |
| 190 KeyEvent(true, true, false, false, @"[", @"}"))); | 192 KeyEvent(true, true, false, false, @"[", @"}"))); |
| 191 // Test if getting dead-key events return 0 and do not hang. | 193 // Test if getting dead-key events return 0 and do not hang. |
| 192 EXPECT_EQ(0, KeyCharacterForEvent( | 194 EXPECT_EQ(0, KeyCharacterForEvent( |
| 193 KeyEvent(false, false, false, false, @"", @""))); | 195 KeyEvent(false, false, false, false, @"", @""))); |
| 194 } | 196 } |
| OLD | NEW |