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/socket/socket_test_util.h" | 5 #include "net/socket/socket_test_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 bool rv = ParseIPLiteralToNumber("192.0.2.33", &ip); | 757 bool rv = ParseIPLiteralToNumber("192.0.2.33", &ip); |
758 CHECK(rv); | 758 CHECK(rv); |
759 *address = IPEndPoint(ip, 123); | 759 *address = IPEndPoint(ip, 123); |
760 return OK; | 760 return OK; |
761 } | 761 } |
762 | 762 |
763 const BoundNetLog& MockClientSocket::NetLog() const { | 763 const BoundNetLog& MockClientSocket::NetLog() const { |
764 return net_log_; | 764 return net_log_; |
765 } | 765 } |
766 | 766 |
| 767 std::string MockClientSocket::GetSessionCacheKey() const { |
| 768 NOTIMPLEMENTED(); |
| 769 return std::string(); |
| 770 } |
| 771 |
767 bool MockClientSocket::InSessionCache() const { | 772 bool MockClientSocket::InSessionCache() const { |
768 NOTIMPLEMENTED(); | 773 NOTIMPLEMENTED(); |
769 return false; | 774 return false; |
770 } | 775 } |
771 | 776 |
772 void MockClientSocket::SetHandshakeCompletionCallback(const base::Closure& cb) { | 777 void MockClientSocket::SetHandshakeCompletionCallback(const base::Closure& cb) { |
773 NOTIMPLEMENTED(); | 778 NOTIMPLEMENTED(); |
774 } | 779 } |
775 | 780 |
776 void MockClientSocket::GetSSLCertRequestInfo( | 781 void MockClientSocket::GetSSLCertRequestInfo( |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 MockSSLClientSocket::MockSSLClientSocket( | 1320 MockSSLClientSocket::MockSSLClientSocket( |
1316 scoped_ptr<ClientSocketHandle> transport_socket, | 1321 scoped_ptr<ClientSocketHandle> transport_socket, |
1317 const HostPortPair& host_port_pair, | 1322 const HostPortPair& host_port_pair, |
1318 const SSLConfig& ssl_config, | 1323 const SSLConfig& ssl_config, |
1319 SSLSocketDataProvider* data) | 1324 SSLSocketDataProvider* data) |
1320 : MockClientSocket( | 1325 : MockClientSocket( |
1321 // Have to use the right BoundNetLog for LoadTimingInfo regression | 1326 // Have to use the right BoundNetLog for LoadTimingInfo regression |
1322 // tests. | 1327 // tests. |
1323 transport_socket->socket()->NetLog()), | 1328 transport_socket->socket()->NetLog()), |
1324 transport_(transport_socket.Pass()), | 1329 transport_(transport_socket.Pass()), |
| 1330 host_port_pair_(host_port_pair), |
1325 data_(data), | 1331 data_(data), |
1326 is_npn_state_set_(false), | 1332 is_npn_state_set_(false), |
1327 new_npn_value_(false), | 1333 new_npn_value_(false), |
1328 is_protocol_negotiated_set_(false), | 1334 is_protocol_negotiated_set_(false), |
1329 protocol_negotiated_(kProtoUnknown), | 1335 protocol_negotiated_(kProtoUnknown), |
1330 next_connect_state_(STATE_NONE), | 1336 next_connect_state_(STATE_NONE), |
1331 reached_connect_(false), | 1337 reached_connect_(false), |
1332 weak_factory_(this) { | 1338 weak_factory_(this) { |
1333 DCHECK(data_); | 1339 DCHECK(data_); |
1334 peer_addr_ = data->connect.peer_addr; | 1340 peer_addr_ = data->connect.peer_addr; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 | 1388 |
1383 bool MockSSLClientSocket::GetSSLInfo(SSLInfo* ssl_info) { | 1389 bool MockSSLClientSocket::GetSSLInfo(SSLInfo* ssl_info) { |
1384 ssl_info->Reset(); | 1390 ssl_info->Reset(); |
1385 ssl_info->cert = data_->cert; | 1391 ssl_info->cert = data_->cert; |
1386 ssl_info->client_cert_sent = data_->client_cert_sent; | 1392 ssl_info->client_cert_sent = data_->client_cert_sent; |
1387 ssl_info->channel_id_sent = data_->channel_id_sent; | 1393 ssl_info->channel_id_sent = data_->channel_id_sent; |
1388 ssl_info->connection_status = data_->connection_status; | 1394 ssl_info->connection_status = data_->connection_status; |
1389 return true; | 1395 return true; |
1390 } | 1396 } |
1391 | 1397 |
| 1398 std::string MockSSLClientSocket::GetSessionCacheKey() const { |
| 1399 // For the purposes of these tests, |host_and_port| will serve as the |
| 1400 // cache key. |
| 1401 return host_port_pair_.ToString(); |
| 1402 } |
| 1403 |
1392 bool MockSSLClientSocket::InSessionCache() const { | 1404 bool MockSSLClientSocket::InSessionCache() const { |
1393 return data_->is_in_session_cache; | 1405 return data_->is_in_session_cache; |
1394 } | 1406 } |
1395 | 1407 |
1396 void MockSSLClientSocket::SetHandshakeCompletionCallback( | 1408 void MockSSLClientSocket::SetHandshakeCompletionCallback( |
1397 const base::Closure& cb) { | 1409 const base::Closure& cb) { |
1398 handshake_completion_callback_ = cb; | 1410 handshake_completion_callback_ = cb; |
1399 } | 1411 } |
1400 | 1412 |
1401 void MockSSLClientSocket::GetSSLCertRequestInfo( | 1413 void MockSSLClientSocket::GetSSLCertRequestInfo( |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1979 | 1991 |
1980 const char kSOCKS5OkRequest[] = | 1992 const char kSOCKS5OkRequest[] = |
1981 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; | 1993 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; |
1982 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); | 1994 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); |
1983 | 1995 |
1984 const char kSOCKS5OkResponse[] = | 1996 const char kSOCKS5OkResponse[] = |
1985 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; | 1997 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; |
1986 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); | 1998 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); |
1987 | 1999 |
1988 } // namespace net | 2000 } // namespace net |
OLD | NEW |