chromium/content/browser/attribution_reporting/attribution_report_network_sender_unittest.cc

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

#include "content/browser/attribution_reporting/attribution_report_network_sender.h"

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

#include "base/functional/callback_helpers.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_base.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/attribution_reporting/source_registration_time_config.mojom.h"
#include "components/attribution_reporting/suitable_origin.h"
#include "content/browser/attribution_reporting/aggregatable_debug_report.h"
#include "content/browser/attribution_reporting/attribution_debug_report.h"
#include "content/browser/attribution_reporting/attribution_report.h"
#include "content/browser/attribution_reporting/attribution_test_utils.h"
#include "content/browser/attribution_reporting/send_result.h"
#include "content/browser/attribution_reporting/store_source_result.h"
#include "content/browser/attribution_reporting/stored_source.h"
#include "content/public/browser/browser_context.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_browser_context.h"
#include "net/base/isolation_info.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/base/schemeful_site.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
#include "services/network/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/aggregation_service/aggregatable_report.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace content {

namespace {

SuitableOrigin;

SentResult;

_;
Field;
InSequence;
Mock;

Checkpoint;

const char kEventLevelReportUrl[] =;
const char kDebugEventLevelReportUrl[] =;

const char kAggregatableReportUrl[] =;
const char kDebugAggregatableReportUrl[] =;

const char kAggregatableDebugReportUrl[] =;

const char kAggregatableDebugReportMetricName[] =;

const char kVerboseDebugReportMetricName[] =;

AttributionReport DefaultEventLevelReport() {}

AttributionReport DefaultAggregatableReport(
    std::optional<std::string> trigger_context_id = std::nullopt) {}

}  // namespace

class AttributionReportNetworkSenderTest : public testing::Test {};

TEST_F(AttributionReportNetworkSenderTest,
       ConversionReportReceived_NetworkRequestMade) {}

TEST_F(AttributionReportNetworkSenderTest, LoadFlags) {}

TEST_F(AttributionReportNetworkSenderTest, SameSite) {}

TEST_F(AttributionReportNetworkSenderTest, Isolation) {}

TEST_F(AttributionReportNetworkSenderTest,
       ReportSent_ReportBodyAndURLSetCorrectly) {}

TEST_F(AttributionReportNetworkSenderTest, ReportSent_RequestAttributesSet) {}

TEST_F(AttributionReportNetworkSenderTest, ReportSent_CallbackFired) {}

TEST_F(AttributionReportNetworkSenderTest, SenderDeletedDuringRequest_NoCrash) {}

TEST_F(AttributionReportNetworkSenderTest, ReportRequestHangs_TimesOut) {}

TEST_F(AttributionReportNetworkSenderTest,
       ReportRequestFailsWithTargetedError_ShouldRetrySet) {}

TEST_F(AttributionReportNetworkSenderTest,
       ReportRequestFailsWithHeaders_NotRetried) {}

TEST_F(AttributionReportNetworkSenderTest,
       ReportRequestFailsWithHttpError_ShouldRetryNotSet) {}

TEST_F(AttributionReportNetworkSenderTest,
       ReportRequestFailsDueToNetworkChange_Retries) {}

TEST_F(AttributionReportNetworkSenderTest,
       ReportResultsInHttpError_SentCallbackRuns) {}

TEST_F(AttributionReportNetworkSenderTest, ManyReports_AllSentSuccessfully) {}


TEST_F(AttributionReportNetworkSenderTest, ReportRedirects) {}

TEST_F(AttributionReportNetworkSenderTest,
       EventLevelReportSent_MetricsRecorded) {}

TEST_F(AttributionReportNetworkSenderTest,
       EventLevelReportSent_DebugMetricsRecorded) {}

TEST_F(AttributionReportNetworkSenderTest,
       AggregatableReportSent_MetricsRecorded) {}

TEST_F(AttributionReportNetworkSenderTest,
       AggregatableReportSent_DebugMetricsRecorded) {}

TEST_F(AttributionReportNetworkSenderTest,
       ErrorReportSent_ReportBodySetCorrectly) {}

TEST_F(AttributionReportNetworkSenderTest,
       ErrorReportSent_CallbackInvokedWithNetworkError) {}

TEST_F(AttributionReportNetworkSenderTest, AggregatableDebugReportSent) {}

TEST_F(AttributionReportNetworkSenderTest,
       AggregatableDebugReportSent_CallbackInvokedWithNetworkError) {}

}  // namespace content