Skip to content

Commit

Permalink
Protected Audience: Add missing renderSize field to browserSignals of
Browse files Browse the repository at this point in the history
scoreAd.

The Protected Audience explainer claims the browserSignals argument of
scoreAd function should contain an optional field of renderSize.
However, it is found that this has not been implemented. See:
https://github.com/WICG/turtledove/blob/main/FLEDGE.md#:~:text=%27renderSize%27%3A%20%7Bwidth%3A%20100%2C%20height%3A%20200%7D%2C%20/*%20if%20specified%20in%20the%20bid%20*/

This CL implements this optional field to match what the explainer
claims.

See: WICG/turtledove#1088

Spec PR: WICG/turtledove#1141
Explainer PR: WICG/turtledove#1145

Bug: 333628467
Change-Id: I95d5ebb7ddbbeb50d0ac3618e22ed1e228ec32a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5447954
Reviewed-by: Caleb Raitto <caraitto@chromium.org>
Commit-Queue: Xiaochen Zhou <xiaochenzh@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1294870}
  • Loading branch information
xiaochen-z authored and chromium-wpt-export-bot committed May 1, 2024
1 parent e6275c3 commit 3c8f88b
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions fledge/tentative/score-ad-browser-signals.https.window.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// META: script=/resources/testdriver.js
// META: script=/common/utils.js
// META: script=resources/fledge-util.sub.js
// META: script=/common/subset-tests.js
// META: timeout=long

"use strict;"

// These tests focus on the browserSignals argument passed to scoreAd().

subsetTest(promise_test, async test => {
const uuid = generateUuid(test);

let biddingLogicURL = createBiddingScriptURL(
{
generateBid:
`
return {
bid: 1,
render: { url: interestGroup.ads[0].renderURL,
width: '100sw',
height: '50px' }
};
`
});

let decisionLogicURL = createDecisionScriptURL(uuid,
{
scoreAd:
`
if (!browserSignals.hasOwnProperty('renderSize')) {
throw 'Missing renderSize member in browserSignals.';
}
if (browserSignals.renderSize.width !== '100sw' ||
browserSignals.renderSize.height !== '50px') {
throw 'Incorrect renderSize width or height.';
}
`
}
);

await joinGroupAndRunBasicFledgeTestExpectingWinner(
test,
{
uuid: uuid,
interestGroupOverrides: {
name: uuid,
biddingLogicURL: biddingLogicURL,
ads: [{ renderURL: createRenderURL(uuid), sizeGroup: 'group1' }],
adSizes: { 'size1': { width: '100sw', height: '50px' } },
sizeGroups: { 'group1': ['size1'] }
},
auctionConfigOverrides: {
decisionLogicURL: decisionLogicURL
}
});
}, 'ScoreAd browserSignals renderSize test.');

0 comments on commit 3c8f88b

Please sign in to comment.