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

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

Issue 14813024: Introduce RequestWebSocketStream into HttpStreamFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 6 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
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 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 SSLSocketDataProvider* data) 1278 SSLSocketDataProvider* data)
1279 : MockClientSocket( 1279 : MockClientSocket(
1280 // Have to use the right BoundNetLog for LoadTimingInfo regression 1280 // Have to use the right BoundNetLog for LoadTimingInfo regression
1281 // tests. 1281 // tests.
1282 transport_socket->socket()->NetLog()), 1282 transport_socket->socket()->NetLog()),
1283 transport_(transport_socket), 1283 transport_(transport_socket),
1284 data_(data), 1284 data_(data),
1285 is_npn_state_set_(false), 1285 is_npn_state_set_(false),
1286 new_npn_value_(false), 1286 new_npn_value_(false),
1287 is_protocol_negotiated_set_(false), 1287 is_protocol_negotiated_set_(false),
1288 was_spdy_negotiated_(false),
1289 was_spdy_negotiated_set_(false),
1288 protocol_negotiated_(kProtoUnknown) { 1290 protocol_negotiated_(kProtoUnknown) {
1289 DCHECK(data_); 1291 DCHECK(data_);
1290 peer_addr_ = data->connect.peer_addr; 1292 peer_addr_ = data->connect.peer_addr;
1291 } 1293 }
1292 1294
1293 MockSSLClientSocket::~MockSSLClientSocket() { 1295 MockSSLClientSocket::~MockSSLClientSocket() {
1294 Disconnect(); 1296 Disconnect();
1295 } 1297 }
1296 1298
1297 int MockSSLClientSocket::Read(IOBuffer* buf, int buf_len, 1299 int MockSSLClientSocket::Read(IOBuffer* buf, int buf_len,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 } 1344 }
1343 1345
1344 bool MockSSLClientSocket::GetSSLInfo(SSLInfo* ssl_info) { 1346 bool MockSSLClientSocket::GetSSLInfo(SSLInfo* ssl_info) {
1345 ssl_info->Reset(); 1347 ssl_info->Reset();
1346 ssl_info->cert = data_->cert; 1348 ssl_info->cert = data_->cert;
1347 ssl_info->client_cert_sent = data_->client_cert_sent; 1349 ssl_info->client_cert_sent = data_->client_cert_sent;
1348 ssl_info->channel_id_sent = data_->channel_id_sent; 1350 ssl_info->channel_id_sent = data_->channel_id_sent;
1349 return true; 1351 return true;
1350 } 1352 }
1351 1353
1354 bool MockSSLClientSocket::was_spdy_negotiated() const {
mmenke 2013/06/03 21:10:18 This should be WasSpdyNegotiated, since it's not a
yhirano 2013/06/04 02:20:13 Since it is a derived function, I have no choice (
1355 if (was_spdy_negotiated_set_)
1356 return was_spdy_negotiated_;
1357 return
1358 WasNpnNegotiated() &&
mmenke 2013/06/03 21:10:18 nit: Suggest putting this on the previous line (r
yhirano 2013/06/04 02:20:13 Done.
1359 kProtoSPDYMinimumVersion <= GetNegotiatedProtocol() &&
1360 GetNegotiatedProtocol() <= kProtoSPDYMaximumVersion;
mmenke 2013/06/03 21:10:18 I find this confusing - since we have set_was_spdy
yhirano 2013/06/04 02:20:13 Done.
1361 }
1362
1363 bool MockSSLClientSocket::set_was_spdy_negotiated(bool negotiated) {
mmenke 2013/06/03 21:10:18 It's my understanding that, according to the Googl
yhirano 2013/06/04 02:20:13 Moving the implementation into the header causes a
mmenke 2013/06/05 00:01:20 Sorry, didn't notice they were virtual. I may fix
1364 was_spdy_negotiated_set_ = true;
1365 was_spdy_negotiated_ = negotiated;
1366 return was_spdy_negotiated_;
1367 }
1368
1352 void MockSSLClientSocket::GetSSLCertRequestInfo( 1369 void MockSSLClientSocket::GetSSLCertRequestInfo(
1353 SSLCertRequestInfo* cert_request_info) { 1370 SSLCertRequestInfo* cert_request_info) {
1354 DCHECK(cert_request_info); 1371 DCHECK(cert_request_info);
1355 if (data_->cert_request_info) { 1372 if (data_->cert_request_info) {
1356 cert_request_info->host_and_port = 1373 cert_request_info->host_and_port =
1357 data_->cert_request_info->host_and_port; 1374 data_->cert_request_info->host_and_port;
1358 cert_request_info->client_certs = data_->cert_request_info->client_certs; 1375 cert_request_info->client_certs = data_->cert_request_info->client_certs;
1359 } else { 1376 } else {
1360 cert_request_info->Reset(); 1377 cert_request_info->Reset();
1361 } 1378 }
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 1865
1849 const char kSOCKS5OkRequest[] = 1866 const char kSOCKS5OkRequest[] =
1850 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; 1867 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 };
1851 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); 1868 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest);
1852 1869
1853 const char kSOCKS5OkResponse[] = 1870 const char kSOCKS5OkResponse[] =
1854 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; 1871 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 };
1855 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); 1872 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse);
1856 1873
1857 } // namespace net 1874 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698