chromium/components/media_router/common/providers/cast/channel/cast_auth_util_unittest.cc

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

#include "components/media_router/common/providers/cast/channel/cast_auth_util.h"

#include <string>

#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "components/media_router/common/providers/cast/certificate/cast_cert_reader.h"
#include "components/media_router/common/providers/cast/certificate/cast_cert_test_helpers.h"
#include "components/media_router/common/providers/cast/certificate/cast_cert_validator.h"
#include "components/media_router/common/providers/cast/certificate/cast_crl.h"
#include "components/media_router/common/providers/cast/channel/cast_auth_util.h"
#include "components/media_router/common/providers/cast/channel/cast_channel_enum.h"
#include "net/cert/x509_certificate.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/boringssl/src/pki/trust_store_in_memory.h"
#include "third_party/openscreen/src/cast/common/certificate/proto/test_suite.pb.h"
#include "third_party/openscreen/src/cast/common/channel/proto/cast_channel.pb.h"

SHA1;
SHA256;

namespace cast_channel {
namespace {

constexpr CastChannelFlags kFlagsCRLMissing =;
constexpr CastChannelFlags kFlagsSHA1AndCRLMissing =;
constexpr CastChannelFlags kFlagsInvalidCRL =;
constexpr CastChannelFlags kFlagsInvalidFallbackCRL =;
constexpr CastChannelFlags kFlagsAcceptedByFallbackCRL =;
constexpr CastChannelFlags kFlagsExpiredFallbackCRL =;

class CastAuthUtilTest : public testing::Test {};

// Note on expiration: VerifyCredentials() depends on the system clock. In
// practice this shouldn't be a problem though since the certificate chain
// being verified doesn't expire until 2032!
TEST_F(CastAuthUtilTest, VerifySuccess) {}

TEST_F(CastAuthUtilTest, VerifyBadCA) {}

TEST_F(CastAuthUtilTest, VerifyBadClientAuthCert) {}

TEST_F(CastAuthUtilTest, VerifyBadSignature) {}

TEST_F(CastAuthUtilTest, VerifyEmptySignature) {}

TEST_F(CastAuthUtilTest, VerifyUnsupportedDigest) {}

TEST_F(CastAuthUtilTest, VerifyBackwardsCompatibleDigest) {}

TEST_F(CastAuthUtilTest, VerifyCrlRequiredWithFallback) {}

TEST_F(CastAuthUtilTest, VerifyCrlOptionalWithFallback) {}

TEST_F(CastAuthUtilTest, VerifyCrlRequiredWithExpiredFallback) {}

TEST_F(CastAuthUtilTest, VerifyCrlRequiredWithNotExpiredFallback) {}

TEST_F(CastAuthUtilTest, FeatureFlagVerifyCrlRequiredWithFallbackCRL) {}

TEST_F(CastAuthUtilTest, VerifyCrlRequiredWithInvalidFallbackCRL) {}

TEST_F(CastAuthUtilTest,
       VerifyInvalidCRLWithFeatureFlagEnforceRevocationChecking) {}

TEST_F(CastAuthUtilTest,
       VerifyMissingCRLWithoutFeatureFlagEnforceRevocationChecking) {}

TEST_F(CastAuthUtilTest,
       VerifyParsingErrorWithFeatureFlagEnforceRevocationChecking) {}

TEST_F(CastAuthUtilTest,
       VerifyParsingErrorWithoutFeatureFlagEnforceRevocationChecking) {}

TEST_F(CastAuthUtilTest, VerifyCrlOptionalWithInvalidFallbackCRL) {}

TEST_F(CastAuthUtilTest, VerifyBadPeerCert) {}

TEST_F(CastAuthUtilTest, VerifySenderNonceMatch) {}

TEST_F(CastAuthUtilTest, VerifySenderNonceMismatch) {}

TEST_F(CastAuthUtilTest, VerifySenderNonceMissing) {}

TEST_F(CastAuthUtilTest, VerifyTLSCertificateSuccess) {}

TEST_F(CastAuthUtilTest, VerifyTLSCertificateTooEarly) {}

TEST_F(CastAuthUtilTest, VerifyTLSCertificateTooLate) {}

// Indicates the expected result of test step's verification.
enum TestStepResult {};

// Verifies that the certificate chain provided is not revoked according to
// the provided Cast CRL at |verification_time|.
// The provided CRL is verified at |verification_time|.
// If |crl_required| is set, then a valid Cast CRL must be provided.
// Otherwise, a missing CRL is be ignored.
AuthResult TestVerifyRevocation(
    const std::vector<std::string>& certificate_chain,
    const std::string& crl_bundle,
    const base::Time& verification_time,
    bool crl_required,
    bssl::TrustStore* crl_trust_store) {}

// Runs a single test case.
bool RunTest(const openscreen::cast::proto::DeviceCertTest& test_case) {}

// Parses the provided test suite provided in wire-format proto.
// Each test contains the inputs and the expected output.
// To see the description of the test, execute the test.
// These tests are generated by a test generator in google3.
void RunTestSuite(const std::string& test_suite_file_name) {}

TEST_F(CastAuthUtilTest, CRLTestSuite) {}

}  // namespace
}  // namespace cast_channel