| OLD | NEW |
| 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_transaction.h" | 5 #include "net/dns/dns_transaction.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 // Called after fully configuring |config|. | 212 // Called after fully configuring |config|. |
| 213 void ConfigureFactory() { | 213 void ConfigureFactory() { |
| 214 socket_factory_.reset(new TestSocketFactory()); | 214 socket_factory_.reset(new TestSocketFactory()); |
| 215 session_ = new DnsSession( | 215 session_ = new DnsSession( |
| 216 config_, | 216 config_, |
| 217 socket_factory_.get(), | 217 socket_factory_.get(), |
| 218 base::Bind(&DnsTransactionTest::GetNextId, base::Unretained(this)), | 218 base::Bind(&DnsTransactionTest::GetNextId, base::Unretained(this)), |
| 219 true, /* bypass pools */ |
| 219 NULL /* NetLog */); | 220 NULL /* NetLog */); |
| 220 transaction_factory_ = DnsTransactionFactory::CreateFactory(session_.get()); | 221 transaction_factory_ = DnsTransactionFactory::CreateFactory(session_.get()); |
| 221 } | 222 } |
| 222 | 223 |
| 223 // Each socket used by a DnsTransaction expects only one write and zero or one | 224 // Each socket used by a DnsTransaction expects only one write and zero or one |
| 224 // reads. | 225 // reads. |
| 225 | 226 |
| 226 // Add expected query for |dotted_name| and |qtype| with |id| and response | 227 // Add expected query for |dotted_name| and |qtype| with |id| and response |
| 227 // taken verbatim from |data| of |data_length| bytes. The transaction id in | 228 // taken verbatim from |data| of |data_length| bytes. The transaction id in |
| 228 // |data| should equal |id|, unless testing mismatched response. | 229 // |data| should equal |id|, unless testing mismatched response. |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 | 782 |
| 782 TransactionHelper helper0("www", | 783 TransactionHelper helper0("www", |
| 783 kT2Qtype, | 784 kT2Qtype, |
| 784 kT2RecordCount); | 785 kT2RecordCount); |
| 785 EXPECT_TRUE(helper0.Run(transaction_factory_.get())); | 786 EXPECT_TRUE(helper0.Run(transaction_factory_.get())); |
| 786 } | 787 } |
| 787 | 788 |
| 788 } // namespace | 789 } // namespace |
| 789 | 790 |
| 790 } // namespace net | 791 } // namespace net |
| OLD | NEW |