#if defined(USE_X11)
#include <X11/Xlib.h>
#include "ui/base/x/x11_util.h"
+#include "ui/events/event_utils.h"
+#include "ui/events/test/events_test_utils_x11.h"
#endif
#if defined(OS_WIN)
PressMoveAndReleaseTouchTo(CenterOfWindow(window));
}
+void EventGenerator::GestureEdgeSwipe() {
+ ui::GestureEvent gesture(
+ ui::ET_GESTURE_WIN8_EDGE_SWIPE,
+ 0,
+ 0,
+ 0,
+ ui::EventTimeForNow(),
+ ui::GestureEventDetails(ui::ET_GESTURE_WIN8_EDGE_SWIPE, 0, 0),
+ 0);
+ Dispatch(&gesture);
+}
+
void EventGenerator::GestureTapAt(const gfx::Point& location) {
const int kTouchId = 2;
ui::TouchEvent press(ui::ET_TOUCH_PRESSED,
MSG native_event =
{ NULL, (is_press ? key_press : WM_KEYUP), key_code, 0 };
TestKeyEvent keyev(native_event, flags, key_press == WM_CHAR);
+#elif defined(USE_X11)
+ ui::ScopedXI2Event xevent;
+ xevent.InitKeyEvent(is_press ? ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED,
+ key_code,
+ flags);
+ ui::KeyEvent keyev(xevent, false);
#else
ui::EventType type = is_press ? ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED;
ui::KeyEvent keyev(type, key_code, flags, false);
}
pending_events_.push_back(pending_event);
} else {
- WindowTreeHostDelegate* root_window_host_delegate =
- current_root_window_->AsWindowTreeHostDelegate();
- if (event->IsKeyEvent()) {
- root_window_host_delegate->OnHostKeyEvent(
- static_cast<ui::KeyEvent*>(event));
- } else if (event->IsMouseEvent()) {
- root_window_host_delegate->OnHostMouseEvent(
- static_cast<ui::MouseEvent*>(event));
- } else if (event->IsTouchEvent()) {
- root_window_host_delegate->OnHostTouchEvent(
- static_cast<ui::TouchEvent*>(event));
- } else if (event->IsScrollEvent()) {
- root_window_host_delegate->OnHostScrollEvent(
- static_cast<ui::ScrollEvent*>(event));
- } else {
- NOTREACHED() << "Invalid event type";
- }
+ ui::EventDispatchDetails details = current_root_window_->OnEventFromSource(
+ event);
+ CHECK(!details.dispatcher_destroyed);
}
}