Add embedder unit test that reproduces https://github.com/dart-lang/sdk/issues/46275 (flutter/engine#27392)
* Add embedder unit test that reproduces the problem described in https://github.com/dart-lang/sdk/issues/46275 * Address code review comments.
This commit is contained in:
@@ -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', <String>[]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
void invokePlatformTaskRunner() {
|
||||
PlatformDispatcher.instance.sendPlatformMessage('OhHi', null, null);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user