From 5f38c9e5daec4e44aede4e7ec0d5a73df0c0a4a0 Mon Sep 17 00:00:00 2001 From: Tong Mu Date: Fri, 5 Apr 2024 15:40:50 -0700 Subject: [PATCH] Fix --- shell/platform/embedder/tests/embedder_unittests.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index a0701574ab0cf..7c108d9973bbb 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -3446,6 +3446,7 @@ TEST_F(EmbedderTest, EmbedderThreadHostUseCustomThreadConfig) { flutter::EmbedderThreadHost::CreateEmbedderOrEngineManagedThreadHost( nullptr, MockThreadConfigSetter); + fml::AutoResetWaitableEvent ui_latch; int ui_policy; struct sched_param ui_param; @@ -3453,15 +3454,21 @@ TEST_F(EmbedderTest, EmbedderThreadHostUseCustomThreadConfig) { pthread_t current_thread = pthread_self(); pthread_getschedparam(current_thread, &ui_policy, &ui_param); ASSERT_EQ(ui_param.sched_priority, 10); + ui_latch.Signal(); }); + fml::AutoResetWaitableEvent io_latch; int io_policy; struct sched_param io_param; thread_host->GetTaskRunners().GetIOTaskRunner()->PostTask([&] { pthread_t current_thread = pthread_self(); pthread_getschedparam(current_thread, &io_policy, &io_param); ASSERT_EQ(io_param.sched_priority, 1); + io_latch.Signal(); }); + + ui_latch.Wait(); + io_latch.Wait(); } #endif