Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / test / mock_ssl_host_state_delegate.cc
blobdaded7e8c7fa2aeda5a451154982c1376d38916d
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"
7 namespace content {
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() {
20 exceptions_.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,
35 int pid) {}
37 bool MockSSLHostStateDelegate::DidHostRunInsecureContent(
38 const std::string& host,
39 int pid) const {
40 return false;
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