| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 for (unsigned i = 0; i < num_servers; ++i) { | 338 for (unsigned i = 0; i < num_servers; ++i) { |
| 339 config_.nameservers.push_back( | 339 config_.nameservers.push_back( |
| 340 IPEndPoint(IPAddress(192, 168, 1, i), dns_protocol::kDefaultPort)); | 340 IPEndPoint(IPAddress(192, 168, 1, i), dns_protocol::kDefaultPort)); |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 // Called after fully configuring |config|. | 344 // Called after fully configuring |config|. |
| 345 void ConfigureFactory() { | 345 void ConfigureFactory() { |
| 346 socket_factory_.reset(new TestSocketFactory()); | 346 socket_factory_.reset(new TestSocketFactory()); |
| 347 session_ = new DnsSession( | 347 session_ = new DnsSession( |
| 348 config_, | 348 config_, DnsSocketPool::CreateNull(socket_factory_.get(), |
| 349 DnsSocketPool::CreateNull(socket_factory_.get()), | 349 base::Bind(base::RandInt)), |
| 350 base::Bind(&DnsTransactionTest::GetNextId, base::Unretained(this)), | 350 base::Bind(&DnsTransactionTest::GetNextId, base::Unretained(this)), |
| 351 NULL /* NetLog */); | 351 NULL /* NetLog */); |
| 352 transaction_factory_ = DnsTransactionFactory::CreateFactory(session_.get()); | 352 transaction_factory_ = DnsTransactionFactory::CreateFactory(session_.get()); |
| 353 } | 353 } |
| 354 | 354 |
| 355 void AddSocketData(std::unique_ptr<DnsSocketData> data) { | 355 void AddSocketData(std::unique_ptr<DnsSocketData> data) { |
| 356 CHECK(socket_factory_.get()); | 356 CHECK(socket_factory_.get()); |
| 357 transaction_ids_.push_back(data->query_id()); | 357 transaction_ids_.push_back(data->query_id()); |
| 358 socket_factory_->AddSocketDataProvider(data->GetProvider()); | 358 socket_factory_->AddSocketDataProvider(data->GetProvider()); |
| 359 socket_data_.push_back(std::move(data)); | 359 socket_data_.push_back(std::move(data)); |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 config_.timeout = TestTimeouts::tiny_timeout(); | 993 config_.timeout = TestTimeouts::tiny_timeout(); |
| 994 ConfigureFactory(); | 994 ConfigureFactory(); |
| 995 | 995 |
| 996 TransactionHelper helper0(".", dns_protocol::kTypeA, ERR_INVALID_ARGUMENT); | 996 TransactionHelper helper0(".", dns_protocol::kTypeA, ERR_INVALID_ARGUMENT); |
| 997 EXPECT_TRUE(helper0.Run(transaction_factory_.get())); | 997 EXPECT_TRUE(helper0.Run(transaction_factory_.get())); |
| 998 } | 998 } |
| 999 | 999 |
| 1000 } // namespace | 1000 } // namespace |
| 1001 | 1001 |
| 1002 } // namespace net | 1002 } // namespace net |
| OLD | NEW |