5#ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_UNITTESTS_UTIL_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_UNITTESTS_UTIL_H_
8#define FML_USED_ON_EMBEDDER
19#include "third_party/skia/include/core/SkSurface.h"
25 GrDirectContext* context);
37 const std::string&
name);
49 bool opengl_framebuffer);
61 bool opengl_framebuffer);
64 const std::string&
name,
65 const sk_sp<SkImage>&
image);
68 const sk_sp<SkImage>& scene_image);
71 std::future<sk_sp<SkImage>>& scene_image);
74 const std::vector<uint8_t>& bytes);
77 const std::vector<uint8_t>& bytes);
107 : identifier_(++sEmbedderTaskRunnerIdentifiers),
108 real_task_runner_(
std::move(real_task_runner)),
109 on_task_expired_(
std::move(on_task_expired)) {
114 task_runner_description_.
user_data =
this;
121 uint64_t target_time_nanos,
127 auto on_task_expired = thiz->on_task_expired_;
128 auto invoke_task = [task, on_task_expired]() { on_task_expired(task); };
129 auto real_task_runner = thiz->real_task_runner_;
131 real_task_runner->PostTaskForTime(invoke_task, target_time);
134 task_runner_description_.
identifier = identifier_;
142 return task_runner_description_;
146 static std::atomic_size_t sEmbedderTaskRunnerIdentifiers;
147 const size_t identifier_;
A task runner that we expect the embedder to provide but whose implementation is a real FML task runn...
void SetDestructionCallback(VoidCallback callback)
const FlutterTaskRunnerDescription & GetFlutterTaskRunnerDescription()
EmbedderTestTaskRunner(fml::RefPtr< fml::TaskRunner > real_task_runner, TaskExpiryCallback on_task_expired)
std::function< void(FlutterTask)> TaskExpiryCallback
virtual bool RunsTasksOnCurrentThread()
static constexpr TimeDelta FromNanoseconds(int64_t nanos)
static constexpr TimePoint FromEpochDelta(TimeDelta ticks)
FlutterPlatformViewMutationType
void(* VoidCallback)(void *)
FlutterVulkanImage * image
const gchar FlBinaryMessengerMessageHandler handler
FlutterDesktopBinaryReply callback
#define FML_CHECK(condition)
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
bool WriteImageToDisk(const fml::UniqueFD &directory, const std::string &name, const sk_sp< SkImage > &image)
sk_sp< SkSurface > CreateRenderSurface(const FlutterLayer &layer, GrDirectContext *context)
void FilterMutationsByType(const FlutterPlatformViewMutation **mutations, size_t count, FlutterPlatformViewMutationType type, const std::function< void(const FlutterPlatformViewMutation &mutation)> &handler)
bool SurfacePixelDataMatchesBytes(SkSurface *surface, const std::vector< uint8_t > &bytes)
void ConfigureBackingStore(FlutterBackingStore &backing_store, EmbedderTestContextType backend, bool opengl_framebuffer)
Configures per-backend properties for a given backing store.
bool RasterImagesAreSame(const sk_sp< SkImage > &a, const sk_sp< SkImage > &b)
std::string FixtureNameForBackend(EmbedderTestContextType backend, const std::string &name)
Prepends a prefix to the name which is unique to the test context type. This is useful for tests that...
bool ImageMatchesFixture(const std::string &fixture_file_name, const sk_sp< SkImage > &scene_image)
EmbedderTestBackingStoreProducer::RenderTargetType GetRenderTargetFromBackend(EmbedderTestContextType backend, bool opengl_framebuffer)
Resolves a render target type for a given backend description. This is useful for tests that use Embe...
DlMatrix GetTotalMutationTransformationMatrix(const FlutterPlatformViewMutation **mutations, size_t count)
impeller::Matrix DlMatrix
DEF_SWITCHES_START aot vmservice shared library name
size_t struct_size
The size of this struct. Must be sizeof(FlutterTaskRunnerDescription).
BoolCallback runs_task_on_current_thread_callback
FlutterTaskRunnerPostTaskCallback post_task_callback
VoidCallback destruction_callback
The callback invoked when the task runner is destroyed.