Index: net/dns/record_rdata_unittest.cc |
diff --git a/net/dns/record_rdata_unittest.cc b/net/dns/record_rdata_unittest.cc |
index 1c731d50b07d38201232168a709279c8ef6c94d9..62a61cc94d3e96da8af34b5d7588b6b5fd7c5a9d 100644 |
--- a/net/dns/record_rdata_unittest.cc |
+++ b/net/dns/record_rdata_unittest.cc |
@@ -180,4 +180,39 @@ TEST(RecordRdataTest, ParseTxtRecord) { |
ASSERT_TRUE(record_obj->IsEqual(record_obj.get())); |
} |
+TEST(RecordRdataTest, ParseNsecRecord) { |
+ scoped_ptr<NsecRecordRdata> record_obj; |
+ |
+ // These are just the rdata portions of the DNS records, rather than complete |
+ // records, but it works well enough for this test. |
+ |
+ const char record[] = { |
+ 0x03, 'w', 'w', 'w', |
+ 0x06, 'g', 'o', 'o', 'g', 'l', 'e', |
+ 0x03, 'c', 'o', 'm', |
+ 0x00, |
+ 0x00, 0x02, 0x40, 0x01 |
+ }; |
+ |
+ DnsRecordParser parser(record, sizeof(record), 0); |
+ base::StringPiece record_strpiece(record, sizeof(record)); |
+ |
+ record_obj = NsecRecordRdata::Create(record_strpiece, parser); |
+ ASSERT_TRUE(record_obj != NULL); |
+ |
+ std::vector<uint8> expected; |
+ expected.push_back(0x40); |
+ expected.push_back(0x01); |
+ |
+ ASSERT_EQ(expected, record_obj->bitmap()); |
+ |
+ EXPECT_TRUE(record_obj->bit(1)); |
+ EXPECT_TRUE(record_obj->bit(15)); |
+ EXPECT_FALSE(record_obj->bit(12)); |
+ EXPECT_FALSE(record_obj->bit(16)); |
+ |
+ ASSERT_TRUE(record_obj->IsEqual(record_obj.get())); |
+} |
+ |
+ |
} // namespace net |