Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Unified Diff: net/dns/dns_config_service_posix_unittest.cc

Issue 10543168: [net/dns] Instrument DnsConfigService to measure performance and failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/dns/dns_config_service_posix.cc ('k') | net/dns/dns_config_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_config_service_posix_unittest.cc
diff --git a/net/dns/dns_config_service_posix_unittest.cc b/net/dns/dns_config_service_posix_unittest.cc
index e1e23380f68cc72494679e22cc593911bfc96650..1c7dd3638d2679cb01babb46cc3dc20dccbe0485 100644
--- a/net/dns/dns_config_service_posix_unittest.cc
+++ b/net/dns/dns_config_service_posix_unittest.cc
@@ -30,7 +30,8 @@ const char* kNameserversIPv6[] = {
// Fills in |res| with sane configuration.
void InitializeResState(res_state res) {
memset(res, 0, sizeof(*res));
- res->options = RES_INIT | RES_ROTATE;
+ res->options = RES_INIT | RES_RECURSE | RES_DEFNAMES | RES_DNSRCH |
+ RES_ROTATE;
res->ndots = 2;
res->retrans = 4;
res->retry = 7;
@@ -112,7 +113,8 @@ TEST(DnsConfigServicePosixTest, ConvertResStateToDnsConfig) {
DnsConfig config;
EXPECT_FALSE(config.IsValid());
InitializeResState(&res);
- ASSERT_TRUE(internal::ConvertResStateToDnsConfig(res, &config));
+ ASSERT_EQ(internal::CONFIG_PARSE_POSIX_OK,
+ internal::ConvertResStateToDnsConfig(res, &config));
CloseResState(&res);
EXPECT_TRUE(config.IsValid());
@@ -124,7 +126,7 @@ TEST(DnsConfigServicePosixTest, ConvertResStateToDnsConfig) {
TEST(DnsConfigServicePosixTest, RejectEmptyNameserver) {
struct __res_state res = {};
- res.options = RES_INIT;
+ res.options = RES_INIT | RES_RECURSE | RES_DEFNAMES | RES_DNSRCH;
const char kDnsrch[] = "chromium.org";
memcpy(res.defdname, kDnsrch, sizeof(kDnsrch));
res.dnsrch[0] = res.defdname;
@@ -139,11 +141,13 @@ TEST(DnsConfigServicePosixTest, RejectEmptyNameserver) {
res.nscount = 2;
DnsConfig config;
- EXPECT_FALSE(internal::ConvertResStateToDnsConfig(res, &config));
+ EXPECT_EQ(internal::CONFIG_PARSE_POSIX_NULL_ADDRESS,
+ internal::ConvertResStateToDnsConfig(res, &config));
sa.sin_addr.s_addr = 0xDEADBEEF;
res.nsaddr_list[0] = sa;
- EXPECT_TRUE(internal::ConvertResStateToDnsConfig(res, &config));
+ EXPECT_EQ(internal::CONFIG_PARSE_POSIX_OK,
+ internal::ConvertResStateToDnsConfig(res, &config));
}
} // namespace
« no previous file with comments | « net/dns/dns_config_service_posix.cc ('k') | net/dns/dns_config_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698