diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/libwebrtc/p2p/base/basic_async_resolver_factory_unittest.cc | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/p2p/base/basic_async_resolver_factory_unittest.cc')
-rw-r--r-- | third_party/libwebrtc/p2p/base/basic_async_resolver_factory_unittest.cc | 93 |
1 files changed, 1 insertions, 92 deletions
diff --git a/third_party/libwebrtc/p2p/base/basic_async_resolver_factory_unittest.cc b/third_party/libwebrtc/p2p/base/basic_async_resolver_factory_unittest.cc index 313907abb9..39b7c2d1d0 100644 --- a/third_party/libwebrtc/p2p/base/basic_async_resolver_factory_unittest.cc +++ b/third_party/libwebrtc/p2p/base/basic_async_resolver_factory_unittest.cc @@ -11,8 +11,6 @@ #include "p2p/base/basic_async_resolver_factory.h" #include "api/test/mock_async_dns_resolver.h" -#include "p2p/base/mock_async_resolver.h" -#include "rtc_base/async_resolver.h" #include "rtc_base/gunit.h" #include "rtc_base/socket_address.h" #include "rtc_base/third_party/sigslot/sigslot.h" @@ -22,95 +20,6 @@ namespace webrtc { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -class BasicAsyncResolverFactoryTest : public ::testing::Test, - public sigslot::has_slots<> { - public: - void TestCreate() { - BasicAsyncResolverFactory factory; - rtc::AsyncResolverInterface* resolver = factory.Create(); - ASSERT_TRUE(resolver); - resolver->SignalDone.connect( - this, &BasicAsyncResolverFactoryTest::SetAddressResolved); - - rtc::SocketAddress address("", 0); - resolver->Start(address); - ASSERT_TRUE_WAIT(address_resolved_, 10000 /*ms*/); - resolver->Destroy(false); - } - - void SetAddressResolved(rtc::AsyncResolverInterface* resolver) { - address_resolved_ = true; - } - - private: - bool address_resolved_ = false; -}; - -// This test is primarily intended to let tools check that the created resolver -// doesn't leak. -TEST_F(BasicAsyncResolverFactoryTest, TestCreate) { - rtc::AutoThread main_thread; - TestCreate(); -} - -TEST(WrappingAsyncDnsResolverFactoryTest, TestCreateAndResolve) { - rtc::AutoThread main_thread; - WrappingAsyncDnsResolverFactory factory( - std::make_unique<BasicAsyncResolverFactory>()); - - std::unique_ptr<AsyncDnsResolverInterface> resolver(factory.Create()); - ASSERT_TRUE(resolver); - - bool address_resolved = false; - rtc::SocketAddress address("", 0); - resolver->Start(address, [&address_resolved]() { address_resolved = true; }); - ASSERT_TRUE_WAIT(address_resolved, 10000 /*ms*/); - resolver.reset(); -} - -TEST(WrappingAsyncDnsResolverFactoryTest, WrapOtherResolver) { - rtc::AutoThread main_thread; - BasicAsyncResolverFactory non_owned_factory; - WrappingAsyncDnsResolverFactory factory(&non_owned_factory); - std::unique_ptr<AsyncDnsResolverInterface> resolver(factory.Create()); - ASSERT_TRUE(resolver); - - bool address_resolved = false; - rtc::SocketAddress address("", 0); - resolver->Start(address, [&address_resolved]() { address_resolved = true; }); - ASSERT_TRUE_WAIT(address_resolved, 10000 /*ms*/); - resolver.reset(); -} - -#if GTEST_HAS_DEATH_TEST && defined(WEBRTC_LINUX) -// Tests that the prohibition against deleting the resolver from the callback -// is enforced. This is required by the use of sigslot in the wrapped resolver. -// Checking the error message fails on a number of platforms, so run this -// test only on the platforms where it works. -void CallResolver(WrappingAsyncDnsResolverFactory& factory) { - rtc::SocketAddress address("", 0); - std::unique_ptr<AsyncDnsResolverInterface> resolver(factory.Create()); - resolver->Start(address, [&resolver]() { resolver.reset(); }); - WAIT(!resolver.get(), 10000 /*ms*/); -} - -TEST(WrappingAsyncDnsResolverFactoryDeathTest, DestroyResolverInCallback) { - rtc::AutoThread main_thread; - // TODO(bugs.webrtc.org/12652): Rewrite as death test in loop style when it - // works. - WrappingAsyncDnsResolverFactory factory( - std::make_unique<BasicAsyncResolverFactory>()); - - // Since EXPECT_DEATH is thread sensitive, and the resolver creates a thread, - // we wrap the whole creation section in EXPECT_DEATH. - RTC_EXPECT_DEATH(CallResolver(factory), - "Check failed: !within_resolve_result_"); -} -#endif - -#pragma clang diagnostic pop +// all tests were on deleted APIs } // namespace webrtc |