Skip to content

Commit

Permalink
FLEDGE: Pass creative scanning metadata to scoreAd
Browse files Browse the repository at this point in the history
(This required disabling the optimization of not sending it to the
worklet if sendCreativeScanningMetadata is off, since it's now passed to
the JS in that case).

See
WICG/turtledove#792 (comment)
for more context.

Bug: 383513677

Change-Id: I7b40f47c102a0e9d8160ab33cb9e4eb7553ab02a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6190108
Commit-Queue: Maks Orlovich <[email protected]>
Reviewed-by: Orr Bernstein <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1412359}
  • Loading branch information
Maks Orlovich authored and chromium-wpt-export-bot committed Jan 28, 2025
1 parent ea15691 commit 7cbba6c
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
18 changes: 18 additions & 0 deletions fledge/tentative/auction-config-passed-to-worklets.https.window.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,21 @@ makeTest({
fieldName: 'auctionSignals',
fieldValue: 'null',
});

makeTest({
name: 'AuctionConfig.sendCreativeScanningMetadata is explicit undefined',
fieldName: 'sendCreativeScanningMetadata',
fieldValue: undefined
});

makeTest({
name: 'AuctionConfig.sendCreativeScanningMetadata is true',
fieldName: 'sendCreativeScanningMetadata',
fieldValue: true
});

makeTest({
name: 'AuctionConfig.sendCreativeScanningMetadata is false',
fieldName: 'sendCreativeScanningMetadata',
fieldValue: false
});
77 changes: 77 additions & 0 deletions fledge/tentative/score-ad-browser-signals.https.window.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// META: script=resources/fledge-util.sub.js
// META: script=/common/subset-tests.js
// META: timeout=long
// META: variant=?1-last

"use strict;"

Expand Down Expand Up @@ -56,3 +57,79 @@ subsetTest(promise_test, async test => {
}
});
}, 'ScoreAd browserSignals renderSize test.');


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

let decisionLogicURL = createDecisionScriptURL(uuid, {
scoreAd: `
if (browserSignals.creativeScanningMetadata != 'shady') {
throw 'Wrong creativeScanningMetadata';
}
`
});

await joinGroupAndRunBasicFledgeTestExpectingWinner(test, {
uuid: uuid,
interestGroupOverrides: {
ads: [
{renderURL: createRenderURL(uuid), creativeScanningMetadata: 'shady'}
],
},
auctionConfigOverrides:
{decisionLogicURL: decisionLogicURL, sendCreativeScanningMetadata: true}
});
}, 'ScoreAd browserSignals.creativeScanningMetadata test, no adComponents');

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

let decisionLogicURL = createDecisionScriptURL(uuid, {
scoreAd: `
if (browserSignals.creativeScanningMetadata != 'shady') {
throw 'Wrong creativeScanningMetadata';
}
let adComponentsCreativeScanningMetadata =
browserSignals.adComponentsCreativeScanningMetadata;
if (!Array.isArray(adComponentsCreativeScanningMetadata) ||
adComponentsCreativeScanningMetadata.length !== 3 ||
adComponentsCreativeScanningMetadata[0] !== 'c1' ||
adComponentsCreativeScanningMetadata[1] !== null ||
adComponentsCreativeScanningMetadata[2] !== 'c4') {
throw 'Wrong adComponentsCreativeScanningMetadata';
}
`
});
let biddingLogicURL = createBiddingScriptURL({
generateBid: `
return {
bid: 1,
render: { url: interestGroup.ads[0].renderURL,
width: '100sw',
height: '50px' },
adComponents: [interestGroup.adComponents[0].renderURL,
interestGroup.adComponents[1].renderURL,
interestGroup.adComponents[3].renderURL]
};
`
});

await joinGroupAndRunBasicFledgeTestExpectingWinner(test, {
uuid: uuid,
interestGroupOverrides: {
biddingLogicURL: biddingLogicURL,
ads: [
{renderURL: createRenderURL(uuid), creativeScanningMetadata: 'shady'}
],
adComponents: [
{renderURL: 'https://example.org/a', creativeScanningMetadata: 'c1'},
{renderURL: 'https://example.org/b'},
{renderURL: 'https://example.org/c', creativeScanningMetadata: 'c3'},
{renderURL: 'https://example.org/d', creativeScanningMetadata: 'c4'},
]
},
auctionConfigOverrides:
{decisionLogicURL: decisionLogicURL, sendCreativeScanningMetadata: true}
});
}, 'ScoreAd browserSignals.creativeScanningMetadata test, w/adComponents');

0 comments on commit 7cbba6c

Please sign in to comment.