| 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" |
| 11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "net/base/net_log.h" | 13 #include "net/base/net_log.h" |
| 14 #include "net/dns/dns_protocol.h" | 14 #include "net/dns/dns_protocol.h" |
| 15 #include "net/dns/dns_socket_pool.h" | 15 #include "net/dns/dns_socket_pool.h" |
| 16 #include "net/socket/socket_test_util.h" | 16 #include "net/socket/socket_test_util.h" |
| 17 #include "net/socket/ssl_client_socket.h" | 17 #include "net/socket/ssl_client_socket.h" |
| 18 #include "net/socket/ssl_host_info.h" |
| 18 #include "net/socket/stream_socket.h" | 19 #include "net/socket/stream_socket.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 21 |
| 21 namespace net { | 22 namespace net { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 class TestClientSocketFactory : public ClientSocketFactory { | 26 class TestClientSocketFactory : public ClientSocketFactory { |
| 26 public: | 27 public: |
| 27 virtual ~TestClientSocketFactory(); | 28 virtual ~TestClientSocketFactory(); |
| 28 | 29 |
| 29 virtual scoped_ptr<DatagramClientSocket> CreateDatagramClientSocket( | 30 virtual scoped_ptr<DatagramClientSocket> CreateDatagramClientSocket( |
| 30 DatagramSocket::BindType bind_type, | 31 DatagramSocket::BindType bind_type, |
| 31 const RandIntCallback& rand_int_cb, | 32 const RandIntCallback& rand_int_cb, |
| 32 net::NetLog* net_log, | 33 net::NetLog* net_log, |
| 33 const net::NetLog::Source& source) OVERRIDE; | 34 const net::NetLog::Source& source) OVERRIDE; |
| 34 | 35 |
| 35 virtual scoped_ptr<StreamSocket> CreateTransportClientSocket( | 36 virtual scoped_ptr<StreamSocket> CreateTransportClientSocket( |
| 36 const AddressList& addresses, | 37 const AddressList& addresses, |
| 37 NetLog*, const NetLog::Source&) OVERRIDE { | 38 NetLog*, const NetLog::Source&) OVERRIDE { |
| 38 NOTIMPLEMENTED(); | 39 NOTIMPLEMENTED(); |
| 39 return scoped_ptr<StreamSocket>(); | 40 return scoped_ptr<StreamSocket>(); |
| 40 } | 41 } |
| 41 | 42 |
| 42 virtual scoped_ptr<SSLClientSocket> CreateSSLClientSocket( | 43 virtual scoped_ptr<SSLClientSocket> CreateSSLClientSocket( |
| 43 scoped_ptr<ClientSocketHandle> transport_socket, | 44 scoped_ptr<ClientSocketHandle> transport_socket, |
| 44 const HostPortPair& host_and_port, | 45 const HostPortPair& host_and_port, |
| 45 const SSLConfig& ssl_config, | 46 const SSLConfig& ssl_config, |
| 47 SSLHostInfo* ssl_host_info, |
| 46 const SSLClientSocketContext& context) OVERRIDE { | 48 const SSLClientSocketContext& context) OVERRIDE { |
| 47 NOTIMPLEMENTED(); | 49 NOTIMPLEMENTED(); |
| 50 delete ssl_host_info; |
| 48 return scoped_ptr<SSLClientSocket>(); | 51 return scoped_ptr<SSLClientSocket>(); |
| 49 } | 52 } |
| 50 | 53 |
| 51 virtual void ClearSSLSessionCache() OVERRIDE { | 54 virtual void ClearSSLSessionCache() OVERRIDE { |
| 52 NOTIMPLEMENTED(); | 55 NOTIMPLEMENTED(); |
| 53 } | 56 } |
| 54 | 57 |
| 55 private: | 58 private: |
| 56 std::list<SocketDataProvider*> data_providers_; | 59 std::list<SocketDataProvider*> data_providers_; |
| 57 }; | 60 }; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 TEST_F(DnsSessionTest, HistogramTimeoutLong) { | 246 TEST_F(DnsSessionTest, HistogramTimeoutLong) { |
| 244 config_.timeout = base::TimeDelta::FromSeconds(15); | 247 config_.timeout = base::TimeDelta::FromSeconds(15); |
| 245 Initialize(2); | 248 Initialize(2); |
| 246 base::TimeDelta timeout = session_->NextTimeout(0, 0); | 249 base::TimeDelta timeout = session_->NextTimeout(0, 0); |
| 247 EXPECT_EQ(config_.timeout.InMilliseconds(), timeout.InMilliseconds()); | 250 EXPECT_EQ(config_.timeout.InMilliseconds(), timeout.InMilliseconds()); |
| 248 } | 251 } |
| 249 | 252 |
| 250 } // namespace | 253 } // namespace |
| 251 | 254 |
| 252 } // namespace net | 255 } // namespace net |
| OLD | NEW |