| 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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 const RandIntCallback& rand_int_cb, | 187 const RandIntCallback& rand_int_cb, |
| 188 net::NetLog* net_log, | 188 net::NetLog* net_log, |
| 189 const net::NetLog::Source& source) { | 189 const net::NetLog::Source& source) { |
| 190 // We're not actually expecting to send or receive any data, so use the | 190 // We're not actually expecting to send or receive any data, so use the |
| 191 // simplest SocketDataProvider with no data supplied. | 191 // simplest SocketDataProvider with no data supplied. |
| 192 SocketDataProvider* data_provider = new StaticSocketDataProvider(); | 192 SocketDataProvider* data_provider = new StaticSocketDataProvider(); |
| 193 data_providers_.push_back(data_provider); | 193 data_providers_.push_back(data_provider); |
| 194 scoped_ptr<MockUDPClientSocket> socket( | 194 scoped_ptr<MockUDPClientSocket> socket( |
| 195 new MockUDPClientSocket(data_provider, net_log)); | 195 new MockUDPClientSocket(data_provider, net_log)); |
| 196 data_provider->set_socket(socket.get()); | 196 data_provider->set_socket(socket.get()); |
| 197 return socket.PassAs<DatagramClientSocket>(); | 197 return socket.Pass(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 TestClientSocketFactory::~TestClientSocketFactory() { | 200 TestClientSocketFactory::~TestClientSocketFactory() { |
| 201 STLDeleteElements(&data_providers_); | 201 STLDeleteElements(&data_providers_); |
| 202 } | 202 } |
| 203 | 203 |
| 204 TEST_F(DnsSessionTest, AllocateFree) { | 204 TEST_F(DnsSessionTest, AllocateFree) { |
| 205 scoped_ptr<DnsSession::SocketLease> lease1, lease2; | 205 scoped_ptr<DnsSession::SocketLease> lease1, lease2; |
| 206 | 206 |
| 207 Initialize(2); | 207 Initialize(2); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 TEST_F(DnsSessionTest, HistogramTimeoutLong) { | 243 TEST_F(DnsSessionTest, HistogramTimeoutLong) { |
| 244 config_.timeout = base::TimeDelta::FromSeconds(15); | 244 config_.timeout = base::TimeDelta::FromSeconds(15); |
| 245 Initialize(2); | 245 Initialize(2); |
| 246 base::TimeDelta timeout = session_->NextTimeout(0, 0); | 246 base::TimeDelta timeout = session_->NextTimeout(0, 0); |
| 247 EXPECT_EQ(config_.timeout.InMilliseconds(), timeout.InMilliseconds()); | 247 EXPECT_EQ(config_.timeout.InMilliseconds(), timeout.InMilliseconds()); |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace | 250 } // namespace |
| 251 | 251 |
| 252 } // namespace net | 252 } // namespace net |
| OLD | NEW |