@@ -3339,9 +3339,9 @@ TEST_F(ShellTest, ImageGeneratorRegistryNotNullAfterParentShellDestroyed) {
33393339TEST_F (ShellTest, UpdateAssetResolverByTypeReplaces) {
33403340 ASSERT_FALSE (DartVMRef::IsInstanceRunning ());
33413341 Settings settings = CreateSettingsForFixture ();
3342- ThreadHost thread_host ( " io.flutter.test. " + GetCurrentTestName () + " . " ,
3343- ThreadHost::Type::Platform );
3344- auto task_runner = thread_host. platform_thread -> GetTaskRunner ();
3342+
3343+ fml::MessageLoop::EnsureInitializedForCurrentThread ( );
3344+ auto task_runner = fml::MessageLoop::GetCurrent (). GetTaskRunner ();
33453345 TaskRunners task_runners (" test" , task_runner, task_runner, task_runner,
33463346 task_runner);
33473347 auto shell = CreateShell (std::move (settings), task_runners);
@@ -3351,7 +3351,10 @@ TEST_F(ShellTest, UpdateAssetResolverByTypeReplaces) {
33513351 auto configuration = RunConfiguration::InferFromSettings (settings);
33523352 configuration.SetEntrypoint (" emptyMain" );
33533353 auto asset_manager = configuration.GetAssetManager ();
3354- RunEngine (shell.get (), std::move (configuration));
3354+
3355+ shell->RunEngine (std::move (configuration), [&](auto result) {
3356+ ASSERT_EQ (result, Engine::RunStatus::Success);
3357+ });
33553358
33563359 auto platform_view =
33573360 std::make_unique<PlatformView>(*shell.get (), std::move (task_runners));
@@ -3381,9 +3384,9 @@ TEST_F(ShellTest, UpdateAssetResolverByTypeReplaces) {
33813384TEST_F (ShellTest, UpdateAssetResolverByTypeAppends) {
33823385 ASSERT_FALSE (DartVMRef::IsInstanceRunning ());
33833386 Settings settings = CreateSettingsForFixture ();
3384- ThreadHost thread_host ( " io.flutter.test. " + GetCurrentTestName () + " . " ,
3385- ThreadHost::Type::Platform );
3386- auto task_runner = thread_host. platform_thread -> GetTaskRunner ();
3387+
3388+ fml::MessageLoop::EnsureInitializedForCurrentThread ( );
3389+ auto task_runner = fml::MessageLoop::GetCurrent (). GetTaskRunner ();
33873390 TaskRunners task_runners (" test" , task_runner, task_runner, task_runner,
33883391 task_runner);
33893392 auto shell = CreateShell (std::move (settings), task_runners);
@@ -3393,7 +3396,10 @@ TEST_F(ShellTest, UpdateAssetResolverByTypeAppends) {
33933396 auto configuration = RunConfiguration::InferFromSettings (settings);
33943397 configuration.SetEntrypoint (" emptyMain" );
33953398 auto asset_manager = configuration.GetAssetManager ();
3396- RunEngine (shell.get (), std::move (configuration));
3399+
3400+ shell->RunEngine (std::move (configuration), [&](auto result) {
3401+ ASSERT_EQ (result, Engine::RunStatus::Success);
3402+ });
33973403
33983404 auto platform_view =
33993405 std::make_unique<PlatformView>(*shell.get (), std::move (task_runners));
@@ -3456,10 +3462,9 @@ TEST_F(ShellTest, UpdateAssetResolverByTypeNull) {
34563462TEST_F (ShellTest, UpdateAssetResolverByTypeDoesNotReplaceMismatchType) {
34573463 ASSERT_FALSE (DartVMRef::IsInstanceRunning ());
34583464 Settings settings = CreateSettingsForFixture ();
3459- ThreadHost thread_host (ThreadHost::ThreadHostConfig (
3460- " io.flutter.test." + GetCurrentTestName () + " ." ,
3461- ThreadHost::Type::Platform));
3462- auto task_runner = thread_host.platform_thread ->GetTaskRunner ();
3465+
3466+ fml::MessageLoop::EnsureInitializedForCurrentThread ();
3467+ auto task_runner = fml::MessageLoop::GetCurrent ().GetTaskRunner ();
34633468 TaskRunners task_runners (" test" , task_runner, task_runner, task_runner,
34643469 task_runner);
34653470 auto shell = CreateShell (std::move (settings), task_runners);
@@ -3469,7 +3474,10 @@ TEST_F(ShellTest, UpdateAssetResolverByTypeDoesNotReplaceMismatchType) {
34693474 auto configuration = RunConfiguration::InferFromSettings (settings);
34703475 configuration.SetEntrypoint (" emptyMain" );
34713476 auto asset_manager = configuration.GetAssetManager ();
3472- RunEngine (shell.get (), std::move (configuration));
3477+
3478+ shell->RunEngine (std::move (configuration), [&](auto result) {
3479+ ASSERT_EQ (result, Engine::RunStatus::Success);
3480+ });
34733481
34743482 auto platform_view =
34753483 std::make_unique<PlatformView>(*shell.get (), std::move (task_runners));
0 commit comments