5#include "flutter/common/task_runners.h"
6#include "flutter/fml/mapping.h"
7#include "flutter/fml/synchronization/waitable_event.h"
8#include "flutter/lib/ui/window/platform_message_response_dart.h"
9#include "flutter/runtime/dart_vm.h"
10#include "flutter/shell/common/shell_test.h"
11#include "flutter/shell/common/thread_host.h"
12#include "flutter/testing/testing.h"
18 bool did_pass =
false;
19 auto message_latch = std::make_shared<fml::AutoResetWaitableEvent>();
27 auto nativeCallPlatformMessageResponseDart =
30 auto dart_state = std::make_shared<tonic::DartState>();
31 auto response = fml::MakeRefCounted<PlatformMessageResponseDart>(
34 ui_task_runner,
"foobar");
35 uint8_t*
data =
static_cast<uint8_t*
>(
malloc(100));
36 auto mapping = std::make_unique<fml::MallocMapping>(
data, 100);
37 response->Complete(std::move(mapping));
40 AddNativeCallback(
"CallPlatformMessageResponseDart",
43 auto nativeFinishCallResponse = [message_latch,
47 message_latch->Signal();
50 AddNativeCallback(
"FinishCallResponse",
55 std::unique_ptr<Shell>
shell = CreateShell(
settings, task_runners);
57 ASSERT_TRUE(
shell->IsSetup());
59 configuration.SetEntrypoint(
"platformMessageResponseTest");
61 shell->RunEngine(std::move(configuration), [](
auto result) {
65 message_latch->Wait();
67 ASSERT_TRUE(did_pass);
68 DestroyShell(std::move(
shell), task_runners);
static RunConfiguration InferFromSettings(const Settings &settings, const fml::RefPtr< fml::TaskRunner > &io_worker=nullptr, IsolateLaunchType launch_type=IsolateLaunchType::kNewGroup)
Attempts to infer a run configuration from the settings object. This tries to create a run configurat...
fml::RefPtr< fml::TaskRunner > GetUITaskRunner() const
static DartState * Current()
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
struct _Dart_NativeArguments * Dart_NativeArguments
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
fml::RefPtr< fml::TaskRunner > CreateNewThread(const std::string &name)
fml::RefPtr< fml::TaskRunner > GetCurrentTaskRunner()
void * malloc(size_t size)
TEST_F(DisplayListTest, Defaults)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
#define CREATE_NATIVE_ENTRY(native_entry)