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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 new MockTCPClientSocket(addresses, net_log, data_provider)); | 695 new MockTCPClientSocket(addresses, net_log, data_provider)); |
696 data_provider->set_socket(socket.get()); | 696 data_provider->set_socket(socket.get()); |
697 return socket.Pass(); | 697 return socket.Pass(); |
698 } | 698 } |
699 | 699 |
700 scoped_ptr<SSLClientSocket> MockClientSocketFactory::CreateSSLClientSocket( | 700 scoped_ptr<SSLClientSocket> MockClientSocketFactory::CreateSSLClientSocket( |
701 scoped_ptr<ClientSocketHandle> transport_socket, | 701 scoped_ptr<ClientSocketHandle> transport_socket, |
702 const HostPortPair& host_and_port, | 702 const HostPortPair& host_and_port, |
703 const SSLConfig& ssl_config, | 703 const SSLConfig& ssl_config, |
704 const SSLClientSocketContext& context) { | 704 const SSLClientSocketContext& context) { |
705 scoped_ptr<MockSSLClientSocket> socket( | 705 SSLSocketDataProvider* next_ssl_data = mock_ssl_data_.GetNext(); |
706 new MockSSLClientSocket(transport_socket.Pass(), | 706 if (!next_ssl_data->next_protos_expected_in_ssl_config.empty()) { |
707 host_and_port, | 707 EXPECT_EQ(next_ssl_data->next_protos_expected_in_ssl_config.size(), |
708 ssl_config, | 708 ssl_config.next_protos.size()); |
709 mock_ssl_data_.GetNext())); | 709 EXPECT_TRUE( |
| 710 std::equal(next_ssl_data->next_protos_expected_in_ssl_config.begin(), |
| 711 next_ssl_data->next_protos_expected_in_ssl_config.end(), |
| 712 ssl_config.next_protos.begin())); |
| 713 } |
| 714 scoped_ptr<MockSSLClientSocket> socket(new MockSSLClientSocket( |
| 715 transport_socket.Pass(), host_and_port, ssl_config, next_ssl_data)); |
710 ssl_client_sockets_.push_back(socket.get()); | 716 ssl_client_sockets_.push_back(socket.get()); |
711 return socket.Pass(); | 717 return socket.Pass(); |
712 } | 718 } |
713 | 719 |
714 void MockClientSocketFactory::ClearSSLSessionCache() { | 720 void MockClientSocketFactory::ClearSSLSessionCache() { |
715 } | 721 } |
716 | 722 |
717 const char MockClientSocket::kTlsUnique[] = "MOCK_TLSUNIQ"; | 723 const char MockClientSocket::kTlsUnique[] = "MOCK_TLSUNIQ"; |
718 | 724 |
719 MockClientSocket::MockClientSocket(const BoundNetLog& net_log) | 725 MockClientSocket::MockClientSocket(const BoundNetLog& net_log) |
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1991 | 1997 |
1992 const char kSOCKS5OkRequest[] = | 1998 const char kSOCKS5OkRequest[] = |
1993 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; | 1999 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; |
1994 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); | 2000 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); |
1995 | 2001 |
1996 const char kSOCKS5OkResponse[] = | 2002 const char kSOCKS5OkResponse[] = |
1997 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; | 2003 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; |
1998 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); | 2004 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); |
1999 | 2005 |
2000 } // namespace net | 2006 } // namespace net |
OLD | NEW |