@@ -4639,22 +4639,40 @@ TEST_F(ShellTest, RuntimeStageBackendWithImpeller) {
46394639 ASSERT_TRUE (shell);
46404640
46414641 fml::AutoResetWaitableEvent latch;
4642- AddNativeCallback (" NotifyNative" , CREATE_NATIVE_ENTRY ([&latch](auto args) {
4643- auto backend =
4644- UIDartState::Current ()->GetRuntimeStageBackend ();
4642+
4643+ std::optional<impeller::Context::BackendType> impeller_backend;
4644+ fml::TaskRunner::RunNowOrPostTask (
4645+ shell->GetTaskRunners ().GetPlatformTaskRunner (),
4646+ [platform_view = shell->GetPlatformView (), &latch, &impeller_backend]() {
4647+ auto impeller_context = platform_view->GetImpellerContext ();
46454648 // TODO(dnfield): Enable GL and Vulkan after
46464649 // https://github.com/flutter/flutter/issues/140419
4647- #ifdef SHELL_ENABLE_GL
4648- // EXPECT_EQ(backend, impeller::RuntimeStageBackend::kOpenGLES);
4649- #endif // SHELL_ENABLE_GL
4650- #ifdef SHELL_ENABLE_VULKAN
4651- // EXPECT_EQ(backend, impeller::RuntimeStageBackend::kVulkan);
4652- #endif // SHELL_ENABLE_VULKAN
4653- #ifdef SHELL_ENABLE_METAL
4654- EXPECT_EQ (backend, impeller::RuntimeStageBackend::kMetal );
4655- #endif // SHELL_ENABLE_METAL
4656- latch.Signal ();
4657- }));
4650+ #if SHELL_ENABLE_METAL
4651+ EXPECT_TRUE (impeller_context);
4652+ impeller_backend = impeller_context->GetBackendType ();
4653+ #endif
4654+ latch.Signal ();
4655+ });
4656+ latch.Wait ();
4657+
4658+ AddNativeCallback (
4659+ " NotifyNative" , CREATE_NATIVE_ENTRY ([&](auto args) {
4660+ auto backend = UIDartState::Current ()->GetRuntimeStageBackend ();
4661+ if (impeller_backend.has_value ()) {
4662+ switch (impeller_backend.value ()) {
4663+ case impeller::Context::BackendType::kMetal :
4664+ EXPECT_EQ (backend, impeller::RuntimeStageBackend::kMetal );
4665+ break ;
4666+ case impeller::Context::BackendType::kOpenGLES :
4667+ EXPECT_EQ (backend, impeller::RuntimeStageBackend::kOpenGLES );
4668+ break ;
4669+ case impeller::Context::BackendType::kVulkan :
4670+ EXPECT_EQ (backend, impeller::RuntimeStageBackend::kVulkan );
4671+ break ;
4672+ }
4673+ }
4674+ latch.Signal ();
4675+ }));
46584676
46594677 auto configuration = RunConfiguration::InferFromSettings (settings);
46604678 configuration.SetEntrypoint (" mainNotifyNative" );
0 commit comments