40 {
44 ASSERT_TRUE(vm_ref);
45 auto vm_data = vm_ref.GetVMData();
46 ASSERT_TRUE(vm_data);
47
53 );
54
55 auto isolate_configuration =
57
58 UIDartState::Context context(task_runners);
59 context.advisory_script_uri = "main.dart";
60 context.advisory_script_entrypoint = "main";
62 vm_data->GetSettings(),
63 vm_data->GetIsolateSnapshot(),
64 nullptr,
65 DartIsolate::Flags{},
66 nullptr,
67 settings.isolate_create_callback,
68 settings.isolate_shutdown_callback,
69 "main",
70 std::nullopt,
71 {},
72 std::move(isolate_configuration),
73 context
74 );
75 root_isolate_ = weak_isolate.lock()->isolate();
76 ASSERT_TRUE(root_isolate_);
77
78 test();
79
80 Dart_EnterIsolate(root_isolate_);
81 Dart_ShutdownIsolate();
82 }
static std::weak_ptr< DartIsolate > CreateRunningRootIsolate(const Settings &settings, const fml::RefPtr< const DartSnapshot > &isolate_snapshot, std::unique_ptr< PlatformConfiguration > platform_configuration, Flags flags, const fml::closure &root_isolate_create_callback, const fml::closure &isolate_create_callback, const fml::closure &isolate_shutdown_callback, std::optional< std::string > dart_entrypoint, std::optional< std::string > dart_entrypoint_library, const std::vector< std::string > &dart_entrypoint_args, std::unique_ptr< IsolateConfiguration > isolate_configuration, const UIDartState::Context &context, const DartIsolate *spawning_isolate=nullptr, std::shared_ptr< NativeAssetsManager > native_assets_manager=nullptr)
Creates an instance of a root isolate and returns a weak pointer to the same. The isolate instance ma...
static DartVMRef Create(const Settings &settings, fml::RefPtr< const DartSnapshot > vm_snapshot=nullptr, fml::RefPtr< const DartSnapshot > isolate_snapshot=nullptr)
static bool IsInstanceRunning()
static std::unique_ptr< IsolateConfiguration > InferFromSettings(const Settings &settings, const std::shared_ptr< AssetManager > &asset_manager=nullptr, const fml::RefPtr< fml::TaskRunner > &io_worker=nullptr, IsolateLaunchType launch_type=IsolateLaunchType::kNewGroup)
Attempts to infer the isolate configuration from the Settings object. If the VM is configured for AOT...
virtual Settings CreateSettingsForFixture()
fml::RefPtr< fml::TaskRunner > GetCurrentTaskRunner()
Get the task runner for the thread that the current unit-test is running on. This creates a message l...
std::string GetCurrentTestName()
Gets the name of the currently running test. This is useful in generating logs or assets based on tes...