#include "ui/views/interaction/interaction_test_util_views.h"
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/i18n/rtl.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_enums.mojom-shared.h"
#include "ui/base/ime/text_input_client.h"
#include "ui/base/interaction/element_tracker.h"
#include "ui/base/interaction/interaction_test_util.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/events/event_constants.h"
#include "ui/events/gesture_event_details.h"
#include "ui/events/types/event_type.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/combobox/combobox.h"
#include "ui/views/controls/editable_combobox/editable_combobox.h"
#include "ui/views/controls/menu/menu_host.h"
#include "ui/views/controls/menu/menu_host_root_view.h"
#include "ui/views/controls/menu/menu_item_view.h"
#include "ui/views/controls/menu/submenu_view.h"
#include "ui/views/controls/tabbed_pane/tabbed_pane.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/interaction/element_tracker_views.h"
#include "ui/views/test/widget_activation_waiter.h"
#include "ui/views/test/widget_test.h"
#include "ui/views/view.h"
#include "ui/views/view_observer.h"
#include "ui/views/view_tracker.h"
#include "ui/views/view_utils.h"
#include "ui/views/widget/any_widget_observer.h"
#include "ui/views/window/dialog_delegate.h"
#if BUILDFLAG(IS_OZONE)
#include "ui/ozone/public/ozone_platform.h"
#endif
#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE) && \
!BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS)
#define HANDLE_WAYLAND_FAILURE …
#else
#define HANDLE_WAYLAND_FAILURE …
#endif
#if HANDLE_WAYLAND_FAILURE
#include "ui/views/widget/widget_observer.h"
#endif
namespace views::test {
namespace {
#if HANDLE_WAYLAND_FAILURE
class WidgetActivationWaiterWayland final : public WidgetObserver { … };
#endif
class DropdownItemSelector { … };
gfx::Point GetCenter(views::View* view) { … }
bool SendDefaultAction(View* target) { … }
template <class T>
void SendMouseClick(T* target, const gfx::Point& point) { … }
template <class T>
void SendTapGesture(T* target, const gfx::Point& point) { … }
bool SendKeyPress(View* view, ui::KeyboardCode code, int flags = ui::EF_NONE) { … }
}
InteractionTestUtilSimulatorViews::InteractionTestUtilSimulatorViews() =
default;
InteractionTestUtilSimulatorViews::~InteractionTestUtilSimulatorViews() =
default;
ui::test::ActionResult InteractionTestUtilSimulatorViews::PressButton(
ui::TrackedElement* element,
InputType input_type) { … }
ui::test::ActionResult InteractionTestUtilSimulatorViews::SelectMenuItem(
ui::TrackedElement* element,
InputType input_type) { … }
ui::test::ActionResult InteractionTestUtilSimulatorViews::DoDefaultAction(
ui::TrackedElement* element,
InputType input_type) { … }
ui::test::ActionResult InteractionTestUtilSimulatorViews::SelectTab(
ui::TrackedElement* tab_collection,
size_t index,
InputType input_type) { … }
ui::test::ActionResult InteractionTestUtilSimulatorViews::SelectDropdownItem(
ui::TrackedElement* dropdown,
size_t index,
InputType input_type) { … }
ui::test::ActionResult InteractionTestUtilSimulatorViews::EnterText(
ui::TrackedElement* element,
std::u16string text,
TextEntryMode mode) { … }
ui::test::ActionResult InteractionTestUtilSimulatorViews::ActivateSurface(
ui::TrackedElement* element) { … }
ui::test::ActionResult InteractionTestUtilSimulatorViews::SendAccelerator(
ui::TrackedElement* element,
ui::Accelerator accelerator) { … }
ui::test::ActionResult InteractionTestUtilSimulatorViews::Confirm(
ui::TrackedElement* element) { … }
bool InteractionTestUtilSimulatorViews::IsWayland() { … }
ui::test::ActionResult InteractionTestUtilSimulatorViews::ActivateWidget(
Widget* widget) { … }
bool InteractionTestUtilSimulatorViews::DoDefaultAction(View* view,
InputType input_type) { … }
void InteractionTestUtilSimulatorViews::PressButton(Button* button,
InputType input_type) { … }
}