#include "content/browser/private_aggregation/private_aggregation_manager_impl.h"
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "base/files/file_path.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/test/bind.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "content/browser/aggregation_service/aggregatable_report.h"
#include "content/browser/aggregation_service/aggregation_service.h"
#include "content/browser/aggregation_service/aggregation_service_test_utils.h"
#include "content/browser/private_aggregation/private_aggregation_budget_key.h"
#include "content/browser/private_aggregation/private_aggregation_budgeter.h"
#include "content/browser/private_aggregation/private_aggregation_features.h"
#include "content/browser/private_aggregation/private_aggregation_host.h"
#include "content/browser/private_aggregation/private_aggregation_test_utils.h"
#include "content/public/browser/private_aggregation_data_model.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/mojom/aggregation_service/aggregatable_report.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace content {
namespace {
BudgetDeniedBehavior;
_;
Invoke;
Return;
Checkpoint;
constexpr auto kExampleTime = …;
constexpr char kExampleOriginUrl[] = …;
constexpr char kExampleMainFrameUrl[] = …;
constexpr char kExampleCoordinatorUrl[] = …;
class PrivateAggregationManagerImplUnderTest
: public PrivateAggregationManagerImpl { … };
std::pair<PrivateAggregationHost::ReportRequestGenerator,
std::vector<blink::mojom::AggregatableReportHistogramContribution>>
CloneAndSplitOutGenerator(const AggregatableReportRequest& request) { … }
constexpr char kBudgeterResultHistogram[] = …;
constexpr char kManagerResultHistogram[] = …;
}
class PrivateAggregationManagerImplTest : public testing::Test { … };
TEST_F(PrivateAggregationManagerImplTest,
BasicReportRequest_FerriedAppropriately) { … }
TEST_F(PrivateAggregationManagerImplTest,
ReportRequestWithMultipleContributions_CorrectBudgetRequested) { … }
TEST_F(PrivateAggregationManagerImplTest,
BudgetRequestRejected_RequestNotScheduled) { … }
TEST_F(PrivateAggregationManagerImplTest,
BudgetExceedsIntegerLimits_BudgetRejectedWithoutRequest) { … }
TEST_F(PrivateAggregationManagerImplTest,
DebugRequest_ImmediatelySentAfterBudgetRequest) { … }
TEST_F(PrivateAggregationManagerImplTest,
DebugRequestWithContextId_ImmediatelySentAfterBudgetRequest) { … }
TEST_F(PrivateAggregationManagerImplTest, DebugReportingPath) { … }
TEST_F(PrivateAggregationManagerImplTest,
BudgetDeniedWithDontSendReportBehavior_DebugRequestNotAssembledOrSent) { … }
TEST_F(PrivateAggregationManagerImplTest,
BudgetDeniedWithSendNullReportBehavior_RequestSent) { … }
TEST_F(PrivateAggregationManagerImplTest,
NoContributions_BudgetNotCheckedButNullReportSent) { … }
TEST_F(PrivateAggregationManagerImplTest,
BindNewReceiver_InvokesHostMethodIdentically) { … }
TEST_F(PrivateAggregationManagerImplTest,
ClearBudgetingData_InvokesClearDataIdentically) { … }
TEST_F(PrivateAggregationManagerImplTest,
BrowsingDataModel_CallbacksProperlyCalled) { … }
}