5#include "flutter/shell/platform/embedder/tests/embedder_test_context.h"
9#include "flutter/fml/make_copyable.h"
10#include "flutter/fml/paths.h"
11#include "flutter/runtime/dart_vm.h"
12#include "flutter/shell/platform/embedder/tests/embedder_assertions.h"
13#include "flutter/testing/testing.h"
14#include "third_party/dart/runtime/bin/elf_loader.h"
21 : assets_path_(
std::move(assets_path)),
30 if (
auto resolver = weak_resolver.lock()) {
31 resolver->SetNativeResolverForIsolate();
142 std::move(update_semantics_custom_action_callback);
175 if (context->update_semantics_callback2_) {
189 if (context->update_semantics_callback_) {
203 if (context->update_semantics_node_callback_) {
217 if (context->update_semantics_custom_action_callback_) {
226 if (context->log_message_callback_) {
236 return supported_locales[0];
248 if (context->channel_update_callback_) {
260 <<
"Accessed the compositor on a context where one was not set up. Use "
261 "the config builder to set up a context with a custom compositor.";
268 compositor_->SetNextSceneCallback(next_scene_callback);
275 std::promise<sk_sp<SkImage>> promise;
276 auto future = promise.get_future();
279 promise.set_value(
image);
static bool IsRunningPrecompiledCode()
Checks if VM instances in the process can run precompiled code. This call can be made at any time and...
void RunVsyncCallback(intptr_t baton)
void SetSemanticsCustomActionCallback(SemanticsActionCallback semantics_custom_action)
const fml::Mapping * GetIsolateSnapshotData() const
std::vector< fml::closure > isolate_create_callbacks_
ChannelUpdateCallback channel_update_callback_
const fml::Mapping * GetVMSnapshotInstructions() const
void SetupAOTDataIfNecessary()
void AddNativeCallback(const char *name, Dart_NativeFunction function)
EmbedderTestCompositor & GetCompositor()
std::function< void(const FlutterPlatformMessage *)> platform_message_callback_
FlutterUpdateSemanticsNodeCallback GetUpdateSemanticsNodeCallbackHook()
std::unique_ptr< fml::Mapping > isolate_snapshot_instructions_
virtual ~EmbedderTestContext()
std::function< void(intptr_t)> vsync_callback_
void SetupAOTMappingsIfNecessary()
void SetSemanticsUpdateCallback(SemanticsUpdateCallback update_semantics)
std::shared_ptr< TestDartNativeResolver > native_resolver_
std::unique_ptr< fml::Mapping > vm_snapshot_data_
void SetVsyncCallback(std::function< void(intptr_t)> callback)
void FireIsolateCreateCallbacks()
const fml::Mapping * GetIsolateSnapshotInstructions() const
static FlutterLogMessageCallback GetLogMessageCallbackHook()
const std::string & GetAssetsPath() const
void SetSemanticsNodeCallback(SemanticsNodeCallback update_semantics_node)
SemanticsUpdateCallback update_semantics_callback_
std::unique_ptr< fml::Mapping > vm_snapshot_instructions_
static VoidCallback GetIsolateCreateCallbackHook()
ELFAOTSymbols aot_symbols_
void SetPlatformMessageCallback(const std::function< void(const FlutterPlatformMessage *)> &callback)
static FlutterComputePlatformResolvedLocaleCallback GetComputePlatformResolvedLocaleCallbackHook()
void SetChannelUpdateCallback(const ChannelUpdateCallback &callback)
void AddIsolateCreateCallback(const fml::closure &closure)
LogMessageCallback log_message_callback_
FlutterEngineAOTData GetAOTData() const
void SetNextSceneCallback(const NextSceneCallback &next_scene_callback)
SemanticsNodeCallback update_semantics_node_callback_
FlutterTransformation GetRootSurfaceTransformation()
void SetLogMessageCallback(const LogMessageCallback &log_message_callback)
std::unique_ptr< EmbedderTestCompositor > compositor_
EmbedderTestContext(std::string assets_path="")
void SetRootSurfaceTransformation(SkMatrix matrix)
SkMatrix root_surface_transformation_
NextSceneCallback next_scene_callback_
void SetSemanticsUpdateCallback2(SemanticsUpdateCallback2 update_semantics)
std::unique_ptr< fml::Mapping > isolate_snapshot_data_
std::function< void(sk_sp< SkImage > image)> NextSceneCallback
FlutterUpdateSemanticsCustomActionCallback GetUpdateSemanticsCustomActionCallbackHook()
std::future< sk_sp< SkImage > > GetNextSceneImage()
SemanticsUpdateCallback2 update_semantics_callback2_
FlutterUpdateSemanticsCallback2 GetUpdateSemanticsCallback2Hook()
FlutterUpdateSemanticsCallback GetUpdateSemanticsCallbackHook()
SemanticsActionCallback update_semantics_custom_action_callback_
void PlatformMessageCallback(const FlutterPlatformMessage *message)
FlutterChannelUpdateCallback GetChannelUpdateCallbackHook()
const fml::Mapping * GetVMSnapshotData() const
void FireRootSurfacePresentCallbackIfPresent(const std::function< sk_sp< SkImage >(void)> &image_callback)
void(* Dart_NativeFunction)(Dart_NativeArguments arguments)
FlutterEngineResult FlutterEngineCreateAOTData(const FlutterEngineAOTDataSource *source, FlutterEngineAOTData *data_out)
Creates the necessary data structures to launch a Flutter Dart application in AOT mode....
void(* FlutterUpdateSemanticsCustomActionCallback)(const FlutterSemanticsCustomAction *, void *)
void(* FlutterUpdateSemanticsCallback)(const FlutterSemanticsUpdate *, void *)
@ kFlutterEngineAOTDataSourceTypeElfPath
void(* FlutterLogMessageCallback)(const char *, const char *, void *)
void(* FlutterUpdateSemanticsNodeCallback)(const FlutterSemanticsNode *, void *)
const FlutterLocale *(* FlutterComputePlatformResolvedLocaleCallback)(const FlutterLocale **, size_t)
void(* FlutterUpdateSemanticsCallback2)(const FlutterSemanticsUpdate2 *, void *)
void(* FlutterChannelUpdateCallback)(const FlutterChannelUpdate *, void *)
FlutterTransformation FlutterTransformationMake(const SkMatrix &matrix)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
#define FML_CHECK(condition)
Dart_NativeFunction function
unsigned useCenter Optional< SkMatrix > matrix
sk_sp< const SkImage > image
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...
std::function< void(const FlutterSemanticsCustomAction *)> SemanticsActionCallback
std::function< void(const FlutterSemanticsNode *)> SemanticsNodeCallback
ELFAOTSymbols LoadELFSymbolFromFixturesIfNeccessary(std::string elf_filename)
Attempts to resolve AOT symbols from the portable ELF loader. This location is automatically resolved...
constexpr const char * kDefaultAOTAppELFFileName
std::function< void(const FlutterSemanticsUpdate2 *)> SemanticsUpdateCallback2
std::function< void(const char *tag, const char *message)> LogMessageCallback
std::function< void(const FlutterChannelUpdate *)> ChannelUpdateCallback
std::function< void(const FlutterSemanticsUpdate *)> SemanticsUpdateCallback
DEF_SWITCHES_START aot vmservice shared library name
std::string JoinPaths(std::initializer_list< std::string > components)
internal::CopyableLambda< T > MakeCopyable(T lambda)
std::function< void()> closure
An update to whether a message channel has a listener set or not.
FlutterEngineAOTDataSourceType type
const char * elf_path
Absolute path to an ELF library file.
A batch of updates to semantics nodes and custom actions.
const uint8_t * vm_snapshot_data
const uint8_t * vm_snapshot_instrs
const uint8_t * vm_isolate_instrs
const uint8_t * vm_isolate_data