| 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 config_.nameservers.push_back(IPEndPoint(dns_ip, | 314 config_.nameservers.push_back(IPEndPoint(dns_ip, |
| 315 dns_protocol::kDefaultPort)); | 315 dns_protocol::kDefaultPort)); |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 | 318 |
| 319 // Called after fully configuring |config|. | 319 // Called after fully configuring |config|. |
| 320 void ConfigureFactory() { | 320 void ConfigureFactory() { |
| 321 socket_factory_.reset(new TestSocketFactory()); | 321 socket_factory_.reset(new TestSocketFactory()); |
| 322 session_ = new DnsSession( | 322 session_ = new DnsSession( |
| 323 config_, | 323 config_, |
| 324 socket_factory_.get(), | 324 DnsSocketPool::CreateNull(socket_factory_.get()), |
| 325 base::Bind(&DnsTransactionTest::GetNextId, base::Unretained(this)), | 325 base::Bind(&DnsTransactionTest::GetNextId, base::Unretained(this)), |
| 326 NULL /* NetLog */); | 326 NULL /* NetLog */); |
| 327 transaction_factory_ = DnsTransactionFactory::CreateFactory(session_.get()); | 327 transaction_factory_ = DnsTransactionFactory::CreateFactory(session_.get()); |
| 328 } | 328 } |
| 329 | 329 |
| 330 void AddSocketData(scoped_ptr<DnsSocketData> data) { | 330 void AddSocketData(scoped_ptr<DnsSocketData> data) { |
| 331 transaction_ids_.push_back(data->query_id()); | 331 transaction_ids_.push_back(data->query_id()); |
| 332 socket_factory_->AddSocketDataProvider(data->GetProvider()); | 332 socket_factory_->AddSocketDataProvider(data->GetProvider()); |
| 333 socket_data_.push_back(data.release()); | 333 socket_data_.push_back(data.release()); |
| 334 } | 334 } |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 socket_factory_->create_failing_sockets_ = true; | 827 socket_factory_->create_failing_sockets_ = true; |
| 828 transaction_ids_.push_back(0); // Needed to make a DnsUDPAttempt. | 828 transaction_ids_.push_back(0); // Needed to make a DnsUDPAttempt. |
| 829 TransactionHelper helper0("www.chromium.org", dns_protocol::kTypeA, | 829 TransactionHelper helper0("www.chromium.org", dns_protocol::kTypeA, |
| 830 ERR_CONNECTION_REFUSED); | 830 ERR_CONNECTION_REFUSED); |
| 831 EXPECT_TRUE(helper0.Run(transaction_factory_.get())); | 831 EXPECT_TRUE(helper0.Run(transaction_factory_.get())); |
| 832 } | 832 } |
| 833 | 833 |
| 834 } // namespace | 834 } // namespace |
| 835 | 835 |
| 836 } // namespace net | 836 } // namespace net |
| OLD | NEW |