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

Unified Diff: net/dns/dns_response_unittest.cc

Issue 9190031: DnsClient refactoring + features (timeout, suffix search, server rotation). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Delinted. Created 8 years, 11 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_response.cc ('k') | net/dns/dns_session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_response_unittest.cc
diff --git a/net/dns/dns_response_unittest.cc b/net/dns/dns_response_unittest.cc
index 51d7cffd47400b15f67bfa9d5858fa8b4488ba87..5438edc455673ff5fec1e60adaa10738fb6c08f3 100644
--- a/net/dns/dns_response_unittest.cc
+++ b/net/dns/dns_response_unittest.cc
@@ -205,29 +205,39 @@ TEST(DnsResponseTest, InitParse) {
// Reject too short.
EXPECT_FALSE(resp.InitParse(query->io_buffer()->size() - 1, *query));
+ EXPECT_FALSE(resp.IsValid());
// Reject wrong id.
scoped_ptr<DnsQuery> other_query(query->CloneWithNewId(0xbeef));
EXPECT_FALSE(resp.InitParse(sizeof(response_data), *other_query));
+ EXPECT_FALSE(resp.IsValid());
// Reject wrong question.
scoped_ptr<DnsQuery> wrong_query(
new DnsQuery(0xcafe, qname, dns_protocol::kTypeCNAME));
EXPECT_FALSE(resp.InitParse(sizeof(response_data), *wrong_query));
+ EXPECT_FALSE(resp.IsValid());
// Accept matching question.
EXPECT_TRUE(resp.InitParse(sizeof(response_data), *query));
+ EXPECT_TRUE(resp.IsValid());
// Check header access.
- EXPECT_EQ(0x81, resp.flags0());
- EXPECT_EQ(0x80, resp.flags1());
+ EXPECT_EQ(0x8180, resp.flags());
EXPECT_EQ(0x0, resp.rcode());
EXPECT_EQ(2, resp.answer_count());
+ // Check question access.
+ EXPECT_EQ(query->qname(), resp.qname());
+ EXPECT_EQ(query->qtype(), resp.qtype());
+ EXPECT_EQ("codereview.chromium.org", resp.GetDottedName());
+
DnsResourceRecord record;
DnsRecordParser parser = resp.Parser();
EXPECT_TRUE(parser.ParseRecord(&record));
+ EXPECT_FALSE(parser.AtEnd());
EXPECT_TRUE(parser.ParseRecord(&record));
+ EXPECT_TRUE(parser.AtEnd());
EXPECT_FALSE(parser.ParseRecord(&record));
}
« no previous file with comments | « net/dns/dns_response.cc ('k') | net/dns/dns_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698