| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "net/ssl/client_cert_identity_test_util.h" |
| 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 #include "net/ssl/ssl_private_key.h" |
| 9 |
| 10 namespace net { |
| 11 |
| 12 FakeClientCertIdentity::FakeClientCertIdentity( |
| 13 scoped_refptr<X509Certificate> cert) |
| 14 : ClientCertIdentity(std::move(cert)) {} |
| 15 |
| 16 FakeClientCertIdentity::FakeClientCertIdentity( |
| 17 scoped_refptr<X509Certificate> cert, |
| 18 scoped_refptr<SSLPrivateKey> key) |
| 19 : ClientCertIdentity(std::move(cert)), key_(std::move(key)) {} |
| 20 |
| 21 FakeClientCertIdentity::~FakeClientCertIdentity() = default; |
| 22 |
| 23 void FakeClientCertIdentity::AcquirePrivateKey( |
| 24 const base::Callback<void(scoped_refptr<SSLPrivateKey>)>& |
| 25 private_key_callback) { |
| 26 private_key_callback.Run(key_); |
| 27 } |
| 28 |
| 29 #if defined(OS_MACOSX) |
| 30 SecIdentityRef FakeClientCertIdentity::sec_identity_ref() const { |
| 31 NOTREACHED(); |
| 32 return nullptr; |
| 33 } |
| 34 #endif |
| 35 |
| 36 ClientCertIdentityList FakeClientCertIdentityListFromCertificateList( |
| 37 const CertificateList& certs) { |
| 38 ClientCertIdentityList result; |
| 39 for (const auto& cert : certs) { |
| 40 result.push_back(base::MakeUnique<FakeClientCertIdentity>(cert)); |
| 41 } |
| 42 return result; |
| 43 } |
| 44 |
| 45 } // namespace net |
| OLD | NEW |