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](f100ecaab7/testing/dart/platform_isolate_test.dart (L65)), so this test isn't very useful anyway.
Closes https://github.com/flutter/flutter/issues/156251
This commit is contained in:
@@ -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<std::string>::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<PlatformConfiguration>(&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((
|
||||
|
||||
Reference in New Issue
Block a user