diff --git a/shell/platform/embedder/fixtures/main.dart b/shell/platform/embedder/fixtures/main.dart index 9ec4a2c6a87dd..bd2232b656f62 100644 --- a/shell/platform/embedder/fixtures/main.dart +++ b/shell/platform/embedder/fixtures/main.dart @@ -3,12 +3,13 @@ // found in the LICENSE file. import 'dart:async'; +import 'dart:convert'; +import 'dart:core'; +import 'dart:ffi'; +import 'dart:io'; +import 'dart:isolate'; import 'dart:typed_data'; import 'dart:ui'; -import 'dart:isolate'; -import 'dart:ffi'; -import 'dart:core'; -import 'dart:convert'; void main() {} @@ -32,6 +33,14 @@ void sayHiFromCustomEntrypoint2() native 'SayHiFromCustomEntrypoint2'; void sayHiFromCustomEntrypoint3() native 'SayHiFromCustomEntrypoint3'; +@pragma('vm:entry-point') +void terminateExitCodeHandler() { + final ProcessResult result = Process.runSync( + 'ls', [] + ); +} + + @pragma('vm:entry-point') void invokePlatformTaskRunner() { PlatformDispatcher.instance.sendPlatformMessage('OhHi', null, null); diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index 9a57e1aae5f89..ea9904d9c0e1f 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -123,6 +123,15 @@ TEST_F(EmbedderTest, CanInvokeCustomEntrypointMacro) { ASSERT_TRUE(engine.is_valid()); } +TEST_F(EmbedderTest, CanTerminateCleanly) { + auto& context = GetEmbedderContext(EmbedderTestContextType::kSoftwareContext); + EmbedderConfigBuilder builder(context); + builder.SetSoftwareRendererConfig(); + builder.SetDartEntrypoint("terminateExitCodeHandler"); + auto engine = builder.LaunchEngine(); + ASSERT_TRUE(engine.is_valid()); +} + std::atomic_size_t EmbedderTestTaskRunner::sEmbedderTaskRunnerIdentifiers = {}; TEST_F(EmbedderTest, CanSpecifyCustomPlatformTaskRunner) {