Get quic_all_event_loops_test to work on macOS Fixes a bug where tests don't run if the platform only supports level-triggered backends. PiperOrigin-RevId: 578686875
diff --git a/quiche/quic/core/io/quic_default_event_loop.cc b/quiche/quic/core/io/quic_default_event_loop.cc index 8c1877c..6a7e8f1 100644 --- a/quiche/quic/core/io/quic_default_event_loop.cc +++ b/quiche/quic/core/io/quic_default_event_loop.cc
@@ -4,8 +4,11 @@ #include "quiche/quic/core/io/quic_default_event_loop.h" +#include <algorithm> #include <memory> +#include <vector> +#include "absl/algorithm/container.h" #include "quiche/quic/core/io/quic_poll_event_loop.h" #include "quiche/common/platform/api/quiche_event_loop.h" @@ -28,12 +31,16 @@ } std::vector<QuicEventLoopFactory*> GetAllSupportedEventLoops() { - std::vector<QuicEventLoopFactory*> loops = { + std::vector<QuicEventLoopFactory*> loops = {QuicPollEventLoopFactory::Get()}; #ifdef QUICHE_ENABLE_LIBEVENT - QuicLibeventEventLoopFactory::Get(), - QuicLibeventEventLoopFactory::GetLevelTriggeredBackendForTests(), + loops.push_back(QuicLibeventEventLoopFactory::Get()); + if (QuicLibeventEventLoopFactory::Get()->GetName() != + QuicLibeventEventLoopFactory::GetLevelTriggeredBackendForTests() + ->GetName()) { + loops.push_back( + QuicLibeventEventLoopFactory::GetLevelTriggeredBackendForTests()); + } #endif - QuicPollEventLoopFactory::Get()}; std::vector<QuicEventLoopFactory*> extra = quiche::GetExtraEventLoopImplementations(); loops.insert(loops.end(), extra.begin(), extra.end());