#include <memory>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/simple_test_clock.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
#include "base/timer/mock_timer.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "net/base/address_family.h"
#include "net/base/completion_repeating_callback.h"
#include "net/base/ip_address.h"
#include "net/base/rand_callback.h"
#include "net/base/test_completion_callback.h"
#include "net/dns/mdns_client_impl.h"
#include "net/dns/mock_mdns_socket_factory.h"
#include "net/dns/record_rdata.h"
#include "net/log/net_log.h"
#include "net/socket/udp_client_socket.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
_;
Assign;
AtMost;
DoAll;
Exactly;
IgnoreResult;
Invoke;
InvokeWithoutArgs;
NiceMock;
Return;
SaveArg;
StrictMock;
namespace net {
namespace {
const uint8_t kSamplePacket1[] = …;
const uint8_t kSamplePacket1WithCapitalization[] = …;
const uint8_t kCorruptedPacketBadQuestion[] = …;
const uint8_t kCorruptedPacketUnsalvagable[] = …;
const uint8_t kCorruptedPacketDoubleRecord[] = …;
const uint8_t kCorruptedPacketSalvagable[] = …;
const uint8_t kSamplePacket2[] = …;
const uint8_t kSamplePacket3[] = …;
const uint8_t kQueryPacketPrivet[] = …;
const uint8_t kQueryPacketPrivetWithCapitalization[] = …;
const uint8_t kQueryPacketPrivetA[] = …;
const uint8_t kSamplePacketAdditionalOnly[] = …;
const uint8_t kSamplePacketNsec[] = …;
const uint8_t kSamplePacketAPrivet[] = …;
const uint8_t kSamplePacketGoodbye[] = …;
std::string MakeString(const uint8_t* data, unsigned size) { … }
class PtrRecordCopyContainer { … };
class MockClock : public base::Clock { … };
class MockTimer : public base::MockOneShotTimer { … };
}
class MDnsTest : public TestWithTaskEnvironment { … };
class MockListenerDelegate : public MDnsListener::Delegate { … };
void MDnsTest::SetUp() { … }
void MDnsTest::SimulatePacketReceive(const uint8_t* packet, unsigned size) { … }
void MDnsTest::ExpectPacket(const uint8_t* packet, unsigned size) { … }
void MDnsTest::DeleteTransaction() { … }
void MDnsTest::DeleteBothListeners() { … }
void MDnsTest::RunFor(base::TimeDelta time_period) { … }
void MDnsTest::Stop() { … }
TEST_F(MDnsTest, PassiveListeners) { … }
TEST_F(MDnsTest, PassiveListenersWithCapitalization) { … }
TEST_F(MDnsTest, PassiveListenersCacheCleanup) { … }
TEST_F(MDnsTest, CacheCleanupWithShortTTL) { … }
TEST_F(MDnsTest, StopListening) { … }
TEST_F(MDnsTest, StopListening_CacheCleanupScheduled) { … }
TEST_F(MDnsTest, MalformedPacket) { … }
TEST_F(MDnsTest, TransactionWithEmptyCache) { … }
TEST_F(MDnsTest, TransactionWithEmptyCacheAndCapitalization) { … }
TEST_F(MDnsTest, TransactionCacheOnlyNoResult) { … }
TEST_F(MDnsTest, TransactionWithCache) { … }
TEST_F(MDnsTest, AdditionalRecords) { … }
TEST_F(MDnsTest, TransactionTimeout) { … }
TEST_F(MDnsTest, TransactionMultipleRecords) { … }
TEST_F(MDnsTest, TransactionReentrantDelete) { … }
TEST_F(MDnsTest, TransactionReentrantDeleteFromCache) { … }
TEST_F(MDnsTest, TransactionReentrantCacheLookupStart) { … }
TEST_F(MDnsTest, GoodbyePacketNotification) { … }
TEST_F(MDnsTest, GoodbyePacketRemoval) { … }
TEST_F(MDnsTest, ListenerReentrantDelete) { … }
ACTION_P(SaveIPAddress, ip_container) { … }
TEST_F(MDnsTest, DoubleRecordDisagreeing) { … }
TEST_F(MDnsTest, NsecWithListener) { … }
TEST_F(MDnsTest, NsecWithTransactionFromNetwork) { … }
TEST_F(MDnsTest, NsecWithTransactionFromCache) { … }
TEST_F(MDnsTest, NsecConflictRemoval) { … }
#if BUILDFLAG(IS_FUCHSIA)
#define MAYBE_RefreshQuery …
#else
#define MAYBE_RefreshQuery …
#endif
TEST_F(MDnsTest, MAYBE_RefreshQuery) { … }
class FailingSocketFactory : public MDnsSocketFactory { … };
TEST_F(MDnsTest, StartListeningFailure) { … }
TEST_F(MDnsTest, ClearOverfilledCache) { … }
class SimpleMockSocketFactory : public MDnsSocketFactory { … };
class MockMDnsConnectionDelegate : public MDnsConnection::Delegate { … };
class MDnsConnectionTest : public TestWithTaskEnvironment { … };
TEST_F(MDnsConnectionTest, ReceiveSynchronous) { … }
TEST_F(MDnsConnectionTest, ReceiveAsynchronous) { … }
TEST_F(MDnsConnectionTest, Error) { … }
class MDnsConnectionSendTest : public MDnsConnectionTest { … };
TEST_F(MDnsConnectionSendTest, Send) { … }
TEST_F(MDnsConnectionSendTest, SendError) { … }
TEST_F(MDnsConnectionSendTest, SendQueued) { … }
TEST(MDnsSocketTest, CreateSocket) { … }
}