Index: chrome/browser/ssl/ssl_client_auth_requestor_mock.cc |
diff --git a/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc b/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc |
index 6f63c323818c94d2661f064abd2e91675e1f53c8..ef114b4821dcdd4d9def9fadd54e2f134fb792c9 100644 |
--- a/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc |
+++ b/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc |
@@ -4,9 +4,38 @@ |
#include "chrome/browser/ssl/ssl_client_auth_requestor_mock.h" |
+#include "base/macros.h" |
+#include "content/public/browser/client_certificate_delegate.h" |
#include "net/ssl/ssl_cert_request_info.h" |
#include "net/url_request/url_request.h" |
+namespace { |
+ |
+class FakeClientCertificateDelegate |
+ : public content::ClientCertificateDelegate { |
+ public: |
+ explicit FakeClientCertificateDelegate(SSLClientAuthRequestorMock* requestor) |
+ : requestor_(requestor) {} |
+ |
+ ~FakeClientCertificateDelegate() override { |
+ if (requestor_) |
+ requestor_->CancelCertificateSelection(); |
+ } |
+ |
+ // content::ClientCertificateDelegate implementation: |
+ void ContinueWithCertificate(net::X509Certificate* cert) override { |
+ requestor_->CertificateSelected(cert); |
+ requestor_ = nullptr; |
+ } |
+ |
+ private: |
+ scoped_refptr<SSLClientAuthRequestorMock> requestor_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FakeClientCertificateDelegate); |
+}; |
+ |
+} // namespace |
+ |
SSLClientAuthRequestorMock::SSLClientAuthRequestorMock( |
net::URLRequest* request, |
const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info) |
@@ -14,3 +43,8 @@ SSLClientAuthRequestorMock::SSLClientAuthRequestorMock( |
} |
SSLClientAuthRequestorMock::~SSLClientAuthRequestorMock() {} |
+ |
+scoped_ptr<content::ClientCertificateDelegate> |
+SSLClientAuthRequestorMock::CreateDelegate() { |
+ return make_scoped_ptr(new FakeClientCertificateDelegate(this)); |
+} |