Chromium Code Reviews| Index: chrome/browser/global_keyboard_shortcuts_mac_unittest.mm |
| diff --git a/chrome/browser/global_keyboard_shortcuts_mac_unittest.mm b/chrome/browser/global_keyboard_shortcuts_mac_unittest.mm |
| index df0e4ebe0d67c6df30db2bdf563051e4ae51158e..3c9619d5226eb2271fccefac14ad932c014c4d01 100644 |
| --- a/chrome/browser/global_keyboard_shortcuts_mac_unittest.mm |
| +++ b/chrome/browser/global_keyboard_shortcuts_mac_unittest.mm |
| @@ -18,15 +18,11 @@ TEST(GlobalKeyboardShortcuts, ShortcutsToWindowCommand) { |
| -1, CommandForWindowKeyboardShortcut(false, false, false, false, 0, 0)); |
| // Check that all known keyboard shortcuts return valid results. |
| - size_t num_shortcuts = 0; |
| - const KeyboardShortcutData *it = |
| - GetWindowKeyboardShortcutTable(&num_shortcuts); |
| - ASSERT_GT(num_shortcuts, 0U); |
| - for (size_t i = 0; i < num_shortcuts; ++i, ++it) { |
| + for (const auto& e : GetWindowKeyboardShortcutTable()) { |
|
tapted
2016/11/01 23:34:46
e -> shortcut, more below
|
| int cmd_num = CommandForWindowKeyboardShortcut( |
| - it->command_key, it->shift_key, it->cntrl_key, it->opt_key, |
| - it->vkey_code, it->key_char); |
| - EXPECT_EQ(cmd_num, it->chrome_command); |
| + e.command_key, e.shift_key, e.cntrl_key, e.opt_key, |
| + e.vkey_code, e.key_char); |
| + EXPECT_EQ(cmd_num, e.chrome_command); |
| } |
| // Test that cmd-left and backspace are not window-level commands (else they |
| @@ -110,15 +106,11 @@ TEST(GlobalKeyboardShortcuts, ShortcutsToDelayedWindowCommand) { |
| 0, 0)); |
| // Check that all known keyboard shortcuts return valid results. |
| - size_t num_shortcuts = 0; |
| - const KeyboardShortcutData *it = |
| - GetDelayedWindowKeyboardShortcutTable(&num_shortcuts); |
| - ASSERT_GT(num_shortcuts, 0U); |
| - for (size_t i = 0; i < num_shortcuts; ++i, ++it) { |
| + for (const auto& e : GetDelayedWindowKeyboardShortcutTable()) { |
| int cmd_num = CommandForDelayedWindowKeyboardShortcut( |
| - it->command_key, it->shift_key, it->cntrl_key, it->opt_key, |
| - it->vkey_code, it->key_char); |
| - EXPECT_EQ(cmd_num, it->chrome_command); |
| + e.command_key, e.shift_key, e.cntrl_key, e.opt_key, |
| + e.vkey_code, e.key_char); |
| + EXPECT_EQ(cmd_num, e.chrome_command); |
| } |
| } |
| @@ -129,15 +121,11 @@ TEST(GlobalKeyboardShortcuts, ShortcutsToBrowserCommand) { |
| 0, 0)); |
| // Check that all known keyboard shortcuts return valid results. |
| - size_t num_shortcuts = 0; |
| - const KeyboardShortcutData *it = |
| - GetBrowserKeyboardShortcutTable(&num_shortcuts); |
| - ASSERT_GT(num_shortcuts, 0U); |
| - for (size_t i = 0; i < num_shortcuts; ++i, ++it) { |
| + for (const auto& e : GetBrowserKeyboardShortcutTable()) { |
| int cmd_num = CommandForBrowserKeyboardShortcut( |
| - it->command_key, it->shift_key, it->cntrl_key, it->opt_key, |
| - it->vkey_code, it->key_char); |
| - EXPECT_EQ(cmd_num, it->chrome_command); |
| + e.command_key, e.shift_key, e.cntrl_key, e.opt_key, |
| + e.vkey_code, e.key_char); |
| + EXPECT_EQ(cmd_num, e.chrome_command); |
| } |
| } |