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

Unified Diff: net/ssl/client_cert_identity_test_util.h

Issue 2898573002: Refactor client cert private key handling. (Closed)
Patch Set: rebase on https://codereview.chromium.org/2899083006/ Created 3 years, 7 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_identity_mac.cc ('k') | net/ssl/client_cert_identity_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/client_cert_identity_test_util.h
diff --git a/net/ssl/client_cert_identity_test_util.h b/net/ssl/client_cert_identity_test_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..e73cf56535a835bcca4f15ad5383439136c087ce
--- /dev/null
+++ b/net/ssl/client_cert_identity_test_util.h
@@ -0,0 +1,39 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_SSL_SSL_CLIENT_CERT_IDENTITY_TEST_UTIL_H_
+#define NET_SSL_SSL_CLIENT_CERT_IDENTITY_TEST_UTIL_H_
+
+#include "net/ssl/client_cert_identity.h"
+
+namespace net {
+
+// Simple ClientCertIdentity implementation for testing.
+// Note: this implementation of AcquirePrivateKey will always call the callback
+// synchronously.
+class FakeClientCertIdentity : public ClientCertIdentity {
+ public:
+ explicit FakeClientCertIdentity(scoped_refptr<X509Certificate> cert);
+ FakeClientCertIdentity(scoped_refptr<X509Certificate> cert,
+ scoped_refptr<SSLPrivateKey> key);
+ ~FakeClientCertIdentity() override;
+
+ // ClientCertIdentity implementation:
+ void AcquirePrivateKey(
+ const base::Callback<void(scoped_refptr<SSLPrivateKey>)>&
+ private_key_callback) override;
+#if defined(OS_MACOSX)
+ SecIdentityRef sec_identity_ref() const override;
+#endif
+
+ private:
+ scoped_refptr<SSLPrivateKey> key_;
+};
+
+ClientCertIdentityList FakeClientCertIdentityListFromCertificateList(
+ const CertificateList& certs);
+
+} // namespace net
+
+#endif // NET_SSL_SSL_CLIENT_CERT_IDENTITY_TEST_UTIL_H_
« no previous file with comments | « net/ssl/client_cert_identity_mac.cc ('k') | net/ssl/client_cert_identity_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698