Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ozone/wayland: set OsExchangeDataProvider factory.
Enabling ozone_unittests on linux bots revealed some problems with downcasting. In particular, linux-ubsan-vptr bot started to fail with the following error message - ./../ui/ozone/platform/wayland/host/wayland_data_drag_controller.cc:515:10: runtime error: downcast of address 0x2ccc00349e00 which does not point to an object of type 'const WaylandExchangeDataProvider' 0x2ccc00349e00: note: object is of type 'ui::OSExchangeDataProviderNonBacked' 00 00 00 00 28 3b f6 e3 f0 55 00 00 01 00 00 00 00 00 00 00 20 b1 26 00 cc 2c 00 00 28 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'ui::OSExchangeDataProviderNonBacked' #0 0x55f0e331831c in GetOfferedExchangeDataProvider ui/ozone/platform/wayland/host/wayland_data_drag_controller.cc:515:10 #1 0x55f0e331831c in ui::WaylandDataDragController::StartSession(ui::OSExchangeData const&, int, ui::mojom::DragEventSource) ui/ozone/platform/wayland/host/wayland_data_drag_controller.cc:133:23 #2 0x55f0e3366bbc in ui::WaylandWindow::StartDrag(ui::OSExchangeData const&, int, ui::mojom::DragEventSource, ui::Cursor, bool, base::OnceCallback<void (ui::mojom::DragOperation)>, ui::WmDragHandler::LocationDelegate*) ui/ozone/platform/wayland/host/wayland_window.cc:227:45 #3 0x55f0e2b28c32 in ui::WaylandDataDragControllerTest_AsyncNoopStartDrag_Test::TestBody() ui/ozone/platform/wayland/host/wayland_data_drag_controller_unittest.cc:973:28 #4 0x55f0e2e26ab1 in testing::Test::Run() third_party/googletest/src/googletest/src/gtest.cc:2670:5 #5 0x55f0e2e28046 in testing::TestInfo::Run() third_party/googletest/src/googletest/src/gtest.cc:2849:11 #6 0x55f0e2e29beb in testing::TestSuite::Run() third_party/googletest/src/googletest/src/gtest.cc:3008:30 #7 0x55f0e2e3fafe in testing::internal::UnitTestImpl::RunAllTests() third_party/googletest/src/googletest/src/gtest.cc:5866:44 #8 0x55f0e2e3e604 in testing::UnitTest::Run() third_party/googletest/src/googletest/src/gtest.cc:5440:10 #9 0x55f0e34276d1 in RUN_ALL_TESTS third_party/googletest/src/googletest/include/gtest/gtest.h:2284:73 #10 0x55f0e34276d1 in base::TestSuite::Run() base/test/test_suite.cc:463:16 #11 0x55f0e342b9dc in Run base/callback.h:145:12 #12 0x55f0e342b9dc in base::(anonymous namespace)::LaunchUnitTestsInternal(base::OnceCallback<int ()>, unsigned long, int, unsigned long, bool, base::RepeatingCallback<void ()>, base::OnceCallback<void ()>) base/test/launcher/unit_test_launcher.cc:181:38 #13 0x55f0e342b877 in base::LaunchUnitTests(int, char**, base::OnceCallback<int ()>, unsigned long) base/test/launcher/unit_test_launcher.cc:272:10 #14 0x55f0e2acc2cc in main mojo/core/test/run_all_unittests.cc:69:10 #15 0x7ff7560d4082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 #16 0x55f0e2ab4169 in _start (/home/msisov/code/chromium/src/out/asan/ozone_unittests+0xb13169) (BuildId: 77bfee5b71bd92da) It turned out that WaylandDataDragController was getting a non-backed provider as a Wayland one wasn't set (it's set during OzonePlatformWayland initialization in production). As a result, downcasting to WaylandExchangeDataProvider was illegal in tests. It's unknown why tests didn't fail. Probably, the result of the WaylandDataDragController::GetOfferedExchangeDataProvider was never used. And the problem with downcasting was only caught with this new bot. Bug: 1358123 Change-Id: I4c8deb16a57b485de1fabd91fdcaab136d5da639 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3865512 Commit-Queue: Maksim Sisov <msisov@igalia.com> Reviewed-by: Alexander Dunaev <adunaev@igalia.com> Cr-Commit-Position: refs/heads/main@{#1041976}
- Loading branch information