summaryrefslogtreecommitdiffstats
path: root/chrome/common/cocoa_utils_unittest.mm
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/cocoa_utils_unittest.mm')
-rw-r--r--chrome/common/cocoa_utils_unittest.mm23
1 files changed, 23 insertions, 0 deletions
diff --git a/chrome/common/cocoa_utils_unittest.mm b/chrome/common/cocoa_utils_unittest.mm
new file mode 100644
index 0000000..e9ce0ae
--- /dev/null
+++ b/chrome/common/cocoa_utils_unittest.mm
@@ -0,0 +1,23 @@
+// 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.
+
+#import "chrome/common/cocoa_utils.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(CocoaUtilsTest, DispositionFromEventFlagsTest) {
+ ASSERT_EQ(NEW_FOREGROUND_TAB,
+ event_utils::DispositionFromEventFlags(NSCommandKeyMask));
+ ASSERT_EQ(NEW_BACKGROUND_TAB,
+ event_utils::DispositionFromEventFlags(NSCommandKeyMask |
+ NSShiftKeyMask));
+ ASSERT_EQ(NEW_WINDOW,
+ event_utils::DispositionFromEventFlags(NSShiftKeyMask));
+ // The SAVE_TO_DISK disposition is not currently supported, so we use
+ // CURRENT_TAB instead.
+ ASSERT_EQ(CURRENT_TAB,
+ event_utils::DispositionFromEventFlags(NSAlternateKeyMask));
+ ASSERT_EQ(CURRENT_TAB, event_utils::DispositionFromEventFlags(0));
+ ASSERT_EQ(CURRENT_TAB,
+ event_utils::DispositionFromEventFlags(NSControlKeyMask));
+}