#include "content/browser/attribution_reporting/interop/runner.h"
#include <stddef.h>
#include <stdint.h>
#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/base64.h"
#include "base/check.h"
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/containers/span.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/raw_ref.h"
#include "base/memory/scoped_refptr.h"
#include "base/ranges/algorithm.h"
#include "base/sequence_checker.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/task/updateable_sequenced_task_runner.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/thread_annotations.h"
#include "base/time/time.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "base/values.h"
#include "components/aggregation_service/aggregation_coordinator_utils.h"
#include "components/attribution_reporting/attribution_scopes_data.h"
#include "components/attribution_reporting/eligibility.h"
#include "components/attribution_reporting/event_level_epsilon.h"
#include "components/attribution_reporting/features.h"
#include "components/attribution_reporting/privacy_math.h"
#include "components/attribution_reporting/registration_eligibility.mojom-forward.h"
#include "components/attribution_reporting/source_type.mojom-forward.h"
#include "components/attribution_reporting/test_utils.h"
#include "content/browser/aggregation_service/aggregatable_report.h"
#include "content/browser/aggregation_service/aggregation_service_features.h"
#include "content/browser/aggregation_service/aggregation_service_impl.h"
#include "content/browser/aggregation_service/aggregation_service_test_utils.h"
#include "content/browser/aggregation_service/public_key.h"
#include "content/browser/attribution_reporting/attribution_background_registrations_id.h"
#include "content/browser/attribution_reporting/attribution_cookie_checker.h"
#include "content/browser/attribution_reporting/attribution_data_host_manager.h"
#include "content/browser/attribution_reporting/attribution_manager_impl.h"
#include "content/browser/attribution_reporting/attribution_os_level_manager.h"
#include "content/browser/attribution_reporting/attribution_report.h"
#include "content/browser/attribution_reporting/attribution_report_network_sender.h"
#include "content/browser/attribution_reporting/attribution_reporting.mojom.h"
#include "content/browser/attribution_reporting/attribution_resolver_delegate_impl.h"
#include "content/browser/attribution_reporting/attribution_suitable_context.h"
#include "content/browser/attribution_reporting/interop/parser.h"
#include "content/browser/storage_partition_impl.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_browser_context.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/attribution.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
#include "services/network/test/test_utils.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace content {
namespace {
RandomizedResponse;
RegistrationEligibility;
AttributionReportingEligibility;
constexpr int64_t kNavigationId(-1);
const GlobalRenderFrameHostId kFrameId = …;
base::TimeDelta TimeOffset(base::Time time_origin) { … }
class Adjuster : public ReportBodyAdjuster { … };
AttributionInteropOutput::Report MakeReport(
const network::ResourceRequest& req,
const base::Time time_origin,
const aggregation_service::TestHpkeKey& hpke_key) { … }
class FakeCookieChecker : public AttributionCookieChecker { … };
class ControllableStorageDelegate : public AttributionResolverDelegateImpl { … };
void Handle(const AttributionSimulationEvent::StartRequest& event,
AttributionDataHostManager& data_host_manager) { … }
void Handle(const AttributionSimulationEvent::Response& event,
AttributionDataHostManager& data_host_manager) { … }
void Handle(const AttributionSimulationEvent::EndRequest& event,
AttributionDataHostManager& data_host_manager) { … }
void FastForwardUntilReportsConsumed(AttributionManager& manager,
BrowserTaskEnvironment& task_environment) { … }
}
base::expected<AttributionInteropOutput, std::string>
RunAttributionInteropSimulation(
AttributionInteropRun run,
const aggregation_service::TestHpkeKey& hpke_key) { … }
void MaybeAdjustReportBody(const GURL& url,
base::Value& payload,
ReportBodyAdjuster& adjuster) { … }
void ReportBodyAdjuster::AdjustVerboseDebug(std::string_view debug_data_type,
base::Value::Dict& body) { … }
}