diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 16:58:08 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 16:58:08 +0000 |
commit | 357226a1f9f615379a0add23fb8c81a7f598c282 (patch) | |
tree | 16ab65ecad0ae46e903403f5fb17958aeda56712 /chrome/common/cocoa_utils_unittest.mm | |
parent | 457f5cf27e7b74c5e6d161015532794f2ae88365 (diff) | |
download | chromium_src-357226a1f9f615379a0add23fb8c81a7f598c282.zip chromium_src-357226a1f9f615379a0add23fb8c81a7f598c282.tar.gz chromium_src-357226a1f9f615379a0add23fb8c81a7f598c282.tar.bz2 |
Add modifier key support for window open dispositions throught the Mac UI
* Add cocoa_utils.{h,mm} and a unit test for the one method it contains:
event_utils::DispositionFromEventFlags().
* Add modifier key support to the history menu, bookmark menu, infobars,
bookmark bar, and Omnibox.
BUG=17912,17301
TEST=When using the aforementioned UI elements, Cmd should open in new
foreground tab, Cmd+Shift should open in new background tab, and Shift should
open in a new window.
Patch by Robert Sesek.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23636 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/cocoa_utils_unittest.mm')
-rw-r--r-- | chrome/common/cocoa_utils_unittest.mm | 23 |
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)); +} |