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
  • Loading branch information
xiaochen-z authored and chromium-wpt-export-bot committed Apr 29, 2024
1 parent 1fedf57 commit d1326b5
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 d1326b5

Please sign in to comment.