chromium/net/reporting/reporting_delivery_agent_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.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "net/reporting/reporting_delivery_agent.h"

#include <optional>
#include <vector>

#include "base/json/json_reader.h"
#include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/values_test_util.h"
#include "base/time/time.h"
#include "base/timer/mock_timer.h"
#include "base/unguessable_token.h"
#include "base/values.h"
#include "net/base/backoff_entry.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/reporting_cache.h"
#include "net/reporting/reporting_report.h"
#include "net/reporting/reporting_test_util.h"
#include "net/reporting/reporting_uploader.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace net {
namespace {

constexpr char kReportingUploadHeaderTypeHistogram[] =;

}  // namespace

class ReportingDeliveryAgentTest : public ReportingTestBase {};

TEST_F(ReportingDeliveryAgentTest, SuccessfulImmediateUpload) {}

TEST_F(ReportingDeliveryAgentTest, ReportToHeaderCountedCorrectly) {}

TEST_F(ReportingDeliveryAgentTest, SuccessfulImmediateUploadDocumentReport) {}

TEST_F(ReportingDeliveryAgentTest, UploadHeaderTypeEnumCountPerReport) {}

TEST_F(ReportingDeliveryAgentTest, SuccessfulImmediateSubdomainUpload) {}

TEST_F(ReportingDeliveryAgentTest,
       SuccessfulImmediateSubdomainUploadWithOverwrittenEndpoint) {}

TEST_F(ReportingDeliveryAgentTest, SuccessfulDelayedUpload) {}

TEST_F(ReportingDeliveryAgentTest, FailedUpload) {}

TEST_F(ReportingDeliveryAgentTest, DisallowedUpload) {}

TEST_F(ReportingDeliveryAgentTest, RemoveEndpointUpload) {}

TEST_F(ReportingDeliveryAgentTest, ConcurrentRemove) {}

TEST_F(ReportingDeliveryAgentTest, ConcurrentRemoveDuringPermissionsCheck) {}

// Reports uploaded together must share a NAK and origin.
// Test that the agent will not combine reports destined for the same endpoint
// if the reports are from different origins or NAKs, but does combine all
// reports for the same (NAK, origin).
TEST_F(ReportingDeliveryAgentTest, OnlyBatchSameNakAndOrigin) {}

// Test that the agent won't start a second upload for a (NAK, origin, group)
// while one is pending, even if a different endpoint is available, but will
// once the original delivery is complete and the (NAK, origin, group) is no
// longer pending.
TEST_F(ReportingDeliveryAgentTest, SerializeUploadsToGroup) {}

// Tests that the agent will start parallel uploads to different groups within
// the same (NAK, origin) to endpoints with different URLs.
TEST_F(ReportingDeliveryAgentTest, ParallelizeUploadsAcrossGroups) {}

// Tests that the agent will include reports for different groups for the same
// (NAK, origin) in the same upload if they are destined for the same endpoint
// URL.
TEST_F(ReportingDeliveryAgentTest, BatchReportsAcrossGroups) {}

// Tests that the agent can send all outstanding reports for a single source
// when necessary. This test queues two reports for the same reporting source,
// for different endpoints, another for a different source at the same URL, and
// another for a different source on a different origin.
TEST_F(ReportingDeliveryAgentTest, SendDeveloperReportsForSource) {}

TEST_F(ReportingDeliveryAgentTest, SendEnterpriseReports) {}

TEST_F(ReportingDeliveryAgentTest, SendEnterpriseReportsBatched) {}

TEST_F(ReportingDeliveryAgentTest, SendDeveloperAndEnterpriseReports) {}

// Tests that the agent can send all outstanding V1 reports for multiple sources
// and that these are not batched together.
TEST_F(ReportingDeliveryAgentTest, SendReportsForMultipleSources) {}

}  // namespace net