| 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 "chrome/browser/global_keyboard_shortcuts_mac.h" | 5 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 TEST(GlobalKeyboardShortcuts, ShortCutsToCommand) { | 9 TEST(GlobalKeyboardShortcuts, ShortCutsToCommand) { |
| 10 // Test that an invalid shortcut translates into an invalid command id. | 10 // Test that an invalid shortcut translates into an invalid command id. |
| 11 ASSERT_EQ(CommandForKeyboardShortcut(false, false, false, 0), -1); | 11 ASSERT_EQ(CommandForKeyboardShortcut(false, false, false, 0), -1); |
| 12 | 12 |
| 13 // Check that all known keyboard shortcuts return valid results. | 13 // Check that all known keyboard shortcuts return valid results. |
| 14 size_t num_shortcuts = 0; | 14 size_t num_shortcuts = 0; |
| 15 const KeyboardShortcutData *it = GetKeyboardShortCutTable(&num_shortcuts); | 15 const KeyboardShortcutData *it = GetKeyboardShortCutTable(&num_shortcuts); |
| 16 ASSERT_GT(num_shortcuts, 0U); | 16 ASSERT_GT(num_shortcuts, 0U); |
| 17 for (size_t i = 0; i < num_shortcuts; ++i, ++it) { | 17 for (size_t i = 0; i < num_shortcuts; ++i, ++it) { |
| 18 int cmd_num = CommandForKeyboardShortcut(it->command_key, it->shift_key, | 18 int cmd_num = CommandForKeyboardShortcut(it->command_key, it->shift_key, |
| 19 it->cntrl_key, it->vkey_code); | 19 it->cntrl_key, it->vkey_code); |
| 20 ASSERT_EQ(cmd_num, it->chrome_command); | 20 ASSERT_EQ(cmd_num, it->chrome_command); |
| 21 } | 21 } |
| 22 } | 22 } |
| OLD | NEW |