#include "net/cert/mock_cert_verifier.h"
#include <memory>
#include <utility>
#include "base/callback_list.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/pattern.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
#include "net/base/net_errors.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/cert_verify_result.h"
#include "net/cert/x509_certificate.h"
namespace net {
namespace {
CertStatus MapNetErrorToCertStatus(int error) { … }
}
struct MockCertVerifier::Rule { … };
class MockCertVerifier::MockRequest : public CertVerifier::Request { … };
MockCertVerifier::MockCertVerifier() = default;
MockCertVerifier::~MockCertVerifier() { … }
int MockCertVerifier::Verify(const RequestParams& params,
CertVerifyResult* verify_result,
CompletionOnceCallback callback,
std::unique_ptr<Request>* out_req,
const NetLogWithSource& net_log) { … }
void MockCertVerifier::AddObserver(Observer* observer) { … }
void MockCertVerifier::RemoveObserver(Observer* observer) { … }
void MockCertVerifier::AddResultForCert(scoped_refptr<X509Certificate> cert,
const CertVerifyResult& verify_result,
int rv) { … }
void MockCertVerifier::AddResultForCertAndHost(
scoped_refptr<X509Certificate> cert,
const std::string& host_pattern,
const CertVerifyResult& verify_result,
int rv) { … }
void MockCertVerifier::ClearRules() { … }
void MockCertVerifier::SimulateOnCertVerifierChanged() { … }
int MockCertVerifier::VerifyImpl(const RequestParams& params,
CertVerifyResult* verify_result) { … }
ParamRecordingMockCertVerifier::ParamRecordingMockCertVerifier() = default;
ParamRecordingMockCertVerifier::~ParamRecordingMockCertVerifier() = default;
int ParamRecordingMockCertVerifier::Verify(const RequestParams& params,
CertVerifyResult* verify_result,
CompletionOnceCallback callback,
std::unique_ptr<Request>* out_req,
const NetLogWithSource& net_log) { … }
CertVerifierObserverCounter::CertVerifierObserverCounter(
CertVerifier* verifier) { … }
CertVerifierObserverCounter::~CertVerifierObserverCounter() = default;
void CertVerifierObserverCounter::OnCertVerifierChanged() { … }
}