| 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 "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 EXPECT_TRUE(sock->IsConnected()); | 2407 EXPECT_TRUE(sock->IsConnected()); |
| 2408 | 2408 |
| 2409 // When given option CERT_CHAIN_WRONG_ROOT, SpawnedTestServer will present | 2409 // When given option CERT_CHAIN_WRONG_ROOT, SpawnedTestServer will present |
| 2410 // certs from redundant-server-chain.pem. | 2410 // certs from redundant-server-chain.pem. |
| 2411 CertificateList server_certs = | 2411 CertificateList server_certs = |
| 2412 CreateCertificateListFromFile(GetTestCertsDirectory(), | 2412 CreateCertificateListFromFile(GetTestCertsDirectory(), |
| 2413 "redundant-server-chain.pem", | 2413 "redundant-server-chain.pem", |
| 2414 X509Certificate::FORMAT_AUTO); | 2414 X509Certificate::FORMAT_AUTO); |
| 2415 | 2415 |
| 2416 // Get the server certificate as received client side. | 2416 // Get the server certificate as received client side. |
| 2417 SSLInfo ssl_info; |
| 2418 sock->GetSSLInfo(&ssl_info); |
| 2417 scoped_refptr<X509Certificate> server_certificate = | 2419 scoped_refptr<X509Certificate> server_certificate = |
| 2418 sock->GetUnverifiedServerCertificateChain(); | 2420 ssl_info.unverified_server_cert; |
| 2419 | 2421 |
| 2420 // Get the intermediates as received client side. | 2422 // Get the intermediates as received client side. |
| 2421 const X509Certificate::OSCertHandles& server_intermediates = | 2423 const X509Certificate::OSCertHandles& server_intermediates = |
| 2422 server_certificate->GetIntermediateCertificates(); | 2424 server_certificate->GetIntermediateCertificates(); |
| 2423 | 2425 |
| 2424 // Check that the unverified server certificate chain is properly retrieved | 2426 // Check that the unverified server certificate chain is properly retrieved |
| 2425 // from the underlying ssl stack. | 2427 // from the underlying ssl stack. |
| 2426 ASSERT_EQ(4U, server_certs.size()); | 2428 ASSERT_EQ(4U, server_certs.size()); |
| 2427 | 2429 |
| 2428 EXPECT_TRUE(X509Certificate::IsSameOSCert( | 2430 EXPECT_TRUE(X509Certificate::IsSameOSCert( |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3094 ssl_config.channel_id_enabled = true; | 3096 ssl_config.channel_id_enabled = true; |
| 3095 | 3097 |
| 3096 int rv; | 3098 int rv; |
| 3097 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); | 3099 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); |
| 3098 | 3100 |
| 3099 EXPECT_EQ(ERR_UNEXPECTED, rv); | 3101 EXPECT_EQ(ERR_UNEXPECTED, rv); |
| 3100 EXPECT_FALSE(sock_->IsConnected()); | 3102 EXPECT_FALSE(sock_->IsConnected()); |
| 3101 } | 3103 } |
| 3102 | 3104 |
| 3103 } // namespace net | 3105 } // namespace net |
| OLD | NEW |