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 <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 next_ssl_data->next_protos_expected_in_ssl_config.end(), | 738 next_ssl_data->next_protos_expected_in_ssl_config.end(), |
739 ssl_config.alpn_protos.begin())); | 739 ssl_config.alpn_protos.begin())); |
740 } | 740 } |
741 return scoped_ptr<SSLClientSocket>(new MockSSLClientSocket( | 741 return scoped_ptr<SSLClientSocket>(new MockSSLClientSocket( |
742 std::move(transport_socket), host_and_port, ssl_config, next_ssl_data)); | 742 std::move(transport_socket), host_and_port, ssl_config, next_ssl_data)); |
743 } | 743 } |
744 | 744 |
745 void MockClientSocketFactory::ClearSSLSessionCache() { | 745 void MockClientSocketFactory::ClearSSLSessionCache() { |
746 } | 746 } |
747 | 747 |
748 const char MockClientSocket::kTlsUnique[] = "MOCK_TLSUNIQ"; | |
749 | |
750 MockClientSocket::MockClientSocket(const BoundNetLog& net_log) | 748 MockClientSocket::MockClientSocket(const BoundNetLog& net_log) |
751 : connected_(false), | 749 : connected_(false), |
752 net_log_(net_log), | 750 net_log_(net_log), |
753 weak_factory_(this) { | 751 weak_factory_(this) { |
754 IPAddressNumber ip; | 752 IPAddressNumber ip; |
755 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); | 753 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); |
756 peer_addr_ = IPEndPoint(ip, 0); | 754 peer_addr_ = IPEndPoint(ip, 0); |
757 } | 755 } |
758 | 756 |
759 int MockClientSocket::SetReceiveBufferSize(int32_t size) { | 757 int MockClientSocket::SetReceiveBufferSize(int32_t size) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 | 808 |
811 int MockClientSocket::ExportKeyingMaterial(const base::StringPiece& label, | 809 int MockClientSocket::ExportKeyingMaterial(const base::StringPiece& label, |
812 bool has_context, | 810 bool has_context, |
813 const base::StringPiece& context, | 811 const base::StringPiece& context, |
814 unsigned char* out, | 812 unsigned char* out, |
815 unsigned int outlen) { | 813 unsigned int outlen) { |
816 memset(out, 'A', outlen); | 814 memset(out, 'A', outlen); |
817 return OK; | 815 return OK; |
818 } | 816 } |
819 | 817 |
820 int MockClientSocket::GetTLSUniqueChannelBinding(std::string* out) { | |
821 out->assign(MockClientSocket::kTlsUnique); | |
822 return OK; | |
823 } | |
824 | |
825 ChannelIDService* MockClientSocket::GetChannelIDService() const { | 818 ChannelIDService* MockClientSocket::GetChannelIDService() const { |
826 NOTREACHED(); | 819 NOTREACHED(); |
827 return NULL; | 820 return NULL; |
828 } | 821 } |
829 | 822 |
830 Error MockClientSocket::GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, | 823 Error MockClientSocket::GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, |
831 std::vector<uint8_t>* out) { | 824 std::vector<uint8_t>* out) { |
832 NOTREACHED(); | 825 NOTREACHED(); |
833 return ERR_NOT_IMPLEMENTED; | 826 return ERR_NOT_IMPLEMENTED; |
834 } | 827 } |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 } | 1719 } |
1727 | 1720 |
1728 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { | 1721 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { |
1729 int64_t total = 0; | 1722 int64_t total = 0; |
1730 for (const MockWrite* write = writes; write != writes + writes_size; ++write) | 1723 for (const MockWrite* write = writes; write != writes + writes_size; ++write) |
1731 total += write->data_len; | 1724 total += write->data_len; |
1732 return total; | 1725 return total; |
1733 } | 1726 } |
1734 | 1727 |
1735 } // namespace net | 1728 } // namespace net |
OLD | NEW |