| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <objc/objc-class.h> | 5 #import <objc/objc-class.h> |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 8 #include "chrome/browser/ui/cocoa/event_utils.h" | 8 #include "chrome/browser/ui/cocoa/event_utils.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "testing/platform_test.h" | 10 #include "testing/platform_test.h" |
| 11 #include "ui/base/events.h" | 11 #include "ui/base/events/event_constants.h" |
| 12 #include "ui/base/test/cocoa_test_event_utils.h" | 12 #include "ui/base/test/cocoa_test_event_utils.h" |
| 13 | 13 |
| 14 // We provide a donor class with a specially modified |modifierFlags| | 14 // We provide a donor class with a specially modified |modifierFlags| |
| 15 // implementation that we swap with NSEvent's. This is because we can't create a | 15 // implementation that we swap with NSEvent's. This is because we can't create a |
| 16 // NSEvent that represents a middle click with modifiers. | 16 // NSEvent that represents a middle click with modifiers. |
| 17 @interface TestEvent : NSObject | 17 @interface TestEvent : NSObject |
| 18 @end | 18 @end |
| 19 @implementation TestEvent | 19 @implementation TestEvent |
| 20 - (NSUInteger)modifierFlags { return NSShiftKeyMask; } | 20 - (NSUInteger)modifierFlags { return NSShiftKeyMask; } |
| 21 @end | 21 @end |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // Cmd + Alt + Right | 125 // Cmd + Alt + Right |
| 126 NSEvent* cmdalt = | 126 NSEvent* cmdalt = |
| 127 cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp, | 127 cocoa_test_event_utils::MouseEventWithType(NSLeftMouseUp, |
| 128 NSCommandKeyMask | | 128 NSCommandKeyMask | |
| 129 NSAlternateKeyMask); | 129 NSAlternateKeyMask); |
| 130 EXPECT_EQ(ui::EF_LEFT_MOUSE_BUTTON | ui::EF_COMMAND_DOWN | ui::EF_ALT_DOWN, | 130 EXPECT_EQ(ui::EF_LEFT_MOUSE_BUTTON | ui::EF_COMMAND_DOWN | ui::EF_ALT_DOWN, |
| 131 event_utils::EventFlagsFromNSEvent(cmdalt)); | 131 event_utils::EventFlagsFromNSEvent(cmdalt)); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace | 134 } // namespace |
| OLD | NEW |