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

Side by Side Diff: ui/views/test/widget_event_generator_mac.h

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: Rebase on crrev/334573008 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_TEST_WIDGET_EVENT_GENERATOR_MAC_H_
6 #define UI_VIEWS_TEST_WIDGET_EVENT_GENERATOR_MAC_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/gfx/geometry/point.h"
11 #include "ui/gfx/native_widget_types.h"
12
13 namespace base {
14 class TimeDelta;
15 }
16
17 namespace views {
18 namespace test {
19
20 // Encapsulates event generation for an NSWindow. Implements the parts of the
21 // interface provided by aura::test::EventGenerator that are used for cross-
22 // platform toolkit-views tests. Only a single window is supported.
23 class WidgetEventGeneratorMac {
Robert Sesek 2014/06/18 16:43:02 Could this be made an interface implemented by bot
tapted 2014/06/19 11:23:21 Done. I've just moved out the bits shared so far,
24 public:
25 explicit WidgetEventGeneratorMac(gfx::NativeWindow ns_window);
26 ~WidgetEventGeneratorMac();
27
28 void set_current_location(const gfx::Point& location) {
29 current_location_ = location;
30 }
31 const gfx::Point& current_location() const { return current_location_; }
32
33 int flags() const { return flags_; }
34
35 void PressLeftButton();
36 void ReleaseLeftButton();
37 void ClickLeftButton();
38 void PressRightButton();
39 void ReleaseRightButton();
40
41 void GestureTapAt(const gfx::Point& point);
42 void GestureScrollSequence(const gfx::Point& start,
43 const gfx::Point& end,
44 const base::TimeDelta& duration,
45 int steps);
46 void GestureMultiFingerScroll(int count,
47 const gfx::Point start[],
48 int event_separation_time_ms,
49 int steps,
50 int move_x,
51 int move_y);
52
53 void MoveMouseTo(const gfx::Point& point_in_screen, int count);
54 void MoveMouseTo(const gfx::Point& point_in_screen) {
55 MoveMouseTo(point_in_screen, 1);
56 }
57 void MoveMouseTo(int x, int y) {
58 MoveMouseTo(gfx::Point(x, y));
59 }
60 void DragMouseTo(const gfx::Point& point);
61
62 private:
63 class Impl;
64
65 void PressButton(int flag);
66 void ReleaseButton(int flag);
67
68 // Platform specific things.
69 scoped_ptr<Impl> impl_;
70
71 gfx::Point current_location_;
72 gfx::NativeWindow ns_window_;
73 int flags_;
74
75 DISALLOW_COPY_AND_ASSIGN(WidgetEventGeneratorMac);
76 };
77
78 } // namespace test
79 } // namespace views
80
81 #endif // UI_VIEWS_TEST_WIDGET_EVENT_GENERATOR_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698