#include "base/test/mock_callback.h"
#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/ozone/platform/wayland/host/wayland_data_drag_controller.h"
#include <linux/input.h>
#include <wayland-server.h>
#include <memory>
#include <string>
#include <vector>
#include "base/containers/contains.h"
#include "base/containers/flat_set.h"
#include "base/functional/bind.h"
#include "base/pickle.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/test/bind.h"
#include "build/chromeos_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/clipboard/clipboard_constants.h"
#include "ui/base/clipboard/clipboard_format_type.h"
#include "ui/base/clipboard/file_info.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/dragdrop/os_exchange_data_provider_factory.h"
#include "ui/events/base_event_utils.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h"
#include "ui/ozone/platform/wayland/host/wayland_cursor_position.h"
#include "ui/ozone/platform/wayland/host/wayland_data_device.h"
#include "ui/ozone/platform/wayland/host/wayland_data_device_manager.h"
#include "ui/ozone/platform/wayland/host/wayland_data_offer.h"
#include "ui/ozone/platform/wayland/host/wayland_data_source.h"
#include "ui/ozone/platform/wayland/host/wayland_serial_tracker.h"
#include "ui/ozone/platform/wayland/host/wayland_window.h"
#include "ui/ozone/platform/wayland/test/mock_pointer.h"
#include "ui/ozone/platform/wayland/test/mock_surface.h"
#include "ui/ozone/platform/wayland/test/scoped_wl_array.h"
#include "ui/ozone/platform/wayland/test/test_data_device.h"
#include "ui/ozone/platform/wayland/test/test_data_device_manager.h"
#include "ui/ozone/platform/wayland/test/test_data_offer.h"
#include "ui/ozone/platform/wayland/test/test_data_source.h"
#include "ui/ozone/platform/wayland/test/test_keyboard.h"
#include "ui/ozone/platform/wayland/test/test_wayland_server_thread.h"
#include "ui/ozone/platform/wayland/test/wayland_drag_drop_test.h"
#include "ui/ozone/platform/wayland/test/wayland_test.h"
#include "ui/ozone/public/platform_clipboard.h"
#include "ui/platform_window/platform_window_init_properties.h"
#include "ui/platform_window/wm/wm_drag_handler.h"
#include "ui/platform_window/wm/wm_drop_handler.h"
#include "url/gurl.h"
_;
AtMost;
Eq;
Mock;
Values;
DragEventSource;
DragOperation;
namespace ui {
namespace {
constexpr char kSampleTextForDragAndDrop[] = …;
constexpr char16_t kSampleTextForDragAndDrop16[] = …;
constexpr FilenameToURLPolicy kFilenameToURLPolicy = …;
template <typename StringType>
PlatformClipboard::Data ToClipboardData(const StringType& data_string) { … }
}
class MockDropHandler : public WmDropHandler { … };
class WaylandDataDragControllerTest : public WaylandDragDropTest { … };
TEST_P(WaylandDataDragControllerTest, StartDrag) { … }
TEST_P(WaylandDataDragControllerTest, StartDragWithWrongMimeType) { … }
TEST_P(WaylandDataDragControllerTest, StartDragWithCustomFormats) { … }
TEST_P(WaylandDataDragControllerTest, StartDragWithFileContents) { … }
TEST_P(WaylandDataDragControllerTest, CancelOutgoingDrag) { … }
TEST_P(WaylandDataDragControllerTest, CancelOutgoingDragOutsideWindow) { … }
TEST_P(WaylandDataDragControllerTest, CancelIncomingDrag) { … }
MATCHER_P(PointFNear, n, "") { … }
TEST_P(WaylandDataDragControllerTest, ReceiveDrag) { … }
TEST_P(WaylandDataDragControllerTest, ReceiveDragPixelSurface) { … }
TEST_P(WaylandDataDragControllerTest, DropSeveralMimeTypes) { … }
TEST_P(WaylandDataDragControllerTest, ValidateDroppedUriList) { … }
TEST_P(WaylandDataDragControllerTest, ValidateDroppedXMozUrl) { … }
TEST_P(WaylandDataDragControllerTest, StartAndCancel) { … }
TEST_P(WaylandDataDragControllerTest, ForeignDragHandleAskAction) { … }
TEST_P(WaylandDataDragControllerTest, DestroyEnteredSurface) { … }
TEST_P(WaylandDataDragControllerTest, DestroyOriginSurface) { … }
TEST_P(WaylandDataDragControllerTest, DragToNonToplevelWindows) { … }
TEST_P(WaylandDataDragControllerTest, PopupRequestCreatesPopupWindow) { … }
TEST_P(WaylandDataDragControllerTest, MenuRequestCreatesPopupWindow) { … }
TEST_P(WaylandDataDragControllerTest, AsyncNoopStartDrag) { … }
TEST_P(WaylandDataDragControllerTest, SuppressPointerButtonReleasesAfterEnter) { … }
TEST_P(WaylandDataDragControllerTest, StartDragWithCorrectSerial) { … }
TEST_P(WaylandDataDragControllerTest, StartDragWithCorrectSerialForDragSource) { … }
TEST_P(WaylandDataDragControllerTest, DropWhileFetchingData) { … }
TEST_P(WaylandDataDragControllerTest, DndActionsToDragOperations) { … }
TEST_P(WaylandDataDragControllerTest,
DISABLED_DestroyWindowWhileFetchingForeignData) { … }
TEST_P(WaylandDataDragControllerTest, LeaveWindowWhileFetchingData) { … }
TEST_P(WaylandDataDragControllerTest,
CursorPositionShouldBeUpdatedDuringMouseDrag) { … }
TEST_P(WaylandDataDragControllerTest,
CursorPositionShouldNotBeUpdatedDuringTouchDrag) { … }
TEST_P(WaylandDataDragControllerTest, OutgoingSessionWithoutDndFinished) { … }
#if !BUILDFLAG(IS_CHROMEOS_LACROS)
INSTANTIATE_TEST_SUITE_P(…);
#else
INSTANTIATE_TEST_SUITE_P(
XdgVersionStableTestWithAuraShell,
WaylandDataDragControllerTest,
Values(wl::ServerConfig{.enable_aura_shell =
wl::EnableAuraShellProtocol::kEnabled},
wl::ServerConfig{
.enable_aura_shell = wl::EnableAuraShellProtocol::kEnabled}));
#endif
}