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

Unified Diff: net/ssl/client_cert_store_mac_unittest.cc

Issue 2898573002: Refactor client cert private key handling. (Closed)
Patch Set: removed no longer needed forward declaration Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ssl/client_cert_store_mac.cc ('k') | net/ssl/client_cert_store_nss.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/client_cert_store_mac_unittest.cc
diff --git a/net/ssl/client_cert_store_mac_unittest.cc b/net/ssl/client_cert_store_mac_unittest.cc
index 6dc9279950aa43180e6ad81f369c6c9b704f84ef..1243e1e1827a994d742678a8e6d03e0c514ca938 100644
--- a/net/ssl/client_cert_store_mac_unittest.cc
+++ b/net/ssl/client_cert_store_mac_unittest.cc
@@ -4,7 +4,10 @@
#include "net/ssl/client_cert_store_mac.h"
+#include "base/memory/ptr_util.h"
+#include "net/ssl/client_cert_identity_test_util.h"
#include "net/ssl/client_cert_store_unittest-inl.h"
+#include "net/ssl/ssl_private_key.h"
namespace net {
@@ -12,9 +15,10 @@ class ClientCertStoreMacTestDelegate {
public:
bool SelectClientCerts(const CertificateList& input_certs,
const SSLCertRequestInfo& cert_request_info,
- CertificateList* selected_certs) {
+ ClientCertIdentityList* selected_certs) {
return store_.SelectClientCertsForTesting(
- input_certs, cert_request_info, selected_certs);
+ FakeClientCertIdentityListFromCertificateList(input_certs),
+ cert_request_info, selected_certs);
}
private:
@@ -31,9 +35,14 @@ class ClientCertStoreMacTest : public ::testing::Test {
const scoped_refptr<X509Certificate>& preferred_cert,
const CertificateList& regular_certs,
const SSLCertRequestInfo& request,
- CertificateList* selected_certs) {
+ ClientCertIdentityList* selected_certs) {
+ std::unique_ptr<ClientCertIdentity> preferred_identity(
+ base::MakeUnique<FakeClientCertIdentity>(preferred_cert, nullptr));
+
return store_.SelectClientCertsGivenPreferredForTesting(
- preferred_cert, regular_certs, request, selected_certs);
+ std::move(preferred_identity),
+ FakeClientCertIdentityListFromCertificateList(regular_certs), request,
+ selected_certs);
}
private:
@@ -56,7 +65,7 @@ TEST_F(ClientCertStoreMacTest, FilterOutThePreferredCert) {
scoped_refptr<SSLCertRequestInfo> request(new SSLCertRequestInfo());
request->cert_authorities = authority_2;
- std::vector<scoped_refptr<X509Certificate> > selected_certs;
+ ClientCertIdentityList selected_certs;
bool rv = SelectClientCertsGivenPreferred(
cert_1, certs, *request.get(), &selected_certs);
EXPECT_TRUE(rv);
@@ -77,13 +86,13 @@ TEST_F(ClientCertStoreMacTest, PreferredCertGoesFirst) {
certs.push_back(cert_2);
scoped_refptr<SSLCertRequestInfo> request(new SSLCertRequestInfo());
- std::vector<scoped_refptr<X509Certificate> > selected_certs;
+ ClientCertIdentityList selected_certs;
bool rv = SelectClientCertsGivenPreferred(
cert_1, certs, *request.get(), &selected_certs);
EXPECT_TRUE(rv);
ASSERT_EQ(2u, selected_certs.size());
- EXPECT_TRUE(selected_certs[0]->Equals(cert_1.get()));
- EXPECT_TRUE(selected_certs[1]->Equals(cert_2.get()));
+ EXPECT_TRUE(selected_certs[0]->certificate()->Equals(cert_1.get()));
+ EXPECT_TRUE(selected_certs[1]->certificate()->Equals(cert_2.get()));
}
} // namespace net
« no previous file with comments | « net/ssl/client_cert_store_mac.cc ('k') | net/ssl/client_cert_store_nss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698