Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: net/socket/socket_test_util.cc

Issue 3747003: net: clean up SSLHostInfo construction. (Closed)
Patch Set: ... Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/ssl_client_socket_nss.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 10
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 460
461 MockSSLClientSocket* ssl_client_socket_; 461 MockSSLClientSocket* ssl_client_socket_;
462 net::CompletionCallback* user_callback_; 462 net::CompletionCallback* user_callback_;
463 int rv_; 463 int rv_;
464 }; 464 };
465 465
466 MockSSLClientSocket::MockSSLClientSocket( 466 MockSSLClientSocket::MockSSLClientSocket(
467 net::ClientSocketHandle* transport_socket, 467 net::ClientSocketHandle* transport_socket,
468 const std::string& hostname, 468 const std::string& hostname,
469 const net::SSLConfig& ssl_config, 469 const net::SSLConfig& ssl_config,
470 SSLHostInfo* ssl_host_info,
470 net::SSLSocketDataProvider* data) 471 net::SSLSocketDataProvider* data)
471 : MockClientSocket(transport_socket->socket()->NetLog().net_log()), 472 : MockClientSocket(transport_socket->socket()->NetLog().net_log()),
472 transport_(transport_socket), 473 transport_(transport_socket),
473 data_(data), 474 data_(data),
474 is_npn_state_set_(false), 475 is_npn_state_set_(false),
475 new_npn_value_(false) { 476 new_npn_value_(false) {
476 DCHECK(data_); 477 DCHECK(data_);
478 delete ssl_host_info; // we take ownership but don't use it.
477 } 479 }
478 480
479 MockSSLClientSocket::~MockSSLClientSocket() { 481 MockSSLClientSocket::~MockSSLClientSocket() {
480 Disconnect(); 482 Disconnect();
481 } 483 }
482 484
483 int MockSSLClientSocket::Connect(net::CompletionCallback* callback) { 485 int MockSSLClientSocket::Connect(net::CompletionCallback* callback) {
484 ConnectCallback* connect_callback = new ConnectCallback( 486 ConnectCallback* connect_callback = new ConnectCallback(
485 this, callback, data_->connect.result); 487 this, callback, data_->connect.result);
486 int rv = transport_->socket()->Connect(connect_callback); 488 int rv = transport_->socket()->Connect(connect_callback);
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 MockTCPClientSocket* socket = 972 MockTCPClientSocket* socket =
971 new MockTCPClientSocket(addresses, net_log, data_provider); 973 new MockTCPClientSocket(addresses, net_log, data_provider);
972 data_provider->set_socket(socket); 974 data_provider->set_socket(socket);
973 tcp_client_sockets_.push_back(socket); 975 tcp_client_sockets_.push_back(socket);
974 return socket; 976 return socket;
975 } 977 }
976 978
977 SSLClientSocket* MockClientSocketFactory::CreateSSLClientSocket( 979 SSLClientSocket* MockClientSocketFactory::CreateSSLClientSocket(
978 ClientSocketHandle* transport_socket, 980 ClientSocketHandle* transport_socket,
979 const std::string& hostname, 981 const std::string& hostname,
980 const SSLConfig& ssl_config) { 982 const SSLConfig& ssl_config,
983 SSLHostInfo* ssl_host_info) {
981 MockSSLClientSocket* socket = 984 MockSSLClientSocket* socket =
982 new MockSSLClientSocket(transport_socket, hostname, ssl_config, 985 new MockSSLClientSocket(transport_socket, hostname, ssl_config,
983 mock_ssl_data_.GetNext()); 986 ssl_host_info, mock_ssl_data_.GetNext());
984 ssl_client_sockets_.push_back(socket); 987 ssl_client_sockets_.push_back(socket);
985 return socket; 988 return socket;
986 } 989 }
987 990
988 void DeterministicMockClientSocketFactory::AddSocketDataProvider( 991 void DeterministicMockClientSocketFactory::AddSocketDataProvider(
989 DeterministicSocketData* data) { 992 DeterministicSocketData* data) {
990 mock_data_.Add(data); 993 mock_data_.Add(data);
991 } 994 }
992 995
993 void DeterministicMockClientSocketFactory::AddSSLSocketDataProvider( 996 void DeterministicMockClientSocketFactory::AddSSLSocketDataProvider(
(...skipping 20 matching lines...) Expand all
1014 DeterministicMockTCPClientSocket* socket = 1017 DeterministicMockTCPClientSocket* socket =
1015 new DeterministicMockTCPClientSocket(net_log, data_provider); 1018 new DeterministicMockTCPClientSocket(net_log, data_provider);
1016 data_provider->set_socket(socket->AsWeakPtr()); 1019 data_provider->set_socket(socket->AsWeakPtr());
1017 tcp_client_sockets().push_back(socket); 1020 tcp_client_sockets().push_back(socket);
1018 return socket; 1021 return socket;
1019 } 1022 }
1020 1023
1021 SSLClientSocket* DeterministicMockClientSocketFactory::CreateSSLClientSocket( 1024 SSLClientSocket* DeterministicMockClientSocketFactory::CreateSSLClientSocket(
1022 ClientSocketHandle* transport_socket, 1025 ClientSocketHandle* transport_socket,
1023 const std::string& hostname, 1026 const std::string& hostname,
1024 const SSLConfig& ssl_config) { 1027 const SSLConfig& ssl_config,
1028 SSLHostInfo* ssl_host_info) {
1025 MockSSLClientSocket* socket = 1029 MockSSLClientSocket* socket =
1026 new MockSSLClientSocket(transport_socket, hostname, ssl_config, 1030 new MockSSLClientSocket(transport_socket, hostname, ssl_config,
1027 mock_ssl_data_.GetNext()); 1031 ssl_host_info, mock_ssl_data_.GetNext());
1028 ssl_client_sockets_.push_back(socket); 1032 ssl_client_sockets_.push_back(socket);
1029 return socket; 1033 return socket;
1030 } 1034 }
1031 1035
1032 TestSocketRequest::TestSocketRequest( 1036 TestSocketRequest::TestSocketRequest(
1033 std::vector<TestSocketRequest*>* request_order, 1037 std::vector<TestSocketRequest*>* request_order,
1034 size_t* completion_count) 1038 size_t* completion_count)
1035 : request_order_(request_order), 1039 : request_order_(request_order),
1036 completion_count_(completion_count) { 1040 completion_count_(completion_count) {
1037 DCHECK(request_order); 1041 DCHECK(request_order);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 1232
1229 const char kSOCKS5OkRequest[] = 1233 const char kSOCKS5OkRequest[] =
1230 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; 1234 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 };
1231 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); 1235 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest);
1232 1236
1233 const char kSOCKS5OkResponse[] = 1237 const char kSOCKS5OkResponse[] =
1234 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; 1238 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 };
1235 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); 1239 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse);
1236 1240
1237 } // namespace net 1241 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/ssl_client_socket_nss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698