Skip to content

Commit

Permalink
Add embedder unit test that reproduces dart-lang/sdk#46275 (flutter#2…
Browse files Browse the repository at this point in the history
…7392)

* Add embedder unit test that reproduces the problem described in
dart-lang/sdk#46275

* Address code review comments.
  • Loading branch information
a-siva authored Jul 20, 2021
1 parent 78c0e2e commit cb3d359
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
17 changes: 13 additions & 4 deletions shell/platform/embedder/fixtures/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

Expand All @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions shell/platform/embedder/tests/embedder_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit cb3d359

Please sign in to comment.