| Index: net/ssl/client_cert_store_nss_unittest.cc
|
| diff --git a/net/ssl/client_cert_store_nss_unittest.cc b/net/ssl/client_cert_store_nss_unittest.cc
|
| index 8bfae5313f81bdb3d5e3b47baf89a6224f73d49b..28cb77105a8d0d066ec0c668406857f4d84f69b8 100644
|
| --- a/net/ssl/client_cert_store_nss_unittest.cc
|
| +++ b/net/ssl/client_cert_store_nss_unittest.cc
|
| @@ -12,10 +12,12 @@
|
| #include <string>
|
|
|
| #include "base/bind.h"
|
| +#include "base/memory/ptr_util.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/run_loop.h"
|
| #include "crypto/scoped_test_nss_db.h"
|
| #include "net/cert/x509_certificate.h"
|
| +#include "net/ssl/client_cert_identity_test_util.h"
|
| #include "net/ssl/client_cert_store_unittest-inl.h"
|
| #include "net/ssl/ssl_cert_request_info.h"
|
| #include "net/test/cert_test_util.h"
|
| @@ -25,9 +27,9 @@ namespace net {
|
|
|
| namespace {
|
|
|
| -void SaveCertsAndQuitCallback(CertificateList* out_certs,
|
| +void SaveCertsAndQuitCallback(ClientCertIdentityList* out_certs,
|
| base::Closure quit_closure,
|
| - CertificateList in_certs) {
|
| + ClientCertIdentityList in_certs) {
|
| *out_certs = std::move(in_certs);
|
| quit_closure.Run();
|
| }
|
| @@ -40,11 +42,14 @@ class ClientCertStoreNSSTestDelegate {
|
|
|
| bool SelectClientCerts(const CertificateList& input_certs,
|
| const SSLCertRequestInfo& cert_request_info,
|
| - CertificateList* selected_certs) {
|
| - // Filters |input_certs| using the logic being used to filter the system
|
| + ClientCertIdentityList* selected_certs) {
|
| + for (const auto& cert : input_certs)
|
| + selected_certs->push_back(base::MakeUnique<FakeClientCertIdentity>(cert));
|
| +
|
| + // Filters |selected_certs| using the logic being used to filter the system
|
| // store when GetClientCerts() is called.
|
| - ClientCertStoreNSS::FilterCertsOnWorkerThread(
|
| - input_certs, cert_request_info, selected_certs);
|
| + ClientCertStoreNSS::FilterCertsOnWorkerThread(selected_certs,
|
| + cert_request_info);
|
| return true;
|
| }
|
| };
|
| @@ -78,7 +83,7 @@ TEST(ClientCertStoreNSSTest, BuildsCertificateChain) {
|
| request->cert_authorities.push_back(std::string(
|
| reinterpret_cast<const char*>(kAuthority1DN), sizeof(kAuthority1DN)));
|
|
|
| - CertificateList selected_certs;
|
| + ClientCertIdentityList selected_certs;
|
| base::RunLoop loop;
|
| store->GetClientCerts(*request.get(),
|
| base::Bind(SaveCertsAndQuitCallback, &selected_certs,
|
| @@ -87,7 +92,8 @@ TEST(ClientCertStoreNSSTest, BuildsCertificateChain) {
|
|
|
| // The result be |client_1| with no intermediates.
|
| ASSERT_EQ(1u, selected_certs.size());
|
| - scoped_refptr<X509Certificate> selected_cert = selected_certs[0];
|
| + scoped_refptr<X509Certificate> selected_cert =
|
| + selected_certs[0]->certificate();
|
| EXPECT_TRUE(X509Certificate::IsSameOSCert(client_1->os_cert_handle(),
|
| selected_cert->os_cert_handle()));
|
| ASSERT_EQ(0u, selected_cert->GetIntermediateCertificates().size());
|
| @@ -100,7 +106,7 @@ TEST(ClientCertStoreNSSTest, BuildsCertificateChain) {
|
| std::string(reinterpret_cast<const char*>(kAuthorityRootDN),
|
| sizeof(kAuthorityRootDN)));
|
|
|
| - CertificateList selected_certs;
|
| + ClientCertIdentityList selected_certs;
|
| base::RunLoop loop;
|
| store->GetClientCerts(*request.get(),
|
| base::Bind(SaveCertsAndQuitCallback, &selected_certs,
|
| @@ -109,7 +115,8 @@ TEST(ClientCertStoreNSSTest, BuildsCertificateChain) {
|
|
|
| // The result be |client_1| with |client_1_ca| as an intermediate.
|
| ASSERT_EQ(1u, selected_certs.size());
|
| - scoped_refptr<X509Certificate> selected_cert = selected_certs[0];
|
| + scoped_refptr<X509Certificate> selected_cert =
|
| + selected_certs[0]->certificate();
|
| EXPECT_TRUE(X509Certificate::IsSameOSCert(client_1->os_cert_handle(),
|
| selected_cert->os_cert_handle()));
|
| ASSERT_EQ(1u, selected_cert->GetIntermediateCertificates().size());
|
|
|