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

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

Issue 9959033: Move NextProto enum to a new file net/socket/next_proto.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address wtc's comments Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/socks_client_socket.cc » ('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) 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 if (!allow_unconsumed_reads_) { 232 if (!allow_unconsumed_reads_) {
233 EXPECT_TRUE(reads_.empty()) << "Unconsumed read: " << reads_.front().data; 233 EXPECT_TRUE(reads_.empty()) << "Unconsumed read: " << reads_.front().data;
234 } 234 }
235 reads_.push_back(MockRead(ASYNC, data, length)); 235 reads_.push_back(MockRead(ASYNC, data, length));
236 } 236 }
237 237
238 SSLSocketDataProvider::SSLSocketDataProvider(IoMode mode, int result) 238 SSLSocketDataProvider::SSLSocketDataProvider(IoMode mode, int result)
239 : connect(mode, result), 239 : connect(mode, result),
240 next_proto_status(SSLClientSocket::kNextProtoUnsupported), 240 next_proto_status(SSLClientSocket::kNextProtoUnsupported),
241 was_npn_negotiated(false), 241 was_npn_negotiated(false),
242 protocol_negotiated(SSLClientSocket::kProtoUnknown), 242 protocol_negotiated(kProtoUnknown),
243 client_cert_sent(false), 243 client_cert_sent(false),
244 cert_request_info(NULL), 244 cert_request_info(NULL),
245 domain_bound_cert_type(CLIENT_CERT_INVALID_TYPE) { 245 domain_bound_cert_type(CLIENT_CERT_INVALID_TYPE) {
246 } 246 }
247 247
248 SSLSocketDataProvider::~SSLSocketDataProvider() { 248 SSLSocketDataProvider::~SSLSocketDataProvider() {
249 } 249 }
250 250
251 void SSLSocketDataProvider::SetNextProto(SSLClientSocket::NextProto proto) { 251 void SSLSocketDataProvider::SetNextProto(NextProto proto) {
252 was_npn_negotiated = true; 252 was_npn_negotiated = true;
253 next_proto_status = SSLClientSocket::kNextProtoNegotiated; 253 next_proto_status = SSLClientSocket::kNextProtoNegotiated;
254 protocol_negotiated = proto; 254 protocol_negotiated = proto;
255 next_proto = SSLClientSocket::NextProtoToString(proto); 255 next_proto = SSLClientSocket::NextProtoToString(proto);
256 } 256 }
257 257
258 DelayedSocketData::DelayedSocketData( 258 DelayedSocketData::DelayedSocketData(
259 int write_delay, MockRead* reads, size_t reads_count, 259 int write_delay, MockRead* reads, size_t reads_count,
260 MockWrite* writes, size_t writes_count) 260 MockWrite* writes, size_t writes_count)
261 : StaticSocketDataProvider(reads, reads_count, writes, writes_count), 261 : StaticSocketDataProvider(reads, reads_count, writes, writes_count),
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 const HostPortPair& host_port_pair, 1062 const HostPortPair& host_port_pair,
1063 const SSLConfig& ssl_config, 1063 const SSLConfig& ssl_config,
1064 SSLHostInfo* ssl_host_info, 1064 SSLHostInfo* ssl_host_info,
1065 SSLSocketDataProvider* data) 1065 SSLSocketDataProvider* data)
1066 : MockClientSocket(transport_socket->socket()->NetLog().net_log()), 1066 : MockClientSocket(transport_socket->socket()->NetLog().net_log()),
1067 transport_(transport_socket), 1067 transport_(transport_socket),
1068 data_(data), 1068 data_(data),
1069 is_npn_state_set_(false), 1069 is_npn_state_set_(false),
1070 new_npn_value_(false), 1070 new_npn_value_(false),
1071 is_protocol_negotiated_set_(false), 1071 is_protocol_negotiated_set_(false),
1072 protocol_negotiated_(SSLClientSocket::kProtoUnknown) { 1072 protocol_negotiated_(kProtoUnknown) {
1073 DCHECK(data_); 1073 DCHECK(data_);
1074 delete ssl_host_info; // we take ownership but don't use it. 1074 delete ssl_host_info; // we take ownership but don't use it.
1075 } 1075 }
1076 1076
1077 MockSSLClientSocket::~MockSSLClientSocket() { 1077 MockSSLClientSocket::~MockSSLClientSocket() {
1078 Disconnect(); 1078 Disconnect();
1079 } 1079 }
1080 1080
1081 int MockSSLClientSocket::Read(IOBuffer* buf, int buf_len, 1081 int MockSSLClientSocket::Read(IOBuffer* buf, int buf_len,
1082 const CompletionCallback& callback) { 1082 const CompletionCallback& callback) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 if (is_npn_state_set_) 1159 if (is_npn_state_set_)
1160 return new_npn_value_; 1160 return new_npn_value_;
1161 return data_->was_npn_negotiated; 1161 return data_->was_npn_negotiated;
1162 } 1162 }
1163 1163
1164 bool MockSSLClientSocket::set_was_npn_negotiated(bool negotiated) { 1164 bool MockSSLClientSocket::set_was_npn_negotiated(bool negotiated) {
1165 is_npn_state_set_ = true; 1165 is_npn_state_set_ = true;
1166 return new_npn_value_ = negotiated; 1166 return new_npn_value_ = negotiated;
1167 } 1167 }
1168 1168
1169 SSLClientSocket::NextProto MockSSLClientSocket::protocol_negotiated() const { 1169 NextProto MockSSLClientSocket::protocol_negotiated() const {
1170 if (is_protocol_negotiated_set_) 1170 if (is_protocol_negotiated_set_)
1171 return protocol_negotiated_; 1171 return protocol_negotiated_;
1172 return data_->protocol_negotiated; 1172 return data_->protocol_negotiated;
1173 } 1173 }
1174 1174
1175 void MockSSLClientSocket::set_protocol_negotiated( 1175 void MockSSLClientSocket::set_protocol_negotiated(
1176 SSLClientSocket::NextProto protocol_negotiated) { 1176 NextProto protocol_negotiated) {
1177 is_protocol_negotiated_set_ = true; 1177 is_protocol_negotiated_set_ = true;
1178 protocol_negotiated_ = protocol_negotiated; 1178 protocol_negotiated_ = protocol_negotiated;
1179 } 1179 }
1180 1180
1181 bool MockSSLClientSocket::WasDomainBoundCertSent() const { 1181 bool MockSSLClientSocket::WasDomainBoundCertSent() const {
1182 return data_->domain_bound_cert_type != CLIENT_CERT_INVALID_TYPE; 1182 return data_->domain_bound_cert_type != CLIENT_CERT_INVALID_TYPE;
1183 } 1183 }
1184 1184
1185 SSLClientCertType MockSSLClientSocket::domain_bound_cert_type() const { 1185 SSLClientCertType MockSSLClientSocket::domain_bound_cert_type() const {
1186 return data_->domain_bound_cert_type; 1186 return data_->domain_bound_cert_type;
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 1620
1621 const char kSOCKS5OkRequest[] = 1621 const char kSOCKS5OkRequest[] =
1622 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; 1622 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 };
1623 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); 1623 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest);
1624 1624
1625 const char kSOCKS5OkResponse[] = 1625 const char kSOCKS5OkResponse[] =
1626 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; 1626 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 };
1627 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); 1627 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse);
1628 1628
1629 } // namespace net 1629 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/socks_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698