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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 bool StaticSocketDataProvider::AllWriteDataConsumed() const { | 258 bool StaticSocketDataProvider::AllWriteDataConsumed() const { |
259 return helper_.AllWriteDataConsumed(); | 259 return helper_.AllWriteDataConsumed(); |
260 } | 260 } |
261 | 261 |
262 SSLSocketDataProvider::SSLSocketDataProvider(IoMode mode, int result) | 262 SSLSocketDataProvider::SSLSocketDataProvider(IoMode mode, int result) |
263 : connect(mode, result), | 263 : connect(mode, result), |
264 next_proto_status(SSLClientSocket::kNextProtoUnsupported), | 264 next_proto_status(SSLClientSocket::kNextProtoUnsupported), |
265 client_cert_sent(false), | 265 client_cert_sent(false), |
266 cert_request_info(NULL), | 266 cert_request_info(NULL), |
267 channel_id_sent(false), | 267 channel_id_sent(false), |
268 connection_status(0) { | 268 connection_status(0), |
| 269 token_binding_negotiated(false) { |
269 SSLConnectionStatusSetVersion(SSL_CONNECTION_VERSION_TLS1_2, | 270 SSLConnectionStatusSetVersion(SSL_CONNECTION_VERSION_TLS1_2, |
270 &connection_status); | 271 &connection_status); |
271 // Set to TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 | 272 // Set to TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 |
272 SSLConnectionStatusSetCipherSuite(0xcc14, &connection_status); | 273 SSLConnectionStatusSetCipherSuite(0xcc14, &connection_status); |
273 } | 274 } |
274 | 275 |
275 SSLSocketDataProvider::~SSLSocketDataProvider() { | 276 SSLSocketDataProvider::~SSLSocketDataProvider() { |
276 } | 277 } |
277 | 278 |
278 void SSLSocketDataProvider::SetNextProto(NextProto proto) { | 279 void SSLSocketDataProvider::SetNextProto(NextProto proto) { |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 int MockClientSocket::GetTLSUniqueChannelBinding(std::string* out) { | 891 int MockClientSocket::GetTLSUniqueChannelBinding(std::string* out) { |
891 out->assign(MockClientSocket::kTlsUnique); | 892 out->assign(MockClientSocket::kTlsUnique); |
892 return OK; | 893 return OK; |
893 } | 894 } |
894 | 895 |
895 ChannelIDService* MockClientSocket::GetChannelIDService() const { | 896 ChannelIDService* MockClientSocket::GetChannelIDService() const { |
896 NOTREACHED(); | 897 NOTREACHED(); |
897 return NULL; | 898 return NULL; |
898 } | 899 } |
899 | 900 |
| 901 int MockClientSocket::GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, |
| 902 std::vector<uint8_t>* out) { |
| 903 NOTREACHED(); |
| 904 return ERR_NOT_IMPLEMENTED; |
| 905 } |
| 906 |
900 SSLFailureState MockClientSocket::GetSSLFailureState() const { | 907 SSLFailureState MockClientSocket::GetSSLFailureState() const { |
901 return IsConnected() ? SSL_FAILURE_NONE : SSL_FAILURE_UNKNOWN; | 908 return IsConnected() ? SSL_FAILURE_NONE : SSL_FAILURE_UNKNOWN; |
902 } | 909 } |
903 | 910 |
904 SSLClientSocket::NextProtoStatus MockClientSocket::GetNextProto( | 911 SSLClientSocket::NextProtoStatus MockClientSocket::GetNextProto( |
905 std::string* proto) const { | 912 std::string* proto) const { |
906 proto->clear(); | 913 proto->clear(); |
907 return SSLClientSocket::kNextProtoUnsupported; | 914 return SSLClientSocket::kNextProtoUnsupported; |
908 } | 915 } |
909 | 916 |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 int MockSSLClientSocket::GetPeerAddress(IPEndPoint* address) const { | 1523 int MockSSLClientSocket::GetPeerAddress(IPEndPoint* address) const { |
1517 return transport_->socket()->GetPeerAddress(address); | 1524 return transport_->socket()->GetPeerAddress(address); |
1518 } | 1525 } |
1519 | 1526 |
1520 bool MockSSLClientSocket::GetSSLInfo(SSLInfo* ssl_info) { | 1527 bool MockSSLClientSocket::GetSSLInfo(SSLInfo* ssl_info) { |
1521 ssl_info->Reset(); | 1528 ssl_info->Reset(); |
1522 ssl_info->cert = data_->cert; | 1529 ssl_info->cert = data_->cert; |
1523 ssl_info->client_cert_sent = data_->client_cert_sent; | 1530 ssl_info->client_cert_sent = data_->client_cert_sent; |
1524 ssl_info->channel_id_sent = data_->channel_id_sent; | 1531 ssl_info->channel_id_sent = data_->channel_id_sent; |
1525 ssl_info->connection_status = data_->connection_status; | 1532 ssl_info->connection_status = data_->connection_status; |
| 1533 ssl_info->token_binding_negotiated = data_->token_binding_negotiated; |
| 1534 ssl_info->token_binding_key_param = data_->token_binding_key_param; |
1526 return true; | 1535 return true; |
1527 } | 1536 } |
1528 | 1537 |
1529 void MockSSLClientSocket::GetSSLCertRequestInfo( | 1538 void MockSSLClientSocket::GetSSLCertRequestInfo( |
1530 SSLCertRequestInfo* cert_request_info) { | 1539 SSLCertRequestInfo* cert_request_info) { |
1531 DCHECK(cert_request_info); | 1540 DCHECK(cert_request_info); |
1532 if (data_->cert_request_info) { | 1541 if (data_->cert_request_info) { |
1533 cert_request_info->host_and_port = | 1542 cert_request_info->host_and_port = |
1534 data_->cert_request_info->host_and_port; | 1543 data_->cert_request_info->host_and_port; |
1535 cert_request_info->client_certs = data_->cert_request_info->client_certs; | 1544 cert_request_info->client_certs = data_->cert_request_info->client_certs; |
1536 } else { | 1545 } else { |
1537 cert_request_info->Reset(); | 1546 cert_request_info->Reset(); |
1538 } | 1547 } |
1539 } | 1548 } |
1540 | 1549 |
1541 SSLClientSocket::NextProtoStatus MockSSLClientSocket::GetNextProto( | 1550 SSLClientSocket::NextProtoStatus MockSSLClientSocket::GetNextProto( |
1542 std::string* proto) const { | 1551 std::string* proto) const { |
1543 *proto = data_->next_proto; | 1552 *proto = data_->next_proto; |
1544 return data_->next_proto_status; | 1553 return data_->next_proto_status; |
1545 } | 1554 } |
1546 | 1555 |
1547 ChannelIDService* MockSSLClientSocket::GetChannelIDService() const { | 1556 ChannelIDService* MockSSLClientSocket::GetChannelIDService() const { |
1548 return data_->channel_id_service; | 1557 return data_->channel_id_service; |
1549 } | 1558 } |
1550 | 1559 |
| 1560 int MockSSLClientSocket::GetSignedEKMForTokenBinding( |
| 1561 crypto::ECPrivateKey* key, |
| 1562 std::vector<uint8_t>* out) { |
| 1563 out->push_back('A'); |
| 1564 return OK; |
| 1565 } |
| 1566 |
1551 void MockSSLClientSocket::OnReadComplete(const MockRead& data) { | 1567 void MockSSLClientSocket::OnReadComplete(const MockRead& data) { |
1552 NOTIMPLEMENTED(); | 1568 NOTIMPLEMENTED(); |
1553 } | 1569 } |
1554 | 1570 |
1555 void MockSSLClientSocket::OnWriteComplete(int rv) { | 1571 void MockSSLClientSocket::OnWriteComplete(int rv) { |
1556 NOTIMPLEMENTED(); | 1572 NOTIMPLEMENTED(); |
1557 } | 1573 } |
1558 | 1574 |
1559 void MockSSLClientSocket::OnConnectComplete(const MockConnect& data) { | 1575 void MockSSLClientSocket::OnConnectComplete(const MockConnect& data) { |
1560 NOTIMPLEMENTED(); | 1576 NOTIMPLEMENTED(); |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 } | 2086 } |
2071 | 2087 |
2072 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { | 2088 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { |
2073 int64_t total = 0; | 2089 int64_t total = 0; |
2074 for (const MockWrite* write = writes; write != writes + writes_size; ++write) | 2090 for (const MockWrite* write = writes; write != writes + writes_size; ++write) |
2075 total += write->data_len; | 2091 total += write->data_len; |
2076 return total; | 2092 return total; |
2077 } | 2093 } |
2078 | 2094 |
2079 } // namespace net | 2095 } // namespace net |
OLD | NEW |