From 118cc70a56b3788d5460d0ea733d0c4113d2e236 Mon Sep 17 00:00:00 2001 From: Liam Appelbe Date: Tue, 8 Oct 2024 14:17:23 +1100 Subject: [PATCH] Delete DartIsolateTest.PlatformIsolateSendAndReceive (flutter/engine#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/f100ecaab76db0c74dd9aeb214899a022726c323/testing/dart/platform_isolate_test.dart#L65), so this test isn't very useful anyway. Closes https://github.com/flutter/flutter/issues/156251 --- .../flutter/runtime/dart_isolate_unittests.cc | 73 ------------------- 1 file changed, 73 deletions(-) diff --git a/engine/src/flutter/runtime/dart_isolate_unittests.cc b/engine/src/flutter/runtime/dart_isolate_unittests.cc index a030d99ddd..9f7bb9a59d 100644 --- a/engine/src/flutter/runtime/dart_isolate_unittests.cc +++ b/engine/src/flutter/runtime/dart_isolate_unittests.cc @@ -892,79 +892,6 @@ TEST_F(DartIsolateTest, PlatformIsolateEarlyShutdown) { // root isolate will be auto-shutdown } -TEST_F(DartIsolateTest, PlatformIsolateSendAndReceive) { - fml::AutoResetWaitableEvent message_latch; - AddNativeCallback( - "PassMessage", - CREATE_NATIVE_ENTRY(([&message_latch](Dart_NativeArguments args) { - auto message = tonic::DartConverter::FromDart( - Dart_GetNativeArgument(args, 0)); - ASSERT_EQ("Platform isolate received: Hello from root isolate!", - message); - message_latch.Signal(); - }))); - - FakePlatformConfigurationClient client; - auto platform_configuration = - std::make_unique(&client); - - ASSERT_FALSE(DartVMRef::IsInstanceRunning()); - auto settings = CreateSettingsForFixture(); - auto vm_ref = DartVMRef::Create(settings); - ASSERT_TRUE(vm_ref); - auto vm_data = vm_ref.GetVMData(); - ASSERT_TRUE(vm_data); - - auto platform_thread = CreateNewThread(); - auto ui_thread = CreateNewThread(); - TaskRunners task_runners(GetCurrentTestName(), // label - platform_thread, // platform - ui_thread, // raster - ui_thread, // ui - ui_thread // io - ); - auto isolate = RunDartCodeInIsolate( - vm_ref, settings, task_runners, "emptyMain", {}, - GetDefaultKernelFilePath(), {}, std::move(platform_configuration)); - ASSERT_TRUE(isolate); - auto root_isolate = isolate->get(); - ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::Running); - - fml::AutoResetWaitableEvent ui_thread_latch; - Dart_Isolate platform_isolate = nullptr; - fml::TaskRunner::RunNowOrPostTask( - ui_thread, fml::MakeCopyable([&]() mutable { - ASSERT_TRUE(isolate->RunInIsolateScope([root_isolate, - &platform_isolate]() { - Dart_Handle lib = Dart_RootLibrary(); - Dart_Handle entry_point = Dart_Invoke( - lib, tonic::ToDart("createEntryPointForPlatIsoSendAndRecvTest"), - 0, nullptr); - char* error = nullptr; - platform_isolate = - root_isolate->CreatePlatformIsolate(entry_point, &error); - EXPECT_FALSE(error); - return true; - })); - ui_thread_latch.Signal(); - })); - ui_thread_latch.Wait(); - - // Wait for a message from the platform isolate. - message_latch.Wait(); - - // Post a task to the platform_thread that runs after the platform isolate's - // entry point and all messages, and wait for it to run. - fml::AutoResetWaitableEvent epilogue_latch; - fml::TaskRunner::RunNowOrPostTask( - platform_thread, fml::MakeCopyable([&epilogue_latch]() mutable { - epilogue_latch.Signal(); - })); - epilogue_latch.Wait(); - - // root isolate will be auto-shutdown -} - TEST_F(DartIsolateTest, PlatformIsolateCreationAfterManagerShutdown) { AddNativeCallback("PassMessage", CREATE_NATIVE_ENTRY((