| 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..40be30f9d6811e65b9017e410a6098a9520b5848 100644
|
| --- a/net/dns/dns_response_unittest.cc
|
| +++ b/net/dns/dns_response_unittest.cc
|
| @@ -16,9 +16,9 @@ namespace {
|
| TEST(DnsRecordParserTest, Constructor) {
|
| const char data[] = { 0 };
|
|
|
| - EXPECT_FALSE(DnsRecordParser().IsValid());
|
| - EXPECT_TRUE(DnsRecordParser(data, 1, 0).IsValid());
|
| - EXPECT_TRUE(DnsRecordParser(data, 1, 1).IsValid());
|
| + EXPECT_FALSE(DnsRecordParser().is_valid());
|
| + EXPECT_TRUE(DnsRecordParser(data, 1, 0).is_valid());
|
| + EXPECT_TRUE(DnsRecordParser(data, 1, 1).is_valid());
|
|
|
| EXPECT_FALSE(DnsRecordParser(data, 1, 0).AtEnd());
|
| EXPECT_TRUE(DnsRecordParser(data, 1, 1).AtEnd());
|
| @@ -44,7 +44,7 @@ TEST(DnsRecordParserTest, ParseName) {
|
|
|
| std::string out;
|
| DnsRecordParser parser(data, sizeof(data), 0);
|
| - ASSERT_TRUE(parser.IsValid());
|
| + ASSERT_TRUE(parser.is_valid());
|
|
|
| EXPECT_EQ(0x11, parser.ParseName(data + 0x00, &out));
|
| EXPECT_EQ("foo.example.com", out);
|
| @@ -87,7 +87,7 @@ TEST(DnsRecordParserTest, ParseNameFail) {
|
| };
|
|
|
| DnsRecordParser parser(data, sizeof(data), 0);
|
| - ASSERT_TRUE(parser.IsValid());
|
| + ASSERT_TRUE(parser.is_valid());
|
|
|
| std::string out;
|
| EXPECT_EQ(0, parser.ParseName(data + 0x00, &out));
|
| @@ -205,25 +205,33 @@ TEST(DnsResponseTest, InitParse) {
|
|
|
| // Reject too short.
|
| EXPECT_FALSE(resp.InitParse(query->io_buffer()->size() - 1, *query));
|
| + EXPECT_FALSE(resp.is_valid());
|
|
|
| // Reject wrong id.
|
| scoped_ptr<DnsQuery> other_query(query->CloneWithNewId(0xbeef));
|
| EXPECT_FALSE(resp.InitParse(sizeof(response_data), *other_query));
|
| + EXPECT_FALSE(resp.is_valid());
|
|
|
| // 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.is_valid());
|
|
|
| // Accept matching question.
|
| EXPECT_TRUE(resp.InitParse(sizeof(response_data), *query));
|
| + EXPECT_TRUE(resp.is_valid());
|
|
|
| // 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));
|
|
|