Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5923a8b

Browse files
authored
Delete DartIsolateTest.PlatformIsolateSendAndReceive (#55722)
This test is flaky on the mac bots, but I can't repro the failure locally. Sending and receiving messages from the platform isolate is covered more realistically by the [Dart test](https://github.com/flutter/engine/blob/fd1ccdb95e0380d461812c9a6cd2684861970cb9/testing/dart/platform_isolate_test.dart#L65), so this test isn't very useful anyway. Closes flutter/flutter#156251
1 parent fd1ccdb commit 5923a8b

File tree

1 file changed

+0
-73
lines changed

1 file changed

+0
-73
lines changed

runtime/dart_isolate_unittests.cc

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -892,79 +892,6 @@ TEST_F(DartIsolateTest, PlatformIsolateEarlyShutdown) {
892892
// root isolate will be auto-shutdown
893893
}
894894

895-
TEST_F(DartIsolateTest, PlatformIsolateSendAndReceive) {
896-
fml::AutoResetWaitableEvent message_latch;
897-
AddNativeCallback(
898-
"PassMessage",
899-
CREATE_NATIVE_ENTRY(([&message_latch](Dart_NativeArguments args) {
900-
auto message = tonic::DartConverter<std::string>::FromDart(
901-
Dart_GetNativeArgument(args, 0));
902-
ASSERT_EQ("Platform isolate received: Hello from root isolate!",
903-
message);
904-
message_latch.Signal();
905-
})));
906-
907-
FakePlatformConfigurationClient client;
908-
auto platform_configuration =
909-
std::make_unique<PlatformConfiguration>(&client);
910-
911-
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
912-
auto settings = CreateSettingsForFixture();
913-
auto vm_ref = DartVMRef::Create(settings);
914-
ASSERT_TRUE(vm_ref);
915-
auto vm_data = vm_ref.GetVMData();
916-
ASSERT_TRUE(vm_data);
917-
918-
auto platform_thread = CreateNewThread();
919-
auto ui_thread = CreateNewThread();
920-
TaskRunners task_runners(GetCurrentTestName(), // label
921-
platform_thread, // platform
922-
ui_thread, // raster
923-
ui_thread, // ui
924-
ui_thread // io
925-
);
926-
auto isolate = RunDartCodeInIsolate(
927-
vm_ref, settings, task_runners, "emptyMain", {},
928-
GetDefaultKernelFilePath(), {}, std::move(platform_configuration));
929-
ASSERT_TRUE(isolate);
930-
auto root_isolate = isolate->get();
931-
ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::Running);
932-
933-
fml::AutoResetWaitableEvent ui_thread_latch;
934-
Dart_Isolate platform_isolate = nullptr;
935-
fml::TaskRunner::RunNowOrPostTask(
936-
ui_thread, fml::MakeCopyable([&]() mutable {
937-
ASSERT_TRUE(isolate->RunInIsolateScope([root_isolate,
938-
&platform_isolate]() {
939-
Dart_Handle lib = Dart_RootLibrary();
940-
Dart_Handle entry_point = Dart_Invoke(
941-
lib, tonic::ToDart("createEntryPointForPlatIsoSendAndRecvTest"),
942-
0, nullptr);
943-
char* error = nullptr;
944-
platform_isolate =
945-
root_isolate->CreatePlatformIsolate(entry_point, &error);
946-
EXPECT_FALSE(error);
947-
return true;
948-
}));
949-
ui_thread_latch.Signal();
950-
}));
951-
ui_thread_latch.Wait();
952-
953-
// Wait for a message from the platform isolate.
954-
message_latch.Wait();
955-
956-
// Post a task to the platform_thread that runs after the platform isolate's
957-
// entry point and all messages, and wait for it to run.
958-
fml::AutoResetWaitableEvent epilogue_latch;
959-
fml::TaskRunner::RunNowOrPostTask(
960-
platform_thread, fml::MakeCopyable([&epilogue_latch]() mutable {
961-
epilogue_latch.Signal();
962-
}));
963-
epilogue_latch.Wait();
964-
965-
// root isolate will be auto-shutdown
966-
}
967-
968895
TEST_F(DartIsolateTest, PlatformIsolateCreationAfterManagerShutdown) {
969896
AddNativeCallback("PassMessage",
970897
CREATE_NATIVE_ENTRY((

0 commit comments

Comments
 (0)