| Index: net/dns/dns_transaction_unittest.cc
 | 
| diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc
 | 
| index f86aae1060b8aa821c478127c0b6038839bdc82b..e87564551c50e2e5d252e0d866ddb297011c18a7 100644
 | 
| --- a/net/dns/dns_transaction_unittest.cc
 | 
| +++ b/net/dns/dns_transaction_unittest.cc
 | 
| @@ -4,6 +4,10 @@
 | 
|  
 | 
|  #include "net/dns/dns_transaction.h"
 | 
|  
 | 
| +#include <stdint.h>
 | 
| +
 | 
| +#include <limits>
 | 
| +
 | 
|  #include "base/bind.h"
 | 
|  #include "base/memory/scoped_ptr.h"
 | 
|  #include "base/rand_util.h"
 | 
| @@ -33,19 +37,19 @@ std::string DomainFromDot(const base::StringPiece& dotted) {
 | 
|  class DnsSocketData {
 | 
|   public:
 | 
|    // The ctor takes parameters for the DnsQuery.
 | 
| -  DnsSocketData(uint16 id,
 | 
| +  DnsSocketData(uint16_t id,
 | 
|                  const char* dotted_name,
 | 
| -                uint16 qtype,
 | 
| +                uint16_t qtype,
 | 
|                  IoMode mode,
 | 
|                  bool use_tcp)
 | 
|        : query_(new DnsQuery(id, DomainFromDot(dotted_name), qtype)),
 | 
|          use_tcp_(use_tcp) {
 | 
|      if (use_tcp_) {
 | 
| -      scoped_ptr<uint16> length(new uint16);
 | 
| +      scoped_ptr<uint16_t> length(new uint16_t);
 | 
|        *length = base::HostToNet16(query_->io_buffer()->size());
 | 
|        writes_.push_back(MockWrite(mode,
 | 
|                                    reinterpret_cast<const char*>(length.get()),
 | 
| -                                  sizeof(uint16), num_reads_and_writes()));
 | 
| +                                  sizeof(uint16_t), num_reads_and_writes()));
 | 
|        lengths_.push_back(length.Pass());
 | 
|      }
 | 
|      writes_.push_back(MockWrite(mode, query_->io_buffer()->data(),
 | 
| @@ -57,15 +61,16 @@ class DnsSocketData {
 | 
|    // All responses must be added before GetProvider.
 | 
|  
 | 
|    // Adds pre-built DnsResponse. |tcp_length| will be used in TCP mode only.
 | 
| -  void AddResponseWithLength(scoped_ptr<DnsResponse> response, IoMode mode,
 | 
| -                             uint16 tcp_length) {
 | 
| +  void AddResponseWithLength(scoped_ptr<DnsResponse> response,
 | 
| +                             IoMode mode,
 | 
| +                             uint16_t tcp_length) {
 | 
|      CHECK(!provider_.get());
 | 
|      if (use_tcp_) {
 | 
| -      scoped_ptr<uint16> length(new uint16);
 | 
| +      scoped_ptr<uint16_t> length(new uint16_t);
 | 
|        *length = base::HostToNet16(tcp_length);
 | 
|        reads_.push_back(MockRead(mode,
 | 
|                                  reinterpret_cast<const char*>(length.get()),
 | 
| -                                sizeof(uint16), num_reads_and_writes()));
 | 
| +                                sizeof(uint16_t), num_reads_and_writes()));
 | 
|        lengths_.push_back(length.Pass());
 | 
|      }
 | 
|      reads_.push_back(MockRead(mode, response->io_buffer()->data(),
 | 
| @@ -76,12 +81,12 @@ class DnsSocketData {
 | 
|  
 | 
|    // Adds pre-built DnsResponse.
 | 
|    void AddResponse(scoped_ptr<DnsResponse> response, IoMode mode) {
 | 
| -    uint16 tcp_length = response->io_buffer()->size();
 | 
| +    uint16_t tcp_length = response->io_buffer()->size();
 | 
|      AddResponseWithLength(response.Pass(), mode, tcp_length);
 | 
|    }
 | 
|  
 | 
|    // Adds pre-built response from |data| buffer.
 | 
| -  void AddResponseData(const uint8* data, size_t length, IoMode mode) {
 | 
| +  void AddResponseData(const uint8_t* data, size_t length, IoMode mode) {
 | 
|      CHECK(!provider_.get());
 | 
|      AddResponse(make_scoped_ptr(
 | 
|          new DnsResponse(reinterpret_cast<const char*>(data), length, 0)), mode);
 | 
| @@ -121,16 +126,14 @@ class DnsSocketData {
 | 
|      return provider_.get();
 | 
|    }
 | 
|  
 | 
| -  uint16 query_id() const {
 | 
| -    return query_->id();
 | 
| -  }
 | 
| +  uint16_t query_id() const { return query_->id(); }
 | 
|  
 | 
|   private:
 | 
|    size_t num_reads_and_writes() const { return reads_.size() + writes_.size(); }
 | 
|  
 | 
|    scoped_ptr<DnsQuery> query_;
 | 
|    bool use_tcp_;
 | 
| -  std::vector<scoped_ptr<uint16>> lengths_;
 | 
| +  std::vector<scoped_ptr<uint16_t>> lengths_;
 | 
|    std::vector<scoped_ptr<DnsResponse>> responses_;
 | 
|    std::vector<MockWrite> writes_;
 | 
|    std::vector<MockRead> reads_;
 | 
| @@ -220,15 +223,14 @@ class TransactionHelper {
 | 
|   public:
 | 
|    // If |expected_answer_count| < 0 then it is the expected net error.
 | 
|    TransactionHelper(const char* hostname,
 | 
| -                    uint16 qtype,
 | 
| +                    uint16_t qtype,
 | 
|                      int expected_answer_count)
 | 
|        : hostname_(hostname),
 | 
|          qtype_(qtype),
 | 
|          expected_answer_count_(expected_answer_count),
 | 
|          cancel_in_callback_(false),
 | 
|          quit_in_callback_(false),
 | 
| -        completed_(false) {
 | 
| -  }
 | 
| +        completed_(false) {}
 | 
|  
 | 
|    // Mark that the transaction shall be destroyed immediately upon callback.
 | 
|    void set_cancel_in_callback() {
 | 
| @@ -314,7 +316,7 @@ class TransactionHelper {
 | 
|  
 | 
|   private:
 | 
|    std::string hostname_;
 | 
| -  uint16 qtype_;
 | 
| +  uint16_t qtype_;
 | 
|    scoped_ptr<DnsTransaction> transaction_;
 | 
|    int expected_answer_count_;
 | 
|    bool cancel_in_callback_;
 | 
| @@ -364,10 +366,10 @@ class DnsTransactionTest : public testing::Test {
 | 
|    // Add expected query for |dotted_name| and |qtype| with |id| and response
 | 
|    // taken verbatim from |data| of |data_length| bytes. The transaction id in
 | 
|    // |data| should equal |id|, unless testing mismatched response.
 | 
| -  void AddQueryAndResponse(uint16 id,
 | 
| +  void AddQueryAndResponse(uint16_t id,
 | 
|                             const char* dotted_name,
 | 
| -                           uint16 qtype,
 | 
| -                           const uint8* response_data,
 | 
| +                           uint16_t qtype,
 | 
| +                           const uint8_t* response_data,
 | 
|                             size_t response_length,
 | 
|                             IoMode mode,
 | 
|                             bool use_tcp) {
 | 
| @@ -378,27 +380,27 @@ class DnsTransactionTest : public testing::Test {
 | 
|      AddSocketData(data.Pass());
 | 
|    }
 | 
|  
 | 
| -  void AddAsyncQueryAndResponse(uint16 id,
 | 
| +  void AddAsyncQueryAndResponse(uint16_t id,
 | 
|                                  const char* dotted_name,
 | 
| -                                uint16 qtype,
 | 
| -                                const uint8* data,
 | 
| +                                uint16_t qtype,
 | 
| +                                const uint8_t* data,
 | 
|                                  size_t data_length) {
 | 
|      AddQueryAndResponse(id, dotted_name, qtype, data, data_length, ASYNC,
 | 
|                          false);
 | 
|    }
 | 
|  
 | 
| -  void AddSyncQueryAndResponse(uint16 id,
 | 
| +  void AddSyncQueryAndResponse(uint16_t id,
 | 
|                                 const char* dotted_name,
 | 
| -                               uint16 qtype,
 | 
| -                               const uint8* data,
 | 
| +                               uint16_t qtype,
 | 
| +                               const uint8_t* data,
 | 
|                                 size_t data_length) {
 | 
|      AddQueryAndResponse(id, dotted_name, qtype, data, data_length, SYNCHRONOUS,
 | 
|                          false);
 | 
|    }
 | 
|  
 | 
|    // Add expected query of |dotted_name| and |qtype| and no response.
 | 
| -  void AddQueryAndTimeout(const char* dotted_name, uint16 qtype) {
 | 
| -    uint16 id = base::RandInt(0, kuint16max);
 | 
| +  void AddQueryAndTimeout(const char* dotted_name, uint16_t qtype) {
 | 
| +    uint16_t id = base::RandInt(0, std::numeric_limits<uint16_t>::max());
 | 
|      scoped_ptr<DnsSocketData> data(
 | 
|          new DnsSocketData(id, dotted_name, qtype, ASYNC, false));
 | 
|      AddSocketData(data.Pass());
 | 
| @@ -407,23 +409,27 @@ class DnsTransactionTest : public testing::Test {
 | 
|    // Add expected query of |dotted_name| and |qtype| and matching response with
 | 
|    // no answer and RCODE set to |rcode|. The id will be generated randomly.
 | 
|    void AddQueryAndRcode(const char* dotted_name,
 | 
| -                        uint16 qtype,
 | 
| +                        uint16_t qtype,
 | 
|                          int rcode,
 | 
|                          IoMode mode,
 | 
|                          bool use_tcp) {
 | 
|      CHECK_NE(dns_protocol::kRcodeNOERROR, rcode);
 | 
| -    uint16 id = base::RandInt(0, kuint16max);
 | 
| +    uint16_t id = base::RandInt(0, std::numeric_limits<uint16_t>::max());
 | 
|      scoped_ptr<DnsSocketData> data(
 | 
|          new DnsSocketData(id, dotted_name, qtype, mode, use_tcp));
 | 
|      data->AddRcode(rcode, mode);
 | 
|      AddSocketData(data.Pass());
 | 
|    }
 | 
|  
 | 
| -  void AddAsyncQueryAndRcode(const char* dotted_name, uint16 qtype, int rcode) {
 | 
| +  void AddAsyncQueryAndRcode(const char* dotted_name,
 | 
| +                             uint16_t qtype,
 | 
| +                             int rcode) {
 | 
|      AddQueryAndRcode(dotted_name, qtype, rcode, ASYNC, false);
 | 
|    }
 | 
|  
 | 
| -  void AddSyncQueryAndRcode(const char* dotted_name, uint16 qtype, int rcode) {
 | 
| +  void AddSyncQueryAndRcode(const char* dotted_name,
 | 
| +                            uint16_t qtype,
 | 
| +                            int rcode) {
 | 
|      AddQueryAndRcode(dotted_name, qtype, rcode, SYNCHRONOUS, false);
 | 
|    }
 | 
|  
 | 
| @@ -784,19 +790,15 @@ TEST_F(DnsTransactionTest, DontAppendToMultiLabelName) {
 | 
|    EXPECT_TRUE(helper2.Run(transaction_factory_.get()));
 | 
|  }
 | 
|  
 | 
| -const uint8 kResponseNoData[] = {
 | 
| -  0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
 | 
| -  // Question
 | 
| -  0x01,  'x', 0x01,  'y', 0x01,  'z', 0x01,  'b', 0x00, 0x00, 0x01, 0x00, 0x01,
 | 
| -  // Authority section, SOA record, TTL 0x3E6
 | 
| -  0x01,  'z', 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x03, 0xE6,
 | 
| -  // Minimal RDATA, 18 bytes
 | 
| -  0x00, 0x12,
 | 
| -  0x00, 0x00,
 | 
| -  0x00, 0x00, 0x00, 0x00,
 | 
| -  0x00, 0x00, 0x00, 0x00,
 | 
| -  0x00, 0x00, 0x00, 0x00,
 | 
| -  0x00, 0x00, 0x00, 0x00,
 | 
| +const uint8_t kResponseNoData[] = {
 | 
| +    0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
 | 
| +    // Question
 | 
| +    0x01, 'x', 0x01, 'y', 0x01, 'z', 0x01, 'b', 0x00, 0x00, 0x01, 0x00, 0x01,
 | 
| +    // Authority section, SOA record, TTL 0x3E6
 | 
| +    0x01, 'z', 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x03, 0xE6,
 | 
| +    // Minimal RDATA, 18 bytes
 | 
| +    0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 | 
| +    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 | 
|  };
 | 
|  
 | 
|  TEST_F(DnsTransactionTest, SuffixSearchStop) {
 | 
| @@ -915,8 +917,7 @@ TEST_F(DnsTransactionTest, TCPMalformed) {
 | 
|        make_scoped_ptr(
 | 
|            new DnsResponse(reinterpret_cast<const char*>(kT0ResponseDatagram),
 | 
|                            arraysize(kT0ResponseDatagram), 0)),
 | 
| -      ASYNC,
 | 
| -      static_cast<uint16>(kT0QuerySize - 1));
 | 
| +      ASYNC, static_cast<uint16_t>(kT0QuerySize - 1));
 | 
|    AddSocketData(data.Pass());
 | 
|  
 | 
|    TransactionHelper helper0(kT0HostName, kT0Qtype, ERR_DNS_MALFORMED_RESPONSE);
 | 
| @@ -945,8 +946,7 @@ TEST_F(DnsTransactionTest, TCPReadReturnsZeroAsync) {
 | 
|        make_scoped_ptr(
 | 
|            new DnsResponse(reinterpret_cast<const char*>(kT0ResponseDatagram),
 | 
|                            arraysize(kT0ResponseDatagram) - 1, 0)),
 | 
| -      ASYNC,
 | 
| -      static_cast<uint16>(arraysize(kT0ResponseDatagram)));
 | 
| +      ASYNC, static_cast<uint16_t>(arraysize(kT0ResponseDatagram)));
 | 
|    // Then return a 0-length read.
 | 
|    data->AddReadError(0, ASYNC);
 | 
|    AddSocketData(data.Pass());
 | 
| @@ -965,8 +965,7 @@ TEST_F(DnsTransactionTest, TCPReadReturnsZeroSynchronous) {
 | 
|        make_scoped_ptr(
 | 
|            new DnsResponse(reinterpret_cast<const char*>(kT0ResponseDatagram),
 | 
|                            arraysize(kT0ResponseDatagram) - 1, 0)),
 | 
| -      SYNCHRONOUS,
 | 
| -      static_cast<uint16>(arraysize(kT0ResponseDatagram)));
 | 
| +      SYNCHRONOUS, static_cast<uint16_t>(arraysize(kT0ResponseDatagram)));
 | 
|    // Then return a 0-length read.
 | 
|    data->AddReadError(0, SYNCHRONOUS);
 | 
|    AddSocketData(data.Pass());
 | 
| 
 |