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

Unified Diff: net/dns/record_rdata_unittest.cc

Issue 17143006: Limited NSEC support to RecordParsed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mdns_transaction_cleanup
Patch Set: Created 7 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/record_rdata.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7dc73bbf5c2b326f9a044cf801ac1028d28b3093 100644
--- a/net/dns/record_rdata_unittest.cc
+++ b/net/dns/record_rdata_unittest.cc
@@ -180,4 +180,37 @@ 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);
+
+ ASSERT_EQ(16u, record_obj->bitmap_length());
+
+ EXPECT_FALSE(record_obj->GetBit(0));
+ EXPECT_TRUE(record_obj->GetBit(1));
+ for (int i = 2; i < 15; i++) {
+ EXPECT_FALSE(record_obj->GetBit(i));
+ }
+ EXPECT_TRUE(record_obj->GetBit(15));
+
+ ASSERT_TRUE(record_obj->IsEqual(record_obj.get()));
+}
+
+
} // namespace net
« no previous file with comments | « net/dns/record_rdata.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698