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

Side by Side Diff: net/dns/dns_test_util.cc

Issue 1932363003: Remove net::IPAddressNumber. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « net/dns/address_sorter_posix.h ('k') | net/dns/record_rdata.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/dns/dns_test_util.h" 5 #include "net/dns/dns_test_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/big_endian.h" 9 #include "base/big_endian.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 reinterpret_cast<dns_protocol::Header*>(buffer); 101 reinterpret_cast<dns_protocol::Header*>(buffer);
102 header->flags |= dns_protocol::kFlagResponse; 102 header->flags |= dns_protocol::kFlagResponse;
103 103
104 if (MockDnsClientRule::OK == result_) { 104 if (MockDnsClientRule::OK == result_) {
105 const uint16_t kPointerToQueryName = 105 const uint16_t kPointerToQueryName =
106 static_cast<uint16_t>(0xc000 | sizeof(*header)); 106 static_cast<uint16_t>(0xc000 | sizeof(*header));
107 107
108 const uint32_t kTTL = 86400; // One day. 108 const uint32_t kTTL = 86400; // One day.
109 109
110 // Size of RDATA which is a IPv4 or IPv6 address. 110 // Size of RDATA which is a IPv4 or IPv6 address.
111 size_t rdata_size = qtype_ == dns_protocol::kTypeA ? kIPv4AddressSize 111 size_t rdata_size = qtype_ == dns_protocol::kTypeA
112 : kIPv6AddressSize; 112 ? IPAddress::kIPv4AddressSize
113 : IPAddress::kIPv6AddressSize;
113 114
114 // 12 is the sum of sizes of the compressed name reference, TYPE, 115 // 12 is the sum of sizes of the compressed name reference, TYPE,
115 // CLASS, TTL and RDLENGTH. 116 // CLASS, TTL and RDLENGTH.
116 size_t answer_size = 12 + rdata_size; 117 size_t answer_size = 12 + rdata_size;
117 118
118 // Write answer with loopback IP address. 119 // Write answer with loopback IP address.
119 header->ancount = base::HostToNet16(1); 120 header->ancount = base::HostToNet16(1);
120 base::BigEndianWriter writer(buffer + nbytes, answer_size); 121 base::BigEndianWriter writer(buffer + nbytes, answer_size);
121 writer.WriteU16(kPointerToQueryName); 122 writer.WriteU16(kPointerToQueryName);
122 writer.WriteU16(qtype_); 123 writer.WriteU16(qtype_);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 219
219 AddressSorter* MockDnsClient::GetAddressSorter() { 220 AddressSorter* MockDnsClient::GetAddressSorter() {
220 return address_sorter_.get(); 221 return address_sorter_.get();
221 } 222 }
222 223
223 void MockDnsClient::CompleteDelayedTransactions() { 224 void MockDnsClient::CompleteDelayedTransactions() {
224 factory_->CompleteDelayedTransactions(); 225 factory_->CompleteDelayedTransactions();
225 } 226 }
226 227
227 } // namespace net 228 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/address_sorter_posix.h ('k') | net/dns/record_rdata.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698