chromium/services/network/sct_auditing/sct_auditing_reporter_unittest.cc

// Copyright 2022 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/sct_auditing/sct_auditing_reporter.h"

#include "base/base64.h"
#include "base/functional/callback_helpers.h"
#include "base/i18n/time_formatting.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "base/time/clock.h"
#include "base/time/time.h"
#include "net/base/hash_value.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/network_context.h"
#include "services/network/network_service.h"
#include "services/network/public/mojom/network_service.mojom.h"
#include "services/network/public/proto/sct_audit_report.pb.h"
#include "services/network/test/fake_test_cert_verifier_params_factory.h"
#include "services/network/test/test_network_context_client.h"
#include "services/network/test/test_url_loader_factory.h"
#include "services/network/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/utility/utility.h"

namespace network {

namespace {

constexpr char kLeafHashBase64[] =;
// 42 seconds after the UNIX epoch.
constexpr char kIssuedSerialized[] =;
constexpr char kLogIdBase64[] =;
// 42 seconds.
constexpr char kLogMMDSerialized[] =;
// 10 seconds after the UNIX epoch.
constexpr char kCertExpirySerialized[] =;

constexpr char kTestReportURL[] =;
constexpr char kTestLookupURL[] =;
constexpr char kTestLookupDomain[] =;

constexpr base::TimeDelta kExpectedIngestionDelay =;
constexpr base::TimeDelta kMaxIngestionRandomDelay =;

std::string ExtractRESTURLParameter(std::string url, std::string param) {}

}  // namespace

class SCTAuditingReporterTest : public testing::Test {};

TEST_F(SCTAuditingReporterTest, SCTHashdanceMetadataFromValue) {}

TEST_F(SCTAuditingReporterTest, SCTHashdanceMetadataToValue) {}

// Tests that a hashdance lookup that does not find the SCT reports it.
TEST_F(SCTAuditingReporterTest, HashdanceLookupNotFound) {}

// Tests that a hashdance lookup that finds the SCT does not report it.
TEST_F(SCTAuditingReporterTest, HashdanceLookupFound) {}

// Tests that a hashdance lookup with a server error retries.
TEST_F(SCTAuditingReporterTest, HashdanceLookupServerError) {}

// Tests that a hashdance lookup with an HTTP server error retries.
TEST_F(SCTAuditingReporterTest, HashdanceLookupHTTPError) {}

// Tests that a hashdance lookup with a server "now" timestamp past the expiry
// date does not get reported.
TEST_F(SCTAuditingReporterTest, HashdanceLookupCertificateExpired) {}

// Tests that a hashdance lookup that does not return the SCT Log ID gets
// rescheduled.
TEST_F(SCTAuditingReporterTest, HashdanceLookupUnknownLog) {}

// Tests that a hashdance lookup indicating the log has not yet been ingested is
// rescheduled.
TEST_F(SCTAuditingReporterTest, HashdanceLookupLogNotIngested) {}

// Tests that if chrome thinks the SCT may not have been ingested by Google, it
// will be scheduled for after some reasonable delay.
TEST_F(SCTAuditingReporterTest, HashdanceSCTSuspectedNotYetIngested) {}

}  // namespace network