#include "services/network/sct_auditing/sct_auditing_cache.h"
#include "base/memory/scoped_refptr.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "crypto/secure_hash.h"
#include "crypto/sha2.h"
#include "net/base/hash_value.h"
#include "net/base/host_port_pair.h"
#include "net/cert/ct_serialization.h"
#include "net/cert/sct_status_flags.h"
#include "net/cert/signed_certificate_timestamp.h"
#include "net/cert/signed_certificate_timestamp_and_status.h"
#include "net/test/cert_test_util.h"
#include "net/test/test_data_directory.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/proto/sct_audit_report.pb.h"
#include "services/network/sct_auditing/sct_auditing_handler.h"
#include "services/network/sct_auditing/sct_auditing_reporter.h"
#include "services/network/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/utility/utility.h"
#include "third_party/boringssl/src/include/openssl/pool.h"
#include "third_party/boringssl/src/include/openssl/sha.h"
namespace network {
namespace {
class SCTAuditingCacheTest : public testing::Test { … };
void MakeTestSCTAndStatus(
net::ct::SignedCertificateTimestamp::Origin origin,
const std::string& extensions,
const std::string& signature_data,
const base::Time& timestamp,
net::ct::SCTVerifyStatus status,
net::SignedCertificateTimestampAndStatusList* sct_list) { … }
net::HashValue ComputeCacheKey(
net::SignedCertificateTimestampAndStatusList sct_list) { … }
}
TEST_F(SCTAuditingCacheTest, InsertAndRetrieveReport) { … }
TEST_F(SCTAuditingCacheTest, EvictLRUAfterCacheFull) { … }
TEST_F(SCTAuditingCacheTest, ReportWithSameSCTsDeduplicated) { … }
TEST_F(SCTAuditingCacheTest, DeduplicationUpdatesLastSeenTime) { … }
TEST_F(SCTAuditingCacheTest, ReportsCachedButNotSentWhenSamplingIsZero) { … }
TEST_F(SCTAuditingCacheTest, HighWaterMarkMetrics) { … }
TEST_F(SCTAuditingCacheTest, ReportSizeMetrics) { … }
TEST_F(SCTAuditingCacheTest, ReportSampleDroppedMetrics) { … }
}