chromium/net/reporting/reporting_service_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 "net/reporting/reporting_service.h"

#include <memory>
#include <optional>
#include <string>

#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/tick_clock.h"
#include "base/values.h"
#include "net/base/features.h"
#include "net/base/isolation_info.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/schemeful_site.h"
#include "net/reporting/mock_persistent_reporting_store.h"
#include "net/reporting/reporting_browsing_data_remover.h"
#include "net/reporting/reporting_cache.h"
#include "net/reporting/reporting_context.h"
#include "net/reporting/reporting_endpoint.h"
#include "net/reporting/reporting_policy.h"
#include "net/reporting/reporting_report.h"
#include "net/reporting/reporting_service.h"
#include "net/reporting/reporting_target_type.h"
#include "net/reporting/reporting_test_util.h"
#include "net/test/test_with_task_environment.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace net {
namespace {

CommandType;

// The tests are parametrized on a boolean value which represents whether to use
// a MockPersistentReportingStore (if false, no store is used).
class ReportingServiceTest : public ::testing::TestWithParam<bool>,
                             public WithTaskEnvironment {};

TEST_P(ReportingServiceTest, QueueReport) {}

TEST_P(ReportingServiceTest, QueueEnterpriseReport) {}

TEST_P(ReportingServiceTest, QueueReportSanitizeUrl) {}

TEST_P(ReportingServiceTest, DontQueueReportInvalidUrl) {}

TEST_P(ReportingServiceTest, QueueReportNetworkIsolationKeyDisabled) {}

TEST_P(ReportingServiceTest, ProcessReportToHeader) {}

TEST_P(ReportingServiceTest, ProcessReportingEndpointsHeader) {}

TEST_P(ReportingServiceTest,
       ProcessReportingEndpointsHeaderNetworkIsolationKeyDisabled) {}

TEST_P(ReportingServiceTest, SendReportsAndRemoveSource) {}

// Flaky in ChromeOS: crbug.com/1356127
#if BUILDFLAG(IS_CHROMEOS)
#define MAYBE_SendReportsAndRemoveSourceWithPendingReports
#else
#define MAYBE_SendReportsAndRemoveSourceWithPendingReports
#endif
TEST_P(ReportingServiceTest,
       MAYBE_SendReportsAndRemoveSourceWithPendingReports) {}

TEST_P(ReportingServiceTest, ProcessReportingEndpointsHeaderPathAbsolute) {}

TEST_P(ReportingServiceTest, ProcessReportToHeaderPathAbsolute) {}

TEST_P(ReportingServiceTest, ProcessReportToHeader_TooLong) {}

TEST_P(ReportingServiceTest, ProcessReportToHeader_TooDeep) {}

TEST_P(ReportingServiceTest, ProcessReportToHeaderNetworkIsolationKeyDisabled) {}

TEST_P(ReportingServiceTest, WriteToStore) {}

TEST_P(ReportingServiceTest, WaitUntilLoadFinishesBeforeWritingToStore) {}

TEST_P(ReportingServiceTest,
       SetEnterpriseReportingEndpointsWithFeatureEnabled) {}

TEST_P(ReportingServiceTest,
       SetEnterpriseReportingEndpointsWithFeatureDisabled) {}

TEST_P(ReportingServiceTest, ReportingServiceConstructionWithFeatureEnabled) {}

TEST_P(ReportingServiceTest, ReportingServiceConstructionWithFeatureDisabled) {}

INSTANTIATE_TEST_SUITE_P();
}  // namespace
}  // namespace net