#include "content/browser/aggregation_service/aggregatable_report_sender.h"
#include <memory>
#include <string>
#include <string_view>
#include "base/containers/enum_set.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_util.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "content/browser/aggregation_service/aggregatable_report.h"
#include "content/public/test/browser_task_environment.h"
#include "net/base/isolation_info.h"
#include "net/base/load_flags.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/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace content {
namespace {
DelayTypeEnumSet;
constexpr std::string_view kExampleURL = …;
base::Value GetExampleContents() { … }
void ExpectHistograms(
const base::HistogramTester& histograms,
std::optional<AggregatableReportRequest::DelayType> delay_type,
AggregatableReportSender::RequestStatus request_status,
int http_response_or_net_error) { … }
}
class AggregatableReportSenderTest : public testing::Test { … };
TEST_F(AggregatableReportSenderTest, ReportSent_RequestAttributesSet) { … }
TEST_F(AggregatableReportSenderTest, ReportSent_IsolationKeyDifferent) { … }
TEST_F(AggregatableReportSenderTest, ReportSent_UploadDataCorrect) { … }
TEST_F(AggregatableReportSenderTest, ReportSent_StatusOk) { … }
TEST_F(AggregatableReportSenderTest, SenderDeletedDuringRequest_NoCrash) { … }
TEST_F(AggregatableReportSenderTest, ReportRequestHangs_Timeout) { … }
TEST_F(AggregatableReportSenderTest,
ReportRequestFailsDueToNetworkChange_Retries) { … }
TEST_F(AggregatableReportSenderTest, HttpError_CallbackRuns) { … }
TEST_F(AggregatableReportSenderTest, ManyReports_AllSentSuccessfully) { … }
TEST_F(AggregatableReportSenderTest, StatusHistogram_Expected) { … }
}