#include "ui/ozone/platform/wayland/test/wayland_ozone_ui_controls_test_helper.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "ui/base/test/ui_controls.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/events/keycodes/keyboard_code_conversion.h"
namespace ui {
OzoneUIControlsTestHelper* CreateOzoneUIControlsTestHelperWayland() { … }
}
namespace wl {
namespace {
uint32_t GetNextRequestId() { … }
}
WaylandOzoneUIControlsTestHelper::WaylandOzoneUIControlsTestHelper() { … }
WaylandOzoneUIControlsTestHelper::~WaylandOzoneUIControlsTestHelper() = default;
void WaylandOzoneUIControlsTestHelper::Reset() { … }
bool WaylandOzoneUIControlsTestHelper::SupportsScreenCoordinates() const { … }
unsigned WaylandOzoneUIControlsTestHelper::ButtonDownMask() const { … }
void WaylandOzoneUIControlsTestHelper::SendKeyEvents(
gfx::AcceleratedWidget widget,
ui::KeyboardCode key,
int key_event_types,
int accelerator_state,
base::OnceClosure closure) { … }
void WaylandOzoneUIControlsTestHelper::SendMouseMotionNotifyEvent(
gfx::AcceleratedWidget widget,
const gfx::Point& mouse_loc,
const gfx::Point& mouse_loc_in_screen,
base::OnceClosure closure) { … }
void WaylandOzoneUIControlsTestHelper::SendMouseEvent(
gfx::AcceleratedWidget widget,
ui_controls::MouseButton type,
int button_state,
int accelerator_state,
const gfx::Point& mouse_loc,
const gfx::Point& mouse_loc_in_screen,
base::OnceClosure closure) { … }
#if BUILDFLAG(IS_CHROMEOS_LACROS)
void WaylandOzoneUIControlsTestHelper::SendTouchEvent(
gfx::AcceleratedWidget widget,
int action,
int id,
const gfx::Point& touch_loc,
base::OnceClosure closure) {
uint32_t request_id = GetNextRequestId();
pending_closures_.insert_or_assign(request_id, std::move(closure));
input_emulate_->EmulateTouch(action, touch_loc, id, request_id);
}
void WaylandOzoneUIControlsTestHelper::UpdateDisplay(
const std::string& display_specs,
base::OnceClosure closure) {
uint32_t request_id = GetNextRequestId();
pending_closures_.insert_or_assign(request_id, std::move(closure));
input_emulate_->EmulateUpdateDisplay(display_specs, request_id);
}
#endif
void WaylandOzoneUIControlsTestHelper::RunClosureAfterAllPendingUIEvents(
base::OnceClosure closure) { … }
bool WaylandOzoneUIControlsTestHelper::MustUseUiControlsForMoveCursorTo() { … }
#if BUILDFLAG(IS_LINUX)
void WaylandOzoneUIControlsTestHelper::ForceUseScreenCoordinatesOnce() { … }
#endif
void WaylandOzoneUIControlsTestHelper::RequestProcessed(uint32_t request_id) { … }
}