Add test to ensure that concurrent message loops have at least one workers. (flutter/engine#16074)

The current count is determined from std::thread::hardware_concurrency which can
return zero. Even in such cases, the implementation may not return a loop with
no workers. There are numerous components that depend on having non-zero workers
in the queue.
This commit is contained in:
Chinmay Garde
2020-01-28 11:29:42 -08:00
committed by GitHub
parent b392f1e3bd
commit f5ae64f523

View File

@@ -284,6 +284,12 @@ TEST(MessageLoop, TaskObserverFire) {
ASSERT_TRUE(terminated);
}
TEST(MessageLoop, ConcurrentMessageLoopHasNonZeroWorkers) {
auto loop = fml::ConcurrentMessageLoop::Create(
0u /* explicitly specify zero workers */);
ASSERT_GT(loop->GetWorkerCount(), 0u);
}
TEST(MessageLoop, CanCreateAndShutdownConcurrentMessageLoopsOverAndOver) {
for (size_t i = 0; i < 10; ++i) {
auto loop = fml::ConcurrentMessageLoop::Create(i + 1);