| Index: net/ssl/client_cert_identity_test_util.cc
|
| diff --git a/net/ssl/client_cert_identity_test_util.cc b/net/ssl/client_cert_identity_test_util.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0156a191555b67bc06e79be0e270f28deb49a441
|
| --- /dev/null
|
| +++ b/net/ssl/client_cert_identity_test_util.cc
|
| @@ -0,0 +1,45 @@
|
| +// 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.
|
| +
|
| +#include "net/ssl/client_cert_identity_test_util.h"
|
| +
|
| +#include "base/memory/ptr_util.h"
|
| +#include "net/ssl/ssl_private_key.h"
|
| +
|
| +namespace net {
|
| +
|
| +FakeClientCertIdentity::FakeClientCertIdentity(
|
| + scoped_refptr<X509Certificate> cert)
|
| + : ClientCertIdentity(std::move(cert)) {}
|
| +
|
| +FakeClientCertIdentity::FakeClientCertIdentity(
|
| + scoped_refptr<X509Certificate> cert,
|
| + scoped_refptr<SSLPrivateKey> key)
|
| + : ClientCertIdentity(std::move(cert)), key_(std::move(key)) {}
|
| +
|
| +FakeClientCertIdentity::~FakeClientCertIdentity() = default;
|
| +
|
| +void FakeClientCertIdentity::AcquirePrivateKey(
|
| + const base::Callback<void(scoped_refptr<SSLPrivateKey>)>&
|
| + private_key_callback) {
|
| + private_key_callback.Run(key_);
|
| +}
|
| +
|
| +#if defined(OS_MACOSX)
|
| +SecIdentityRef FakeClientCertIdentity::sec_identity_ref() const {
|
| + NOTREACHED();
|
| + return nullptr;
|
| +}
|
| +#endif
|
| +
|
| +ClientCertIdentityList FakeClientCertIdentityListFromCertificateList(
|
| + const CertificateList& certs) {
|
| + ClientCertIdentityList result;
|
| + for (const auto& cert : certs) {
|
| + result.push_back(base::MakeUnique<FakeClientCertIdentity>(cert));
|
| + }
|
| + return result;
|
| +}
|
| +
|
| +} // namespace net
|
|
|