Skip to content

Commit

Permalink
[M115] Rename Private Aggregation functions to be more accurate and c…
Browse files Browse the repository at this point in the history
…onsistent

Changes sendHistogramReport() to contributeToHistogram() and
reportContributionForEvent() to contributeToHistogramOnEvent().
Otherwise, keeps functionality the same. This change is breaking, but
is feature-detectable. See also
patcg-individual-drafts/private-aggregation-api#48

Note that the PrivateAggregationHost keeps the old name of
SendHistogramReport() as it actually triggers one report per call.

(cherry picked from commit 98da416)

Bug: 1447099
Change-Id: I18425e9a2073a06758238bc1bb144f91a870a0fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4544567
Reviewed-by: Nan Lin <linnan@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Reviewed-by: Caleb Raitto <caraitto@chromium.org>
Reviewed-by: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1149795}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4574567
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Cr-Commit-Position: refs/branch-heads/5790@{#142}
Cr-Branched-From: 1d71a33-refs/heads/main@{#1148114}
  • Loading branch information
alexmturner authored and Chromium LUCI CQ committed May 30, 2023
1 parent 5480da9 commit cab5874
Show file tree
Hide file tree
Showing 20 changed files with 343 additions and 329 deletions.
36 changes: 18 additions & 18 deletions content/browser/interest_group/ad_auction_service_impl_unittest.cc
Expand Up @@ -6765,8 +6765,8 @@ TEST_F(AdAuctionServiceImplPrivateAggregationEnabledTest,
function generateBid(
interestGroup, auctionSignals, perBuyerSignals, trustedBiddingSignals,
browserSignals) {
privateAggregation.sendHistogramReport({bucket: 1n, value: 2});
privateAggregation.sendHistogramReport({bucket: 3n, value: 4});
privateAggregation.contributeToHistogram({bucket: 1n, value: 2});
privateAggregation.contributeToHistogram({bucket: 3n, value: 4});
return {'ad': 'example', 'bid': 1, 'render': 'https://example.com/render'};
}
)";
Expand Down Expand Up @@ -6855,7 +6855,7 @@ function generateBid(
constexpr char kDecisionScript[] = R"(
function scoreAd(
adMetadata, bid, auctionConfig, trustedScoringSignals, browserSignals) {
privateAggregation.sendHistogramReport({bucket: 1n, value: 2});
privateAggregation.contributeToHistogram({bucket: 1n, value: 2});
return bid;
}
)";
Expand Down Expand Up @@ -6939,7 +6939,7 @@ TEST_F(AdAuctionServiceImplPrivateAggregationEnabledTest,
function generateBid(
interestGroup, auctionSignals, perBuyerSignals, trustedBiddingSignals,
browserSignals) {
privateAggregation.sendHistogramReport({bucket: 1n, value: 2});
privateAggregation.contributeToHistogram({bucket: 1n, value: 2});
return {'ad': 'example', 'bid': 1, 'render': 'https://example.com/render'};
}
)";
Expand Down Expand Up @@ -7045,8 +7045,8 @@ TEST_F(AdAuctionServiceImplPrivateAggregationEnabledTest,
function generateBid(
interestGroup, auctionSignals, perBuyerSignals, trustedBiddingSignals,
browserSignals) {
privateAggregation.reportContributionForEvent("reserved.win",
{bucket: 1n, value: 2});
privateAggregation.contributeToHistogramOnEvent("reserved.win",
{bucket: 1n, value: 2});
return {'ad': 'example', 'bid': 1, 'render': 'https://example.com/render'};
}
)";
Expand Down Expand Up @@ -7099,12 +7099,12 @@ function scoreAd(
}

TEST_F(AdAuctionServiceImplPrivateAggregationEnabledTest,
PrivateAggregationExtensionsUseCounterNotLoggedOnSendHistogramReport) {
PrivateAggregationExtensionsUseCounterNotLoggedOnContributeToHistogram) {
constexpr char kBiddingScript[] = R"(
function generateBid(
interestGroup, auctionSignals, perBuyerSignals, trustedBiddingSignals,
browserSignals) {
privateAggregation.sendHistogramReport({bucket: 1n, value: 2});
privateAggregation.contributeToHistogram({bucket: 1n, value: 2});
return {'ad': 'example', 'bid': 1, 'render': 'https://example.com/render'};
}
)";
Expand Down Expand Up @@ -7165,7 +7165,7 @@ TEST_F(AdAuctionServiceImplPrivateAggregationEnabledTest,
function generateBid(
interestGroup, auctionSignals, perBuyerSignals, trustedBiddingSignals,
browserSignals) {
privateAggregation.sendHistogramReport({});
privateAggregation.contributeToHistogram({});
return {'ad': 'example', 'bid': 1, 'render': 'https://example.com/render'};
}
)";
Expand Down Expand Up @@ -7216,7 +7216,7 @@ function scoreAd(
.Times(0);
absl::optional<GURL> auction_result = RunAdAuctionAndFlush(auction_config);

// There should've been a sendHistogramReport() error.
// There should've been a contributeToHistogram() error.
EXPECT_EQ(auction_result, absl::nullopt);
}

Expand All @@ -7228,19 +7228,19 @@ TEST_F(AdAuctionServiceImplPrivateAggregationEnabledTest,
function generateBid(
interestGroup, auctionSignals, perBuyerSignals, trustedBiddingSignals,
browserSignals) {
privateAggregation.reportContributionForEvent("reserved.win",
{bucket: 1n, value: 2});
privateAggregation.sendHistogramReport({bucket: 3n, value: 4});
privateAggregation.contributeToHistogramOnEvent("reserved.win",
{bucket: 1n, value: 2});
privateAggregation.contributeToHistogram({bucket: 3n, value: 4});
return {'ad': 'example', 'bid': 1, 'render': 'https://example.com/render'};
}
)";

constexpr char kDecisionScript[] = R"(
function scoreAd(
adMetadata, bid, auctionConfig, trustedScoringSignals, browserSignals) {
privateAggregation.sendHistogramReport({bucket: 5n, value: 6});
privateAggregation.reportContributionForEvent("reserved.win",
{bucket: 7n, value: 8});
privateAggregation.contributeToHistogram({bucket: 5n, value: 6});
privateAggregation.contributeToHistogramOnEvent("reserved.win",
{bucket: 7n, value: 8});
return bid;
}
)";
Expand Down Expand Up @@ -7304,7 +7304,7 @@ TEST_F(AdAuctionServiceImplPrivateAggregationDisabledTest,
function generateBid(
interestGroup, auctionSignals, perBuyerSignals, trustedBiddingSignals,
browserSignals) {
privateAggregation.sendHistogramReport({bucket: 1n, value: 2});
privateAggregation.contributeToHistogram({bucket: 1n, value: 2});
return {'ad': 'example', 'bid': 1, 'render': 'https://example.com/render'};
}
)";
Expand Down Expand Up @@ -7347,7 +7347,7 @@ TEST_F(AdAuctionServiceImplPrivateAggregationDisabledTest,
function generateBid(
interestGroup, auctionSignals, perBuyerSignals, trustedBiddingSignals,
browserSignals) {
privateAggregation.sendHistogramReport({bucket: 1n, value: 2});
privateAggregation.contributeToHistogram({bucket: 1n, value: 2});
return {'ad': 'example', 'bid': 1, 'render': 'https://example.com/render'};
}
)";
Expand Down

0 comments on commit cab5874

Please sign in to comment.