| 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_session.h" | 5 #include "net/dns/dns_session.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
| 12 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 13 #include "net/dns/dns_protocol.h" | 14 #include "net/dns/dns_protocol.h" |
| 14 #include "net/dns/dns_socket_pool.h" | 15 #include "net/dns/dns_socket_pool.h" |
| 15 #include "net/log/net_log.h" | 16 #include "net/log/net_log.h" |
| 16 #include "net/socket/socket_test_util.h" | 17 #include "net/socket/socket_test_util.h" |
| 17 #include "net/socket/ssl_client_socket.h" | 18 #include "net/socket/ssl_client_socket.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 DatagramSocket::BindType bind_type, | 184 DatagramSocket::BindType bind_type, |
| 184 const RandIntCallback& rand_int_cb, | 185 const RandIntCallback& rand_int_cb, |
| 185 NetLog* net_log, | 186 NetLog* net_log, |
| 186 const NetLog::Source& source) { | 187 const NetLog::Source& source) { |
| 187 // We're not actually expecting to send or receive any data, so use the | 188 // We're not actually expecting to send or receive any data, so use the |
| 188 // simplest SocketDataProvider with no data supplied. | 189 // simplest SocketDataProvider with no data supplied. |
| 189 SocketDataProvider* data_provider = new StaticSocketDataProvider(); | 190 SocketDataProvider* data_provider = new StaticSocketDataProvider(); |
| 190 data_providers_.push_back(data_provider); | 191 data_providers_.push_back(data_provider); |
| 191 scoped_ptr<MockUDPClientSocket> socket( | 192 scoped_ptr<MockUDPClientSocket> socket( |
| 192 new MockUDPClientSocket(data_provider, net_log)); | 193 new MockUDPClientSocket(data_provider, net_log)); |
| 193 return socket.Pass(); | 194 return std::move(socket); |
| 194 } | 195 } |
| 195 | 196 |
| 196 TestClientSocketFactory::~TestClientSocketFactory() { | 197 TestClientSocketFactory::~TestClientSocketFactory() { |
| 197 STLDeleteElements(&data_providers_); | 198 STLDeleteElements(&data_providers_); |
| 198 } | 199 } |
| 199 | 200 |
| 200 TEST_F(DnsSessionTest, AllocateFree) { | 201 TEST_F(DnsSessionTest, AllocateFree) { |
| 201 scoped_ptr<DnsSession::SocketLease> lease1, lease2; | 202 scoped_ptr<DnsSession::SocketLease> lease1, lease2; |
| 202 | 203 |
| 203 Initialize(2); | 204 Initialize(2); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 TEST_F(DnsSessionTest, HistogramTimeoutLong) { | 240 TEST_F(DnsSessionTest, HistogramTimeoutLong) { |
| 240 config_.timeout = base::TimeDelta::FromSeconds(15); | 241 config_.timeout = base::TimeDelta::FromSeconds(15); |
| 241 Initialize(2); | 242 Initialize(2); |
| 242 base::TimeDelta timeout = session_->NextTimeout(0, 0); | 243 base::TimeDelta timeout = session_->NextTimeout(0, 0); |
| 243 EXPECT_EQ(config_.timeout.InMilliseconds(), timeout.InMilliseconds()); | 244 EXPECT_EQ(config_.timeout.InMilliseconds(), timeout.InMilliseconds()); |
| 244 } | 245 } |
| 245 | 246 |
| 246 } // namespace | 247 } // namespace |
| 247 | 248 |
| 248 } // namespace net | 249 } // namespace net |
| OLD | NEW |