src/net/dns/record_rdata_unittest.cc
// Test parsing a well-formed ESNI record with no DNS extensions.
Test parsing a well-formed ESNI record with no DNS extensions.
Test parsing a well - formed ESNI record with no DNS extensions .
TEST(RecordRdataTest, ParseEsniRecordNoExtensions) {
  char record[10000] = {};
  base::BigEndianWriter writer(record, sizeof(record));
  AppendWellFormedEsniKeys(&writer);
  writer.WriteU16(0);  
  auto record_size = writer.ptr() - record;
  DnsRecordParser parser(record, record_size, 0 );
  std::unique_ptr<EsniRecordRdata> record_obj =
      EsniRecordRdata::Create(std::string(record, record_size), parser);
  ASSERT_THAT(record_obj, NotNull());
  EXPECT_TRUE(record_obj->IsEqual(record_obj.get()));
  EXPECT_EQ(record_obj->esni_keys(),
            std::string(kWellFormedEsniKeys, kWellFormedEsniKeysSize));
  EXPECT_EQ(record_obj->Type(), dns_protocol::kExperimentalTypeEsniDraft4);
}
TEST ( RecordRdataTest , ParseEsniRecordNoExtensions ) { char record [ 10000 ] = { } ; base :: BigEndianWriter writer ( record , sizeof ( record ) ) ; AppendWellFormedEsniKeys ( & writer ) ; writer . WriteU16 ( 0 ) ; auto record_size = writer . ptr ( ) - record ; DnsRecordParser parser ( record , record_size , 0 ) ; std :: unique_ptr < EsniRecordRdata > record_obj = EsniRecordRdata :: Create ( std :: string ( record , record_size ) , parser ) ; ASSERT_THAT ( record_obj , NotNull ( ) ) ; EXPECT_TRUE ( record_obj -> IsEqual ( record_obj . get ( ) ) ) ; EXPECT_EQ ( record_obj -> esni_keys ( ) , std :: string ( kWellFormedEsniKeys , kWellFormedEsniKeysSize ) ) ; EXPECT_EQ ( record_obj -> Type ( ) , dns_protocol :: kExperimentalTypeEsniDraft4 ) ; }
Test parsing a well-formed ESNI record with no DNS extensions.
Test parsing a well - formed ESNI record with no DNS extensions .
// dns_extensions length /* offset */