1 // Copyright (c) 2015 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 "content/test/mock_ssl_host_state_delegate.h"
9 MockSSLHostStateDelegate::MockSSLHostStateDelegate() {}
11 MockSSLHostStateDelegate::~MockSSLHostStateDelegate() {}
13 void MockSSLHostStateDelegate::AllowCert(const std::string
& host
,
14 const net::X509Certificate
& cert
,
15 net::CertStatus error
) {
16 exceptions_
.insert(host
);
19 void MockSSLHostStateDelegate::Clear() {
23 SSLHostStateDelegate::CertJudgment
MockSSLHostStateDelegate::QueryPolicy(
24 const std::string
& host
,
25 const net::X509Certificate
& cert
,
26 net::CertStatus error
,
27 bool* expired_previous_decision
) {
28 if (exceptions_
.find(host
) == exceptions_
.end())
29 return SSLHostStateDelegate::DENIED
;
31 return SSLHostStateDelegate::ALLOWED
;
34 void MockSSLHostStateDelegate::HostRanInsecureContent(const std::string
& host
,
37 bool MockSSLHostStateDelegate::DidHostRunInsecureContent(
38 const std::string
& host
,
43 void MockSSLHostStateDelegate::RevokeUserAllowExceptions(
44 const std::string
& host
) {
45 exceptions_
.erase(exceptions_
.find(host
));
48 bool MockSSLHostStateDelegate::HasAllowException(
49 const std::string
& host
) const {
50 return exceptions_
.find(host
) != exceptions_
.end();
53 } // namespace content