OLD | NEW |
---|---|
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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "net/base/address_family.h" | 15 #include "net/base/address_family.h" |
16 #include "net/base/auth.h" | 16 #include "net/base/auth.h" |
17 #include "net/base/host_resolver_proc.h" | 17 #include "net/base/host_resolver_proc.h" |
18 #include "net/base/ssl_info.h" | 18 #include "net/base/ssl_info.h" |
19 #include "net/base/ssl_cert_request_info.h" | |
wtc
2011/01/10 23:40:58
Nit: list "net/base/ssl_cert_request_info.h" befor
| |
19 #include "net/http/http_network_session.h" | 20 #include "net/http/http_network_session.h" |
20 #include "net/http/http_request_headers.h" | 21 #include "net/http/http_request_headers.h" |
21 #include "net/http/http_response_headers.h" | 22 #include "net/http/http_response_headers.h" |
22 #include "net/socket/client_socket_pool_histograms.h" | 23 #include "net/socket/client_socket_pool_histograms.h" |
23 #include "net/socket/socket.h" | 24 #include "net/socket/socket.h" |
24 #include "net/socket/ssl_host_info.h" | 25 #include "net/socket/ssl_host_info.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
26 | 27 |
27 #define NET_TRACE(level, s) DLOG(level) << s << __FUNCTION__ << "() " | 28 #define NET_TRACE(level, s) DLOG(level) << s << __FUNCTION__ << "() " |
28 | 29 |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
524 | 525 |
525 int MockSSLClientSocket::Write(net::IOBuffer* buf, int buf_len, | 526 int MockSSLClientSocket::Write(net::IOBuffer* buf, int buf_len, |
526 net::CompletionCallback* callback) { | 527 net::CompletionCallback* callback) { |
527 return transport_->socket()->Write(buf, buf_len, callback); | 528 return transport_->socket()->Write(buf, buf_len, callback); |
528 } | 529 } |
529 | 530 |
530 void MockSSLClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) { | 531 void MockSSLClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) { |
531 ssl_info->Reset(); | 532 ssl_info->Reset(); |
532 } | 533 } |
533 | 534 |
535 void MockSSLClientSocket::GetSSLCertRequestInfo( | |
536 net::SSLCertRequestInfo* cert_request_info) { | |
537 DCHECK(cert_request_info); | |
538 if (data_->cert_request_info) { | |
539 cert_request_info->host_and_port = | |
540 data_->cert_request_info->host_and_port; | |
541 cert_request_info->client_certs = | |
542 data_->cert_request_info->client_certs; | |
543 } else { | |
544 cert_request_info->host_and_port.clear(); | |
545 cert_request_info->client_certs.clear(); | |
wtc
2011/01/10 23:40:58
It's better to add a Reset() method to SSLCertRequ
| |
546 } | |
547 } | |
548 | |
534 SSLClientSocket::NextProtoStatus MockSSLClientSocket::GetNextProto( | 549 SSLClientSocket::NextProtoStatus MockSSLClientSocket::GetNextProto( |
535 std::string* proto) { | 550 std::string* proto) { |
536 *proto = data_->next_proto; | 551 *proto = data_->next_proto; |
537 return data_->next_proto_status; | 552 return data_->next_proto_status; |
538 } | 553 } |
539 | 554 |
540 bool MockSSLClientSocket::was_npn_negotiated() const { | 555 bool MockSSLClientSocket::was_npn_negotiated() const { |
541 if (is_npn_state_set_) | 556 if (is_npn_state_set_) |
542 return new_npn_value_; | 557 return new_npn_value_; |
543 return data_->was_npn_negotiated; | 558 return data_->was_npn_negotiated; |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1277 | 1292 |
1278 const char kSOCKS5OkRequest[] = | 1293 const char kSOCKS5OkRequest[] = |
1279 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; | 1294 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; |
1280 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); | 1295 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); |
1281 | 1296 |
1282 const char kSOCKS5OkResponse[] = | 1297 const char kSOCKS5OkResponse[] = |
1283 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; | 1298 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; |
1284 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); | 1299 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); |
1285 | 1300 |
1286 } // namespace net | 1301 } // namespace net |
OLD | NEW |