src/net/dns/record_rdata_unittest.cc
// Test parsing a well-formed ESNI record bearing an address_set extension
// containing several IPv4 and IPv6 addresses.
Test parsing a well-formed ESNI record bearing an address_set extension
containing several IPv4 and IPv6 addresses.
Test parsing a well - formed ESNI record bearing an address_set extension containing several IPv4 and IPv6 addresses .
TEST(RecordRdataTest, ParseEsniRecordManyAddresses) {
  char record[10000] = {};
  base::BigEndianWriter writer(record, sizeof(record));
  AppendWellFormedEsniKeys(&writer);
  std::vector<uint8_t> address_list;
  std::vector<IPAddress> addresses_for_validation;
  for (int i = 0; i < 100; ++i)
    AppendAnotherIPAddress(&address_list, &addresses_for_validation,
                           (i % 3) ? 4 : 6 );
  AppendDnsExtensionsBlock(&writer, address_list);
  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());
  const auto& addresses = record_obj->addresses();
  EXPECT_EQ(addresses, addresses_for_validation);
  EXPECT_TRUE(record_obj->IsEqual(record_obj.get()));
  ExpectMatchesSampleKeys(record_obj->esni_keys());
}
TEST ( RecordRdataTest , ParseEsniRecordManyAddresses ) { char record [ 10000 ] = { } ; base :: BigEndianWriter writer ( record , sizeof ( record ) ) ; AppendWellFormedEsniKeys ( & writer ) ; std :: vector < uint8_t > address_list ; std :: vector < IPAddress > addresses_for_validation ; for ( int i = 0 ; i < 100 ; ++ i ) AppendAnotherIPAddress ( & address_list , & addresses_for_validation , ( i % 3 ) ? 4 : 6 ) ; AppendDnsExtensionsBlock ( & writer , address_list ) ; 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 ( ) ) ; const auto & addresses = record_obj -> addresses ( ) ; EXPECT_EQ ( addresses , addresses_for_validation ) ; EXPECT_TRUE ( record_obj -> IsEqual ( record_obj . get ( ) ) ) ; ExpectMatchesSampleKeys ( record_obj -> esni_keys ( ) ) ; }
Test parsing a well-formed ESNI record bearing an address_set extension
containing several IPv4 and IPv6 addresses.
Test parsing a well - formed ESNI record bearing an address_set extension containing several IPv4 and IPv6 addresses .
// ESNI record: // well-formed ESNI keys // extensions length // extension /* ip_version */ /* offset */