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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/test/widget_event_generator_mac.h
diff --git a/ui/views/test/widget_event_generator_mac.h b/ui/views/test/widget_event_generator_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..cb0ca7a057693b10af0bd905c4f2e44eaf48a7e4
--- /dev/null
+++ b/ui/views/test/widget_event_generator_mac.h
@@ -0,0 +1,81 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_TEST_WIDGET_EVENT_GENERATOR_MAC_H_
+#define UI_VIEWS_TEST_WIDGET_EVENT_GENERATOR_MAC_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace base {
+class TimeDelta;
+}
+
+namespace views {
+namespace test {
+
+// Encapsulates event generation for an NSWindow. Implements the parts of the
+// interface provided by aura::test::EventGenerator that are used for cross-
+// platform toolkit-views tests. Only a single window is supported.
+class WidgetEventGeneratorMac {
+ public:
+ explicit WidgetEventGeneratorMac(NSWindow* ns_window);
Andre 2014/06/17 21:17:56 Should be gfx::NativeWindow to match ns_window_ be
tapted 2014/06/18 08:28:06 Done.
+ ~WidgetEventGeneratorMac();
+
+ void set_current_location(const gfx::Point& location) {
+ current_location_ = location;
+ }
+ const gfx::Point& current_location() const { return current_location_; }
+
+ int flags() const { return flags_; }
+
+ void PressLeftButton();
+ void ReleaseLeftButton();
+ void ClickLeftButton();
+ void PressRightButton();
+ void ReleaseRightButton();
+
+ void GestureTapAt(const gfx::Point& point);
+ void GestureScrollSequence(const gfx::Point& start,
+ const gfx::Point& end,
+ const base::TimeDelta& duration,
+ int steps);
+ void GestureMultiFingerScroll(int count,
+ const gfx::Point start[],
+ int event_separation_time_ms,
+ int steps,
+ int move_x,
+ int move_y);
+
+ void MoveMouseTo(const gfx::Point& point_in_screen, int count);
+ void MoveMouseTo(const gfx::Point& point_in_screen) {
+ MoveMouseTo(point_in_screen, 1);
+ }
+ void MoveMouseTo(int x, int y) {
+ MoveMouseTo(gfx::Point(x, y));
+ }
+ void DragMouseTo(const gfx::Point& point);
+
+ private:
+ class Impl;
+
+ void PressButton(int flag);
+ void ReleaseButton(int flag);
+
+ // Platform specific things.
+ scoped_ptr<Impl> impl_;
+
+ gfx::Point current_location_;
+ gfx::NativeWindow ns_window_;
+ int flags_;
+
+ DISALLOW_COPY_AND_ASSIGN(WidgetEventGeneratorMac);
+};
+
+} // namespace test
+} // namespace views
+
+#endif // UI_VIEWS_TEST_WIDGET_EVENT_GENERATOR_MAC_H_

Powered by Google App Engine
This is Rietveld 408576698