summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm7
-rw-r--r--chrome/browser/ui/cocoa/event_utils_unittest.mm58
2 files changed, 37 insertions, 28 deletions
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
index c6f06bd..0457fc6 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
@@ -986,7 +986,7 @@ TEST_F(BookmarkBarControllerTest, MiddleClick) {
EXPECT_TRUE(first);
[first otherMouseUp:
- cocoa_test_event_utils::MakeMouseEvent(NSOtherMouseUp, 0)];
+ cocoa_test_event_utils::MouseEventWithType(NSOtherMouseUp, 0)];
EXPECT_EQ(noOpenBar()->urls_.size(), 1U);
}
@@ -1303,7 +1303,8 @@ TEST_F(BookmarkBarControllerTest, TestFolders) {
EXPECT_EQ([[bar_ buttons] count], 2U);
// First confirm mouseEntered does nothing if "menus" aren't active.
- NSEvent* event = cocoa_test_event_utils::MakeMouseEvent(NSOtherMouseUp, 0);
+ NSEvent* event =
+ cocoa_test_event_utils::MouseEventWithType(NSOtherMouseUp, 0);
[bar_ mouseEnteredButton:[[bar_ buttons] objectAtIndex:0] event:event];
EXPECT_FALSE([bar_ folderController]);
@@ -1441,7 +1442,7 @@ TEST_F(BookmarkBarControllerTest, OffTheSideFolder) {
}
TEST_F(BookmarkBarControllerTest, EventToExitCheck) {
- NSEvent* event = cocoa_test_event_utils::MakeMouseEvent(NSMouseMoved, 0);
+ NSEvent* event = cocoa_test_event_utils::MouseEventWithType(NSMouseMoved, 0);
EXPECT_FALSE([bar_ isEventAnExitEvent:event]);
BookmarkBarFolderWindow* folderWindow = [[[BookmarkBarFolderWindow alloc]
diff --git a/chrome/browser/ui/cocoa/event_utils_unittest.mm b/chrome/browser/ui/cocoa/event_utils_unittest.mm
index 376df50..972e74a 100644
--- a/chrome/browser/ui/cocoa/event_utils_unittest.mm
+++ b/chrome/browser/ui/cocoa/event_utils_unittest.mm
@@ -27,11 +27,11 @@ class EventUtilsTest : public CocoaTest {
TEST_F(EventUtilsTest, TestWindowOpenDispositionFromNSEvent) {
// Left Click = same tab.
- NSEvent* me = cocoa_test_event_utils::MakeMouseEvent(NSLeftMouseUp, 0);
+ NSEvent* me = cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp, 0);
EXPECT_EQ(CURRENT_TAB, event_utils::WindowOpenDispositionFromNSEvent(me));
// Middle Click = new background tab.
- me = cocoa_test_event_utils::MakeMouseEvent(NSOtherMouseUp, 0);
+ me = cocoa_test_event_utils::MouseEventWithType(NSOtherMouseUp, 0);
EXPECT_EQ(NEW_BACKGROUND_TAB,
event_utils::WindowOpenDispositionFromNSEvent(me));
@@ -39,86 +39,94 @@ TEST_F(EventUtilsTest, TestWindowOpenDispositionFromNSEvent) {
{
ScopedClassSwizzler swizzler([NSEvent class], [TestEvent class],
@selector(modifierFlags));
- me = cocoa_test_event_utils::MakeMouseEvent(NSOtherMouseUp, NSShiftKeyMask);
+ me = cocoa_test_event_utils::MouseEventWithType(NSOtherMouseUp,
+ NSShiftKeyMask);
EXPECT_EQ(NEW_FOREGROUND_TAB,
event_utils::WindowOpenDispositionFromNSEvent(me));
}
// Cmd+Left Click = new background tab.
- me = cocoa_test_event_utils::MakeMouseEvent(NSLeftMouseUp, NSCommandKeyMask);
+ me = cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp,
+ NSCommandKeyMask);
EXPECT_EQ(NEW_BACKGROUND_TAB,
event_utils::WindowOpenDispositionFromNSEvent(me));
// Cmd+Shift+Left Click = new foreground tab.
- me = cocoa_test_event_utils::MakeMouseEvent(NSLeftMouseUp,
+ me = cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp,
NSCommandKeyMask |
NSShiftKeyMask);
EXPECT_EQ(NEW_FOREGROUND_TAB,
event_utils::WindowOpenDispositionFromNSEvent(me));
// Shift+Left Click = new window
- me = cocoa_test_event_utils::MakeMouseEvent(NSLeftMouseUp, NSShiftKeyMask);
+ me = cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp,
+ NSShiftKeyMask);
EXPECT_EQ(NEW_WINDOW, event_utils::WindowOpenDispositionFromNSEvent(me));
}
TEST_F(EventUtilsTest, TestEventFlagsFromNSEvent) {
// Left click.
- NSEvent* left = cocoa_test_event_utils::MakeMouseEvent(NSLeftMouseUp, 0);
+ NSEvent* left = cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp, 0);
EXPECT_EQ(ui::EF_LEFT_BUTTON_DOWN,
event_utils::EventFlagsFromNSEvent(left));
// Right click.
- NSEvent* right = cocoa_test_event_utils::MakeMouseEvent(NSRightMouseUp, 0);
+ NSEvent* right = cocoa_test_event_utils::MouseEventWithType(NSRightMouseUp,
+ 0);
EXPECT_EQ(ui::EF_RIGHT_BUTTON_DOWN,
event_utils::EventFlagsFromNSEvent(right));
// Middle click.
- NSEvent* middle = cocoa_test_event_utils::MakeMouseEvent(NSOtherMouseUp, 0);
+ NSEvent* middle = cocoa_test_event_utils::MouseEventWithType(NSOtherMouseUp,
+ 0);
EXPECT_EQ(ui::EF_MIDDLE_BUTTON_DOWN,
event_utils::EventFlagsFromNSEvent(middle));
// Caps + Left
- NSEvent* caps = cocoa_test_event_utils::MakeMouseEvent(NSLeftMouseUp,
- NSAlphaShiftKeyMask);
+ NSEvent* caps =
+ cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp,
+ NSAlphaShiftKeyMask);
EXPECT_EQ(ui::EF_LEFT_BUTTON_DOWN | ui::EF_CAPS_LOCK_DOWN,
event_utils::EventFlagsFromNSEvent(caps));
// Shift + Left
- NSEvent* shift = cocoa_test_event_utils::MakeMouseEvent(NSLeftMouseUp,
- NSShiftKeyMask);
+ NSEvent* shift = cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp,
+ NSShiftKeyMask);
EXPECT_EQ(ui::EF_LEFT_BUTTON_DOWN | ui::EF_SHIFT_DOWN,
event_utils::EventFlagsFromNSEvent(shift));
// Ctrl + Left
- NSEvent* ctrl = cocoa_test_event_utils::MakeMouseEvent(NSLeftMouseUp,
- NSControlKeyMask);
+ NSEvent* ctrl = cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp,
+ NSControlKeyMask);
EXPECT_EQ(ui::EF_LEFT_BUTTON_DOWN | ui::EF_CONTROL_DOWN,
event_utils::EventFlagsFromNSEvent(ctrl));
// Alt + Left
- NSEvent* alt = cocoa_test_event_utils::MakeMouseEvent(NSLeftMouseUp,
- NSAlternateKeyMask);
+ NSEvent* alt = cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp,
+ NSAlternateKeyMask);
EXPECT_EQ(ui::EF_LEFT_BUTTON_DOWN | ui::EF_ALT_DOWN,
event_utils::EventFlagsFromNSEvent(alt));
// Cmd + Left
- NSEvent* cmd = cocoa_test_event_utils::MakeMouseEvent(NSLeftMouseUp,
- NSCommandKeyMask);
+ NSEvent* cmd = cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp,
+ NSCommandKeyMask);
EXPECT_EQ(ui::EF_LEFT_BUTTON_DOWN | ui::EF_COMMAND_DOWN,
event_utils::EventFlagsFromNSEvent(cmd));
// Shift + Ctrl + Left
- NSEvent* shiftctrl = cocoa_test_event_utils::MakeMouseEvent(NSLeftMouseUp,
- NSShiftKeyMask |
- NSControlKeyMask);
+ NSEvent* shiftctrl =
+ cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp,
+ NSShiftKeyMask |
+ NSControlKeyMask);
EXPECT_EQ(ui::EF_LEFT_BUTTON_DOWN | ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
event_utils::EventFlagsFromNSEvent(shiftctrl));
// Cmd + Alt + Right
- NSEvent* cmdalt = cocoa_test_event_utils::MakeMouseEvent(NSLeftMouseUp,
- NSCommandKeyMask |
- NSAlternateKeyMask);
+ NSEvent* cmdalt =
+ cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp,
+ NSCommandKeyMask |
+ NSAlternateKeyMask);
EXPECT_EQ(ui::EF_LEFT_BUTTON_DOWN | ui::EF_COMMAND_DOWN | ui::EF_ALT_DOWN,
event_utils::EventFlagsFromNSEvent(cmdalt));
}