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
13#include "flutter/fml/mapping.h"
14#include "flutter/fml/message_loop.h"
15#include "flutter/fml/paths.h"
16#include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
17#include "flutter/shell/platform/embedder/tests/embedder_config_builder.h"
18#include "flutter/shell/platform/embedder/tests/embedder_test.h"
37 const std::string&
name);
49 bool opengl_framebuffer);
61 bool opengl_framebuffer);
64 const std::string&
name,
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_;
133 task_runner_description_.
identifier = identifier_;
137 return task_runner_description_;
141 static std::atomic_size_t sEmbedderTaskRunnerIdentifiers;
142 const size_t identifier_;
A task runner that we expect the embedder to provide but whose implementation is a real FML task runn...
const FlutterTaskRunnerDescription & GetFlutterTaskRunnerDescription()
EmbedderTestTaskRunner(fml::RefPtr< fml::TaskRunner > real_task_runner, TaskExpiryCallback on_task_expired)
std::function< void(FlutterTask)> TaskExpiryCallback
virtual void PostTaskForTime(const fml::closure &task, fml::TimePoint target_time)
virtual bool RunsTasksOnCurrentThread()
static constexpr TimeDelta FromNanoseconds(int64_t nanos)
static constexpr TimePoint FromEpochDelta(TimeDelta ticks)
FlutterPlatformViewMutationType
#define FML_CHECK(condition)
Dart_NativeFunction function
sk_sp< const SkImage > image
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)
SkMatrix GetTotalMutationTransformationMatrix(const FlutterPlatformViewMutation **mutations, size_t count)
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...
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