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

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
« net/dns/record_rdata.cc ('K') | « 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..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
« net/dns/record_rdata.cc ('K') | « net/dns/record_rdata.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698