OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "ui/events/event_utils.h" | 5 #include "ui/events/event_utils.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/mac/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "ui/events/event_constants.h" | 12 #include "ui/events/event_constants.h" |
13 #import "ui/events/test/cocoa_test_event_utils.h" | 13 #import "ui/events/test/cocoa_test_event_utils.h" |
14 #include "ui/gfx/point.h" | 14 #include "ui/gfx/geometry/point.h" |
15 #import "ui/gfx/test/ui_cocoa_test_helper.h" | 15 #import "ui/gfx/test/ui_cocoa_test_helper.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 NSWindow* g_test_window = nil; | 19 NSWindow* g_test_window = nil; |
20 | 20 |
21 } // namespace | 21 } // namespace |
22 | 22 |
23 // Mac APIs for creating test events are frustrating. Quartz APIs have, e.g., | 23 // Mac APIs for creating test events are frustrating. Quartz APIs have, e.g., |
24 // CGEventCreateMouseEvent() which can't set a window or modifier flags. | 24 // CGEventCreateMouseEvent() which can't set a window or modifier flags. |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 event = cocoa_test_event_utils::MouseEventWithType(NSMouseMoved, 0); | 306 event = cocoa_test_event_utils::MouseEventWithType(NSMouseMoved, 0); |
307 EXPECT_EQ(ui::ET_MOUSE_MOVED, ui::EventTypeFromNative(event)); | 307 EXPECT_EQ(ui::ET_MOUSE_MOVED, ui::EventTypeFromNative(event)); |
308 | 308 |
309 event = cocoa_test_event_utils::EnterExitEventWithType(NSMouseEntered); | 309 event = cocoa_test_event_utils::EnterExitEventWithType(NSMouseEntered); |
310 EXPECT_EQ(ui::ET_MOUSE_ENTERED, ui::EventTypeFromNative(event)); | 310 EXPECT_EQ(ui::ET_MOUSE_ENTERED, ui::EventTypeFromNative(event)); |
311 event = cocoa_test_event_utils::EnterExitEventWithType(NSMouseExited); | 311 event = cocoa_test_event_utils::EnterExitEventWithType(NSMouseExited); |
312 EXPECT_EQ(ui::ET_MOUSE_EXITED, ui::EventTypeFromNative(event)); | 312 EXPECT_EQ(ui::ET_MOUSE_EXITED, ui::EventTypeFromNative(event)); |
313 } | 313 } |
314 | 314 |
315 } // namespace ui | 315 } // namespace ui |
OLD | NEW |