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

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 at r282511 Created 6 years, 5 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/base/test/event_generator_base.h"
11 #include "ui/gfx/geometry/point.h"
12 #include "ui/gfx/native_widget_types.h"
13
14 namespace base {
15 class TimeDelta;
16 }
17
18 namespace views {
19 namespace test {
20
21 // Encapsulates event generation for an NSWindow. Implements the parts of the
22 // interface provided by aura::test::EventGenerator that are used for cross-
23 // platform toolkit-views tests. Only a single window is supported.
24 class WidgetEventGeneratorMac : public ui::test::EventGeneratorBase {
25 public:
26 explicit WidgetEventGeneratorMac(gfx::NativeWindow ns_window);
27 virtual ~WidgetEventGeneratorMac();
28
29 void GestureTapAt(const gfx::Point& point);
30 void GestureScrollSequence(const gfx::Point& start,
31 const gfx::Point& end,
32 const base::TimeDelta& duration,
33 int steps);
34 void GestureMultiFingerScroll(int count,
35 const gfx::Point start[],
36 int event_separation_time_ms,
37 int steps,
38 int move_x,
39 int move_y);
40
41 protected:
42 // Overridden from EventGeneratorBase:
43 virtual gfx::Point GetLocationInCurrentRoot() const OVERRIDE;
44 virtual void DoMoveMouseTo(const gfx::Point& point_in_screen,
45 int count) OVERRIDE;
46 virtual void DispatchMouseEvent(ui::EventType type,
47 const gfx::Point& location_in_root,
48 int flags,
49 int changed_button_flags) OVERRIDE;
50
51 private:
52 class Impl;
53
54 // Platform specific things, so that this file can be included in .cc files.
55 scoped_ptr<Impl> impl_;
56
57 gfx::NativeWindow ns_window_;
58
59 DISALLOW_COPY_AND_ASSIGN(WidgetEventGeneratorMac);
60 };
61
62 } // namespace test
63 } // namespace views
64
65 #endif // UI_VIEWS_TEST_WIDGET_EVENT_GENERATOR_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698