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/ssl_client_socket.h" | 5 #include "net/socket/ssl_client_socket.h" |
6 | 6 |
7 #include "net/base/address_list.h" | 7 #include "net/base/address_list.h" |
8 #include "net/base/cert_test_util.h" | 8 #include "net/base/cert_test_util.h" |
9 #include "net/base/cert_verifier.h" | 9 #include "net/base/cert_verifier.h" |
10 #include "net/base/host_resolver.h" | 10 #include "net/base/host_resolver.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "testing/platform_test.h" | 24 #include "testing/platform_test.h" |
25 | 25 |
26 //----------------------------------------------------------------------------- | 26 //----------------------------------------------------------------------------- |
27 | 27 |
28 const net::SSLConfig kDefaultSSLConfig; | 28 const net::SSLConfig kDefaultSSLConfig; |
29 | 29 |
30 class SSLClientSocketTest : public PlatformTest { | 30 class SSLClientSocketTest : public PlatformTest { |
31 public: | 31 public: |
32 SSLClientSocketTest() | 32 SSLClientSocketTest() |
33 : socket_factory_(net::ClientSocketFactory::GetDefaultFactory()), | 33 : socket_factory_(net::ClientSocketFactory::GetDefaultFactory()), |
34 cert_verifier_(new net::CertVerifier) { | 34 cert_verifier_(net::CertVerifier::CreateDefault()) { |
35 } | 35 } |
36 | 36 |
37 protected: | 37 protected: |
38 net::SSLClientSocket* CreateSSLClientSocket( | 38 net::SSLClientSocket* CreateSSLClientSocket( |
39 net::StreamSocket* transport_socket, | 39 net::StreamSocket* transport_socket, |
40 const net::HostPortPair& host_and_port, | 40 const net::HostPortPair& host_and_port, |
41 const net::SSLConfig& ssl_config) { | 41 const net::SSLConfig& ssl_config) { |
42 net::SSLClientSocketContext context; | 42 net::SSLClientSocketContext context; |
43 context.cert_verifier = cert_verifier_.get(); | 43 context.cert_verifier = cert_verifier_.get(); |
44 return socket_factory_->CreateSSLClientSocket(transport_socket, | 44 return socket_factory_->CreateSSLClientSocket(transport_socket, |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 ssl_info.cert->os_cert_handle(), certs[0]->os_cert_handle())); | 925 ssl_info.cert->os_cert_handle(), certs[0]->os_cert_handle())); |
926 EXPECT_TRUE(net::X509Certificate::IsSameOSCert( | 926 EXPECT_TRUE(net::X509Certificate::IsSameOSCert( |
927 intermediates[0], certs[1]->os_cert_handle())); | 927 intermediates[0], certs[1]->os_cert_handle())); |
928 EXPECT_TRUE(net::X509Certificate::IsSameOSCert( | 928 EXPECT_TRUE(net::X509Certificate::IsSameOSCert( |
929 intermediates[1], certs[2]->os_cert_handle())); | 929 intermediates[1], certs[2]->os_cert_handle())); |
930 | 930 |
931 sock->Disconnect(); | 931 sock->Disconnect(); |
932 EXPECT_FALSE(sock->IsConnected()); | 932 EXPECT_FALSE(sock->IsConnected()); |
933 } | 933 } |
934 | 934 |
OLD | NEW |