summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa/accelerators_cocoa_unittest.mm
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui/cocoa/accelerators_cocoa_unittest.mm')
-rw-r--r--chrome/browser/ui/cocoa/accelerators_cocoa_unittest.mm28
1 files changed, 28 insertions, 0 deletions
diff --git a/chrome/browser/ui/cocoa/accelerators_cocoa_unittest.mm b/chrome/browser/ui/cocoa/accelerators_cocoa_unittest.mm
new file mode 100644
index 0000000..ef1436d
--- /dev/null
+++ b/chrome/browser/ui/cocoa/accelerators_cocoa_unittest.mm
@@ -0,0 +1,28 @@
+// Copyright (c) 2010 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.
+
+#import <Cocoa/Cocoa.h>
+
+#include "app/menus/accelerator_cocoa.h"
+#include "base/singleton.h"
+#include "chrome/app/chrome_command_ids.h"
+#import "chrome/browser/ui/cocoa/accelerators_cocoa.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/gtest_mac.h"
+
+TEST(AcceleratorsCocoaTest, GetAccelerator) {
+ AcceleratorsCocoa* keymap = AcceleratorsCocoa::GetInstance();
+ const menus::AcceleratorCocoa* accelerator =
+ keymap->GetAcceleratorForCommand(IDC_COPY);
+ ASSERT_TRUE(accelerator);
+ EXPECT_NSEQ(@"c", accelerator->characters());
+ EXPECT_EQ(static_cast<int>(NSCommandKeyMask), accelerator->modifiers());
+}
+
+TEST(AcceleratorsCocoaTest, GetNullAccelerator) {
+ AcceleratorsCocoa* keymap = AcceleratorsCocoa::GetInstance();
+ const menus::AcceleratorCocoa* accelerator =
+ keymap->GetAcceleratorForCommand(314159265);
+ EXPECT_FALSE(accelerator);
+}