1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
content / browser / private_aggregation / private_aggregation_test_utils.cc [blame]
// Copyright 2022 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/private_aggregation/private_aggregation_test_utils.h"
#include <memory>
#include <tuple>
#include "base/functional/callback_helpers.h"
#include "content/browser/private_aggregation/private_aggregation_budget_key.h"
#include "content/browser/storage_partition_impl.h"
namespace content {
MockPrivateAggregationBudgeter::MockPrivateAggregationBudgeter() = default;
MockPrivateAggregationBudgeter::~MockPrivateAggregationBudgeter() = default;
MockPrivateAggregationHost::MockPrivateAggregationHost()
: PrivateAggregationHost(
/*on_report_request_received=*/base::DoNothing(),
&test_browser_context_) {}
MockPrivateAggregationHost::~MockPrivateAggregationHost() = default;
MockPrivateAggregationManagerImpl::MockPrivateAggregationManagerImpl(
StoragePartitionImpl* partition)
: PrivateAggregationManagerImpl(
std::make_unique<MockPrivateAggregationBudgeter>(),
std::make_unique<MockPrivateAggregationHost>(),
partition) {}
MockPrivateAggregationManagerImpl::~MockPrivateAggregationManagerImpl() =
default;
bool operator==(const PrivateAggregationBudgetKey::TimeWindow& a,
const PrivateAggregationBudgetKey::TimeWindow& b) {
return a.start_time() == b.start_time();
}
bool operator==(const PrivateAggregationBudgetKey& a,
const PrivateAggregationBudgetKey& b) {
const auto tie = [](const PrivateAggregationBudgetKey& budget_key) {
return std::make_tuple(budget_key.origin(), budget_key.time_window(),
budget_key.api());
};
return tie(a) == tie(b);
}
} // namespace content