Loading DnsQueryLogTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <gtest/gtest.h> #include "DnsQueryLog.h" #include "tests/resolv_test_base.h" using namespace std::chrono_literals; Loading Loading @@ -58,7 +59,7 @@ void verifyDumpOutput(const std::string& dumpLog, const std::vector<int>& expect } // namespace class DnsQueryLogTest : public ::testing::Test { class DnsQueryLogTest : public ResolvTestBase { protected: const std::vector<std::string> serversV4 = {"127.0.0.1", "1.2.3.4"}; const std::vector<std::string> serversV4V6 = {"127.0.0.1", "1.2.3.4", "2001:db8::1", Loading DnsStatsTest.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <gtest/gtest.h> #include "DnsStats.h" #include "tests/resolv_test_base.h" namespace android::net { Loading Loading @@ -66,7 +67,7 @@ StatsData makeStatsData(const IPSockAddr& server, const int total, const microse // TODO: add StatsDataTest to ensure its methods return correct outputs. class StatsRecordsTest : public ::testing::Test {}; class StatsRecordsTest : public ResolvTestBase {}; TEST_F(StatsRecordsTest, PushRecord) { const IPSockAddr server = IPSockAddr::toIPSockAddr("127.0.0.2", 53); Loading Loading @@ -104,7 +105,7 @@ TEST_F(StatsRecordsTest, PushRecord) { makeStatsData(server, 3, 750ms, {{NS_R_NO_ERROR, 0}, {NS_R_TIMEOUT, 3}})); } class DnsStatsTest : public ::testing::Test { class DnsStatsTest : public ResolvTestBase { protected: std::string captureDumpOutput() { netdutils::DumpWriter dw(STDOUT_FILENO); Loading ExperimentsTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -25,10 +25,11 @@ #include <gtest/gtest.h> #include "Experiments.h" #include "tests/resolv_test_base.h" namespace android::net { class ExperimentsTest : public ::testing::Test { class ExperimentsTest : public ResolvTestBase { public: ExperimentsTest() : mExperiments(fakeGetExperimentFlagInt) {} Loading PrivateDnsConfigurationTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -20,13 +20,14 @@ #include "PrivateDnsConfiguration.h" #include "tests/dns_responder/dns_responder.h" #include "tests/dns_responder/dns_tls_frontend.h" #include "tests/resolv_test_base.h" #include "tests/resolv_test_utils.h" namespace android::net { using namespace std::chrono_literals; class PrivateDnsConfigurationTest : public ::testing::Test { class PrivateDnsConfigurationTest : public ResolvTestBase { public: using ServerIdentity = PrivateDnsConfiguration::ServerIdentity; Loading res_send.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -483,11 +483,8 @@ int res_nsend(ResState* statp, span<const uint8_t> msg, span<uint8_t> ans, int* mDnsQueryEvent->set_linux_errno(static_cast<LinuxErrno>(terrno)); resolv_stats_add(statp->netid, receivedMdnsAddr, mDnsQueryEvent); if (resplen <= 0) { _resolv_cache_query_failed(statp->netid, msg, flags); return -terrno; } LOG(DEBUG) << __func__ << ": got answer:"; if (resplen > 0) { LOG(DEBUG) << __func__ << ": got answer from mDNS:"; res_pquery(ans.first(resplen)); if (cache_status == RESOLV_CACHE_NOTFOUND) { Loading @@ -495,6 +492,7 @@ int res_nsend(ResState* statp, span<const uint8_t> msg, span<uint8_t> ans, int* } return resplen; } } if (statp->nameserverCount() == 0) { // We have no nameservers configured and it's not a MDNS resolution, so there's no Loading Loading
DnsQueryLogTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <gtest/gtest.h> #include "DnsQueryLog.h" #include "tests/resolv_test_base.h" using namespace std::chrono_literals; Loading Loading @@ -58,7 +59,7 @@ void verifyDumpOutput(const std::string& dumpLog, const std::vector<int>& expect } // namespace class DnsQueryLogTest : public ::testing::Test { class DnsQueryLogTest : public ResolvTestBase { protected: const std::vector<std::string> serversV4 = {"127.0.0.1", "1.2.3.4"}; const std::vector<std::string> serversV4V6 = {"127.0.0.1", "1.2.3.4", "2001:db8::1", Loading
DnsStatsTest.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <gtest/gtest.h> #include "DnsStats.h" #include "tests/resolv_test_base.h" namespace android::net { Loading Loading @@ -66,7 +67,7 @@ StatsData makeStatsData(const IPSockAddr& server, const int total, const microse // TODO: add StatsDataTest to ensure its methods return correct outputs. class StatsRecordsTest : public ::testing::Test {}; class StatsRecordsTest : public ResolvTestBase {}; TEST_F(StatsRecordsTest, PushRecord) { const IPSockAddr server = IPSockAddr::toIPSockAddr("127.0.0.2", 53); Loading Loading @@ -104,7 +105,7 @@ TEST_F(StatsRecordsTest, PushRecord) { makeStatsData(server, 3, 750ms, {{NS_R_NO_ERROR, 0}, {NS_R_TIMEOUT, 3}})); } class DnsStatsTest : public ::testing::Test { class DnsStatsTest : public ResolvTestBase { protected: std::string captureDumpOutput() { netdutils::DumpWriter dw(STDOUT_FILENO); Loading
ExperimentsTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -25,10 +25,11 @@ #include <gtest/gtest.h> #include "Experiments.h" #include "tests/resolv_test_base.h" namespace android::net { class ExperimentsTest : public ::testing::Test { class ExperimentsTest : public ResolvTestBase { public: ExperimentsTest() : mExperiments(fakeGetExperimentFlagInt) {} Loading
PrivateDnsConfigurationTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -20,13 +20,14 @@ #include "PrivateDnsConfiguration.h" #include "tests/dns_responder/dns_responder.h" #include "tests/dns_responder/dns_tls_frontend.h" #include "tests/resolv_test_base.h" #include "tests/resolv_test_utils.h" namespace android::net { using namespace std::chrono_literals; class PrivateDnsConfigurationTest : public ::testing::Test { class PrivateDnsConfigurationTest : public ResolvTestBase { public: using ServerIdentity = PrivateDnsConfiguration::ServerIdentity; Loading
res_send.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -483,11 +483,8 @@ int res_nsend(ResState* statp, span<const uint8_t> msg, span<uint8_t> ans, int* mDnsQueryEvent->set_linux_errno(static_cast<LinuxErrno>(terrno)); resolv_stats_add(statp->netid, receivedMdnsAddr, mDnsQueryEvent); if (resplen <= 0) { _resolv_cache_query_failed(statp->netid, msg, flags); return -terrno; } LOG(DEBUG) << __func__ << ": got answer:"; if (resplen > 0) { LOG(DEBUG) << __func__ << ": got answer from mDNS:"; res_pquery(ans.first(resplen)); if (cache_status == RESOLV_CACHE_NOTFOUND) { Loading @@ -495,6 +492,7 @@ int res_nsend(ResState* statp, span<const uint8_t> msg, span<uint8_t> ans, int* } return resplen; } } if (statp->nameserverCount() == 0) { // We have no nameservers configured and it's not a MDNS resolution, so there's no Loading