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_port.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 nativeCallPlatformMessageResponseDartPort =
30 auto dart_state = std::make_shared<tonic::DartState>();
31 auto response = fml::MakeRefCounted<PlatformMessageResponseDartPort>(
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));
41 "CallPlatformMessageResponseDartPort",
44 auto nativeFinishCallResponse = [message_latch,
48 message_latch->Signal();
51 AddNativeCallback(
"FinishCallResponse",
56 std::unique_ptr<Shell>
shell = CreateShell(
settings, task_runners);
58 ASSERT_TRUE(
shell->IsSetup());
60 configuration.SetEntrypoint(
"platformMessagePortResponseTest");
62 shell->RunEngine(std::move(configuration), [](
auto result) {
66 message_latch->Wait();
68 ASSERT_TRUE(did_pass);
69 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
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)