#include "content/test/test_aggregation_service_impl.h"
#include <optional>
#include <string>
#include <utility>
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/task/thread_pool.h"
#include "base/time/clock.h"
#include "base/time/time.h"
#include "base/types/expected_macros.h"
#include "base/uuid.h"
#include "base/values.h"
#include "content/browser/aggregation_service/aggregatable_report.h"
#include "content/browser/aggregation_service/aggregatable_report_assembler.h"
#include "content/browser/aggregation_service/aggregatable_report_sender.h"
#include "content/browser/aggregation_service/aggregation_service_storage.h"
#include "content/browser/aggregation_service/aggregation_service_storage_sql.h"
#include "content/browser/aggregation_service/aggregation_service_test_utils.h"
#include "content/browser/aggregation_service/public_key.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "third_party/blink/public/mojom/aggregation_service/aggregatable_report.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace content {
namespace {
AggregationServicePayloadContents::Operation ConvertToOperation(
TestAggregationService::Operation operation) { … }
blink::mojom::AggregationServiceMode ConvertToAggregationMode(
TestAggregationService::AggregationMode aggregation_mode) { … }
void HandleAggregatableReportCallback(
base::OnceCallback<void(base::Value::Dict)> callback,
AggregatableReportRequest,
std::optional<AggregatableReport> report,
AggregatableReportAssembler::AssemblyStatus status) { … }
}
TestAggregationServiceImpl::TestAggregationServiceImpl(
const base::Clock* clock,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: … { … }
TestAggregationServiceImpl::~TestAggregationServiceImpl() = default;
const base::SequenceBound<AggregationServiceStorage>&
TestAggregationServiceImpl::GetStorage() { … }
void TestAggregationServiceImpl::SetDisablePayloadEncryption(
bool should_disable) { … }
void TestAggregationServiceImpl::SetPublicKeys(
const GURL& url,
const base::FilePath& json_file,
base::OnceCallback<void(bool)> callback) { … }
void TestAggregationServiceImpl::AssembleReport(
AssembleRequest request,
base::OnceCallback<void(base::Value::Dict)> callback) { … }
void TestAggregationServiceImpl::SendReport(
const GURL& url,
const base::Value& contents,
base::OnceCallback<void(bool)> callback) { … }
void TestAggregationServiceImpl::GetPublicKeys(
const GURL& url,
base::OnceCallback<void(std::vector<PublicKey>)> callback) const { … }
}