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

Unified Diff: chrome/browser/global_keyboard_shortcuts_mac_unittest.cc

Issue 149325: Add facitility for Global Keyboard shortcuts. (Closed)
Patch Set: Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/global_keyboard_shortcuts_mac_unittest.cc
diff --git a/chrome/browser/global_keyboard_shortcuts_mac_unittest.cc b/chrome/browser/global_keyboard_shortcuts_mac_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c8c22d2a114c5538258cea72c011470c2d6596af
--- /dev/null
+++ b/chrome/browser/global_keyboard_shortcuts_mac_unittest.cc
@@ -0,0 +1,22 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/global_keyboard_shortcuts_mac.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(GlobalKeyboardShortcuts, ShortCutsToCommand) {
+ // Test that an invalid shortcut translates into an invalid command id.
+ ASSERT_EQ(CommandForKeyboardShortcut(false, false, false, 0), -1);
+
+ // Check that all known keyboard shortcuts return valid results.
+ size_t num_shortcuts = 0;
+ const KeyboardShortcutData *it = GetKeyboardShortCutTable(&num_shortcuts);
+ ASSERT_GT(num_shortcuts, 0U);
+ for (size_t i = 0; i < num_shortcuts; ++i, ++it) {
+ int cmd_num = CommandForKeyboardShortcut(it->command_key, it->shift_key,
+ it->cntrl_key, it->vkey_code);
+ ASSERT_EQ(cmd_num, it->chrome_command);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698