summaryrefslogtreecommitdiffstats
path: root/ui/events/test/events_test_utils_x11.h
diff options
context:
space:
mode:
Diffstat (limited to 'ui/events/test/events_test_utils_x11.h')
-rw-r--r--ui/events/test/events_test_utils_x11.h82
1 files changed, 30 insertions, 52 deletions
diff --git a/ui/events/test/events_test_utils_x11.h b/ui/events/test/events_test_utils_x11.h
index 0fffd22..4faa8f4 100644
--- a/ui/events/test/events_test_utils_x11.h
+++ b/ui/events/test/events_test_utils_x11.h
@@ -26,72 +26,50 @@ struct Valuator {
class ScopedXI2Event {
public:
- explicit ScopedXI2Event(XEvent* event);
+ ScopedXI2Event();
~ScopedXI2Event();
operator XEvent*() { return event_.get(); }
+ // Initializes a XEvent with for the appropriate type with the specified data.
+ // Note that ui::EF_ flags should be passed as |flags|, not the native ones in
+ // <X11/X.h>.
+ void InitKeyEvent(EventType type,
+ KeyboardCode key_code,
+ int flags);
+
+ void InitButtonEvent(EventType type,
+ int flags);
+
+ void InitMouseWheelEvent(int wheel_delta,
+ int flags);
+
+ void InitScrollEvent(int deviceid,
+ int x_offset,
+ int y_offset,
+ int x_offset_ordinal,
+ int y_offset_ordinal,
+ int finger_count);
+
+ void InitTouchEvent(int deviceid,
+ int evtype,
+ int tracking_id,
+ const gfx::Point& location,
+ const std::vector<Valuator>& valuators);
+
private:
+ void Cleanup();
+
scoped_ptr<XEvent> event_;
DISALLOW_COPY_AND_ASSIGN(ScopedXI2Event);
};
-// Initializes a XEvent that holds XKeyEvent for testing. Note that ui::EF_
-// flags should be passed as |flags|, not the native ones in <X11/X.h>.
-void InitXKeyEventForTesting(EventType type,
- KeyboardCode key_code,
- int flags,
- XEvent* event);
-
-// Initializes a XEvent that holds XButtonEvent for testing. Note that ui::EF_
-// flags should be passed as |flags|, not the native ones in <X11/X.h>.
-void InitXButtonEventForTesting(EventType type,
- int flags,
- XEvent* event);
-
-// Initializes an XEvent for an Aura MouseWheelEvent. The underlying native
-// event is an XButtonEvent.
-void InitXMouseWheelEventForTesting(int wheel_delta,
- int flags,
- XEvent* event);
-
-// Creates a native scroll event, based on a XInput2Event. The caller is
-// responsible for the ownership of the returned XEvent. Consider wrapping
-// the XEvent in a ScopedXI2Event, as XEvent is purely a struct and simply
-// deleting it will result in dangling pointers.
-XEvent* CreateScrollEventForTest(
- int deviceid,
- int x_offset,
- int y_offset,
- int x_offset_ordinal,
- int y_offset_ordinal,
- int finger_count);
-
-// Creates the native XInput2 based XEvent for an aura scroll event of type
-// ET_SCROLL_FLING_START or ET_SCROLL_FLING_CANCEL. The caller is responsible
-// for the ownership of the returned XEvent.
-XEvent* CreateFlingEventForTest(
- int deviceid,
- int x_velocity,
- int y_velocity,
- int x_velocity_ordinal,
- int y_velocity_ordinal,
- bool is_cancel);
-
// Initializes a test touchpad device for scroll events.
void SetUpScrollDeviceForTest(unsigned int deviceid);
-#if defined(USE_XI2_MT)
-XEvent* CreateTouchEventForTest(
- int deviceid,
- int evtype,
- int tracking_id,
- const gfx::Point& location,
- const std::vector<Valuator>& valuators);
-
+// Initializes a list of touchscreen devices for touch events.
void SetupTouchDevicesForTest(const std::vector<unsigned int>& devices);
-#endif // defined(USE_XI2_MT)
} // namespace ui