Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / ssl / ssl_client_auth_requestor_mock.cc
blobef114b4821dcdd4d9def9fadd54e2f134fb792c9
1 // Copyright (c) 2012 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.
5 #include "chrome/browser/ssl/ssl_client_auth_requestor_mock.h"
7 #include "base/macros.h"
8 #include "content/public/browser/client_certificate_delegate.h"
9 #include "net/ssl/ssl_cert_request_info.h"
10 #include "net/url_request/url_request.h"
12 namespace {
14 class FakeClientCertificateDelegate
15 : public content::ClientCertificateDelegate {
16 public:
17 explicit FakeClientCertificateDelegate(SSLClientAuthRequestorMock* requestor)
18 : requestor_(requestor) {}
20 ~FakeClientCertificateDelegate() override {
21 if (requestor_)
22 requestor_->CancelCertificateSelection();
25 // content::ClientCertificateDelegate implementation:
26 void ContinueWithCertificate(net::X509Certificate* cert) override {
27 requestor_->CertificateSelected(cert);
28 requestor_ = nullptr;
31 private:
32 scoped_refptr<SSLClientAuthRequestorMock> requestor_;
34 DISALLOW_COPY_AND_ASSIGN(FakeClientCertificateDelegate);
37 } // namespace
39 SSLClientAuthRequestorMock::SSLClientAuthRequestorMock(
40 net::URLRequest* request,
41 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info)
42 : cert_request_info_(cert_request_info) {
45 SSLClientAuthRequestorMock::~SSLClientAuthRequestorMock() {}
47 scoped_ptr<content::ClientCertificateDelegate>
48 SSLClientAuthRequestorMock::CreateDelegate() {
49 return make_scoped_ptr(new FakeClientCertificateDelegate(this));