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

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: 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 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..c19e3c652badf6a6c76933166a2b733f7acb8a10
--- /dev/null
+++ b/ui/views/test/widget_event_generator_mac.h
@@ -0,0 +1,65 @@
+// 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/base/test/event_generator_base.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 ui::test::EventGeneratorBase {
+ public:
+ explicit WidgetEventGeneratorMac(gfx::NativeWindow ns_window);
+ virtual ~WidgetEventGeneratorMac();
+
+ 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);
+
+ protected:
+ // Overridden from EventGeneratorBase:
+ virtual gfx::Point GetLocationInCurrentRoot() const OVERRIDE;
+ virtual void DoMoveMouseTo(const gfx::Point& point_in_screen,
+ int count) OVERRIDE;
+ virtual void DispatchMouseEvent(ui::EventType type,
+ const gfx::Point& location_in_root,
+ int flags,
+ int changed_button_flags) OVERRIDE;
+
+ private:
+ class Impl;
+
+ // Platform specific things, so that this file can be included in .cc files.
+ scoped_ptr<Impl> impl_;
+
+ gfx::NativeWindow ns_window_;
+
+ 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