Commit d36f5eae authored by Maksim Sisov's avatar Maksim Sisov Committed by Chromium LUCI CQ

ozone/wayland: set terminate gpu callback in fuzz tests

When CreateDmabufBasedBuffer call fails, it calls a gpu terminate
callback internally, which must be installed before the
host buffer manager is used.

Bug: 1160261
Change-Id: I90ea974ce9dbec5f36c3fae63002e573e80c7a9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2609827Reviewed-by: default avatarNick Yamane <nickdiego@igalia.com>
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Cr-Commit-Position: refs/heads/master@{#840958}
parent f1255df2
......@@ -17,6 +17,7 @@
#include "base/files/file_util.h"
#include "base/message_loop/message_pump_type.h"
#include "base/task/single_thread_task_executor.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "base/test/test_timeouts.h"
#include "mojo/core/embedder/embedder.h"
......@@ -34,6 +35,9 @@ using testing::_;
namespace {
using MockTerminateGpuCallback =
base::MockCallback<base::OnceCallback<void(std::string)>>;
// Copied from ui/ozone/test/mock_platform_window_delegate.h to avoid
// dependency from the whole library (it causes link problems).
class MockPlatformWindowDelegate : public ui::PlatformWindowDelegate {
......@@ -70,6 +74,7 @@ struct Environment {
}
base::test::TaskEnvironment task_environment;
MockTerminateGpuCallback callback_;
};
} // namespace
......@@ -145,6 +150,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
EXPECT_CALL(*server.zwp_linux_dmabuf_v1(), CreateParams(_, _, _));
auto* manager_host = connection->buffer_manager_host();
manager_host->SetTerminateGpuCallback(env.callback_.Get());
manager_host->CreateDmabufBasedBuffer(
mojo::PlatformHandle(std::move(fd)), buffer_size, strides, offsets,
modifiers, kFormat, kPlaneCount, kBufferId);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment