chromium/services/network/ignore_errors_cert_verifier_unittest.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "services/network/ignore_errors_cert_verifier.h"

#include <string_view>

#include "base/base64.h"
#include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_util.h"
#include "crypto/sha2.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/cert/asn1_util.h"
#include "net/cert/mock_cert_verifier.h"
#include "net/cert/x509_certificate.h"
#include "net/cert/x509_util.h"
#include "net/log/net_log_with_source.h"
#include "net/test/cert_test_util.h"
#include "net/test/gtest_util.h"
#include "net/test/test_data_directory.h"
#include "services/network/public/cpp/network_switches.h"
#include "services/network/public/cpp/spki_hash_set.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

CertVerifier;
MockCertVerifier;
HashValue;
SHA256HashValue;
X509Certificate;
TestCompletionCallback;
CertVerifyResult;
NetLogWithSource;

ERR_CERT_INVALID;
ERR_IO_PENDING;
OK;

IsError;
IsOk;

namespace network {

static const char kTestUserDataDirSwitch[] =;

static std::vector<std::string> MakeAllowlist() {}

class IgnoreErrorsCertVerifierTest : public ::testing::Test {};

static void GetNonAllowlistedTestCert(scoped_refptr<X509Certificate>* out) {}

static CertVerifier::RequestParams MakeRequestParams(
    const scoped_refptr<X509Certificate>& cert) {}

static void GetAllowlistedTestCert(scoped_refptr<X509Certificate>* out) {}

TEST_F(IgnoreErrorsCertVerifierTest, TestNoMatchCertOk) {}

TEST_F(IgnoreErrorsCertVerifierTest, TestNoMatchCertError) {}

TEST_F(IgnoreErrorsCertVerifierTest, TestMatch) {}

class IgnoreCertificateErrorsSPKIListFlagTest
    : public ::testing::TestWithParam<bool> {};

// Only if both --user-data-dir and --ignore-certificate-errors-from-spki-list
// are present, certificate verification is bypassed.
TEST_P(IgnoreCertificateErrorsSPKIListFlagTest, TestUserDataDirSwitchRequired) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace network