Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: ui/events/cocoa/events_mac_unittest.mm

Issue 322893005: MacViews: Add WidgetEventGenerator to abstract platform-specific event generation for tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cull orthogonal stuff, add WidgetTest.MouseEventTypesViaGenerator Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // Removing the border, and sending the same event should move it down in the 281 // Removing the border, and sending the same event should move it down in the
282 // toolkit-views coordinate system. 282 // toolkit-views coordinate system.
283 int height_change = NSHeight(frame_rect) - kTestHeight; 283 int height_change = NSHeight(frame_rect) - kTestHeight;
284 EXPECT_GT(height_change, 0); 284 EXPECT_GT(height_change, 0);
285 [test_window() setStyleMask:NSBorderlessWindowMask]; 285 [test_window() setStyleMask:NSBorderlessWindowMask];
286 [test_window() setFrame:frame_rect display:YES]; 286 [test_window() setFrame:frame_rect display:YES];
287 EXPECT_EQ(gfx::Point(0, kTestHeight + height_change), 287 EXPECT_EQ(gfx::Point(0, kTestHeight + height_change),
288 ui::EventLocationFromNative(event)); 288 ui::EventLocationFromNative(event));
289 } 289 }
290 290
291 // Tests mouse movement events.
292 TEST_F(EventsMacTest, MoveEvents) {
293 gfx::Point location(5, 10);
294
295 NSEvent* event = TestMouseEvent(NSMouseMoved, location, 0);
296 EXPECT_EQ(ui::ET_MOUSE_MOVED, ui::EventTypeFromNative(event));
297 EXPECT_EQ(ui::EF_NONE, ui::EventFlagsFromNative(event));
298 EXPECT_EQ(location, ui::EventLocationFromNative(event));
299 }
300
291 } // namespace ui 301 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698