commit dfb4f8fafb8393824d8ddaf82f70f9a0f117bfbd parent 9919de3b9d15e8f33f28a34f39144ad4a7b06f5e Author: Russ Hamilton <behamilton@google.com> Date: Thu, 20 Nov 2025 09:54:27 +0000 Bug 2001153 [wpt PR 56118] - Remove old fieldtrial_testing_config entries, a=testonly Automatic update from web-platform-tests Remove old fieldtrial_testing_config entries The experiments corresponding to these entries have either launched or expired. Change-Id: I9d35c938e6e12bb51566ffe50b9aea332d024898 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7156186 Reviewed-by: Rick Byers <rbyers@chromium.org> Commit-Queue: Russ Hamilton <behamilton@google.com> Reviewed-by: Caleb Raitto <caraitto@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1547178} -- wpt-commits: 27ccd0253a254093c35cfc6864efdefacc1078a9 wpt-pr: 56118 Diffstat:
8 files changed, 4 insertions(+), 1273 deletions(-)
diff --git a/testing/web-platform/tests/fledge/tentative/auction-config-passed-to-worklets.https.window.js b/testing/web-platform/tests/fledge/tentative/auction-config-passed-to-worklets.https.window.js @@ -10,7 +10,7 @@ // META: variant=?16-20 // META: variant=?21-25 // META: variant=?26-30 -// META: variant=?30-35 +// META: variant=?30-last "use strict"; @@ -282,21 +282,3 @@ 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 -}); diff --git a/testing/web-platform/tests/fledge/tentative/generate-bid-browser-signals.https.window.js b/testing/web-platform/tests/fledge/tentative/generate-bid-browser-signals.https.window.js @@ -11,9 +11,7 @@ // META: variant=?17-20 // META: variant=?21-24 // META: variant=?25-28 -// META: variant=?29-32 -// META: variant=?33-36 -// META: variant=?37-last +// META: variant=?29-last "use strict"; @@ -37,21 +35,6 @@ subsetTest(promise_test, async test => { 'bidCount': 0, 'multiBidLimit': 1, 'prevWinsMs': [], - 'forDebuggingOnlySampling': false, - 'viewCounts': { - 'pastHour': 0, - 'pastDay': 0, - 'pastWeek': 0, - 'past30Days': 0, - 'past90Days': 0 - }, - 'clickCounts': { - 'pastHour': 0, - 'pastDay': 0, - 'pastWeek': 0, - 'past30Days': 0, - 'past90Days': 0 - } }; let biddingLogicURL = createBiddingScriptURL({ generateBid: @@ -64,22 +47,12 @@ subsetTest(promise_test, async test => { expectedBrowserSignals.forDebuggingOnlyInCooldownOrLockout = browserSignals.forDebuggingOnlyInCooldownOrLockout; - // Don't check exact values of view/click reports. - function zeroCounts(object) { - object.pastHour = 0; - object.pastDay = 0; - object.pastWeek = 0; - object.past30Days = 0; - object.past90Days = 0; - } - zeroCounts(browserSignals.viewCounts); - zeroCounts(browserSignals.clickCounts); // Remove deprecated field, if present. delete browserSignals.prevWins; if (!deepEquals(browserSignals, expectedBrowserSignals)) - throw "Unexpected browserSignals: " + JSON.stringify(browserSignals);` + throw "Unexpected browserSignals: " + JSON.stringify(browserSignals) + " - " + JSON.stringify(expectedBrowserSignals)` }); await joinGroupAndRunBasicFledgeTestExpectingWinner( @@ -1011,216 +984,3 @@ async function generateViewsAndClicks( await runInFrame(test, iframe, script); } - -// Keep running a basic auction with an interest group in -// `interestGroupOverrides` until it succeeds; joining and leaving the -// IG every time to bypass caching which is permitted to provide stale -// view/click counts. -async function keepTryingAuctionUntilWinBypassCaching( - test, uuid, interestGroupOverrides) { - while (true) { - await joinInterestGroup(test, uuid, interestGroupOverrides); - let result = await runBasicFledgeAuction(test, uuid); - if (result !== null) { // Got a winner. - break; - } - await leaveInterestGroup(interestGroupOverrides); - } -} - -// Like keepTryingAuctionUntilWinBypassCaching but for auctions with -// cross-origin interest group, owned by `igOwner`. -async function crossOriginKeepTryingAuctionUntilWinBypassCaching( - test, uuid, igOwner, interestGroupOverrides) { - while (true) { - await joinCrossOriginInterestGroup( - test, uuid, igOwner, interestGroupOverrides); - const auctionConfigOverrides = {interestGroupBuyers: [igOwner]}; - let result = - await runBasicFledgeAuction(test, uuid, auctionConfigOverrides); - if (result !== null) { // Got a winner. - break; - } - await leaveCrossOriginInterestGroup( - test, uuid, igOwner, interestGroupOverrides); - } -} - -// Generates `numViews` views and 0 or 1 clicks based on `produceAttributionSrc` -// and `produceUserAction`, by `viewClickProvider` available to `igOwner`, then -// creates an interest group for `igOwner` with given -// `viewAndClickCountsProviders`, and runs an auction -// to make sure the events are eventually available. -async function testClickiness( - test, igOwner, viewClickProvider, numViews, produceAttributionSrc, - produceUserAction, viewAndClickCountsProviders = undefined) { - const uuid = generateUuid(test); - - await generateViewsAndClicks( - test, uuid, viewClickProvider, igOwner, numViews, produceAttributionSrc, - produceUserAction); - - // For clicks to be recorded, both attributionsrc attribution must exist - // and a user action must be used. If we don't expect clicks, we can expect - // that the number is exactly 0 since re-running the test won't break that. - // - // This is relying on all tests using Ad-Auction-Record-Event using distinct - // `viewClickProvider`s. - let clicksBadTest = - produceAttributionSrc && produceUserAction ? '< 1' : ' !== 0'; - - let viewsBadTest = (numViews > 0) ? `< ${numViews}` : ' !== 0'; - - // Join an IG to read view/click info back. We use a UUID for a name to make - // sure nothing old is cached, since view/clicks are permitted to be a bit - // stale. - let interestGroupOverrides = { - owner: igOwner, - name: uuid, - biddingLogicURL: createBiddingScriptURL({ - origin: igOwner, - generateBid: ` - // We should see at least one click and numViews views the test injects. - if (browserSignals.clickCounts.pastHour ${clicksBadTest} || - browserSignals.clickCounts.pastDay ${clicksBadTest} || - browserSignals.clickCounts.pastWeek ${clicksBadTest} || - browserSignals.clickCounts.past30Days ${clicksBadTest} || - browserSignals.clickCounts.past90Days ${clicksBadTest} || - browserSignals.viewCounts.pastHour ${viewsBadTest} || - browserSignals.viewCounts.pastDay ${viewsBadTest} || - browserSignals.viewCounts.pastWeek ${viewsBadTest} || - browserSignals.viewCounts.past30Days ${viewsBadTest} || - browserSignals.viewCounts.past90Days ${viewsBadTest}) { - return -1; - } - ` - }) - }; - - if (viewAndClickCountsProviders) { - interestGroupOverrides.viewAndClickCountsProviders = - viewAndClickCountsProviders; - } - - await crossOriginKeepTryingAuctionUntilWinBypassCaching( - test, uuid, igOwner, interestGroupOverrides); -} - -subsetTest(promise_test, async test => { - const IG_OWNER = OTHER_ORIGIN5; - const VIEW_CLICK_PROVIDER = OTHER_ORIGIN6; - await testClickiness( - test, IG_OWNER, VIEW_CLICK_PROVIDER, /*numViews=*/ 2, - /*produceAttributionSrc=*/ true, - /*produceUserAction=*/ true, [VIEW_CLICK_PROVIDER]); -}, 'browserSignals for clickiness.'); - -subsetTest(promise_test, async test => { - const IG_OWNER = OTHER_ORIGIN5; - const VIEW_CLICK_PROVIDER = OTHER_ORIGIN5; - - await testClickiness( - test, IG_OWNER, VIEW_CLICK_PROVIDER, /*numViews=*/ 4, - /*produceAttributionSrc=*/ false, - /*produceUserAction=*/ false); -}, 'IG owner is default clickiness provider if nothing is specified'); - -subsetTest(promise_test, async test => { - const IG_OWNER = OTHER_ORIGIN4; - const VIEW_CLICK_PROVIDER = OTHER_ORIGIN4; - - await testClickiness( - test, IG_OWNER, VIEW_CLICK_PROVIDER, /*numViews=*/ 6, - /*produceAttributionSrc=*/ true, - /*produceUserAction=*/ true, []); -}, 'IG owner is default clickiness provider if empty list provided'); - -subsetTest(promise_test, async test => { - const IG_OWNER = OTHER_ORIGIN3; - const VIEW_CLICK_PROVIDER = OTHER_ORIGIN3; - - await testClickiness( - test, IG_OWNER, VIEW_CLICK_PROVIDER, /*numViews=*/ 0, - /*produceAttributionSrc=*/ true, - /*produceUserAction=*/ true, []); -}, 'browserSignals for clickiness --- just a click'); - -subsetTest(promise_test, async test => { - const IG_OWNER = OTHER_ORIGIN2; - const VIEW_CLICK_PROVIDER = OTHER_ORIGIN2; - - await testClickiness( - test, IG_OWNER, VIEW_CLICK_PROVIDER, /*numViews=*/ 1, - /*produceAttributionSrc=*/ true, - /*produceUserAction=*/ false, [VIEW_CLICK_PROVIDER]); -}, 'browserSignals for clickiness --- no click report w/o user action'); - -subsetTest(promise_test, async test => { - const uuid = generateUuid(test); - const IG_OWNER = window.location.origin; - const VIEW_CLICK_PROVIDER1 = OTHER_ORIGIN1; - const VIEW_CLICK_PROVIDER2 = window.location.origin; - - // From provider 1 have click, no views. - // From provider 2 have views, no clicks; - await generateViewsAndClicks( - test, uuid, VIEW_CLICK_PROVIDER1, IG_OWNER, - /*numViews=*/ 0, /*produceAttributionSrc=*/ true, - /*produceUserAction=*/ true); - await generateViewsAndClicks( - test, uuid, VIEW_CLICK_PROVIDER2, IG_OWNER, - /*numViews=*/ 2, /*produceAttributionSrc=*/ false, - /*produceUserAction=*/ false); - - // Create an IG that subscribes only to provider 2 --- it should only see - // the views. - let interestGroupOverrides = { - name: uuid, - viewAndClickCountsProviders: [VIEW_CLICK_PROVIDER2], - biddingLogicURL: createBiddingScriptURL({ - generateBid: ` - if (browserSignals.clickCounts.pastHour !== 0 || - browserSignals.viewCounts.pastHour < 2) { - throw JSON.stringify(browserSignals); - } - ` - }) - }; - - await keepTryingAuctionUntilWinBypassCaching( - test, uuid, interestGroupOverrides); - - // Now see that subscribing only to 1 provides only the click. - interestGroupOverrides = { - name: uuid, - viewAndClickCountsProviders: [VIEW_CLICK_PROVIDER1], - biddingLogicURL: createBiddingScriptURL({ - generateBid: ` - if (browserSignals.clickCounts.pastHour < 1 || - browserSignals.viewCounts.pastHour !== 0) { - throw JSON.stringify(browserSignals); - } - ` - }) - }; - - await keepTryingAuctionUntilWinBypassCaching( - test, uuid, interestGroupOverrides); - - // Now subscribe to both. - interestGroupOverrides = { - name: uuid, - viewAndClickCountsProviders: [VIEW_CLICK_PROVIDER1, VIEW_CLICK_PROVIDER2], - biddingLogicURL: createBiddingScriptURL({ - generateBid: ` - if (browserSignals.clickCounts.pastHour < 1 || - browserSignals.viewCounts.pastHour < 2) { - throw JSON.stringify(browserSignals); - } - ` - }) - }; - - await keepTryingAuctionUntilWinBypassCaching( - test, uuid, interestGroupOverrides); -}, 'browserSignals for clickiness --- viewAndClickCountsProviders works.'); diff --git a/testing/web-platform/tests/fledge/tentative/get-interest-group-auction-data.https.window.js b/testing/web-platform/tests/fledge/tentative/get-interest-group-auction-data.https.window.js @@ -576,55 +576,6 @@ subsetTest(promise_test, async test => { subsetTest(promise_test, async test => { const uuid = generateUuid(test); - let renderURL = createRenderURL(uuid); - let bidderDebugReportURL = - createBidderReportURL(uuid, /*id=*/ 'forDebuggingOnly'); - - let biddingLogicURL = createBiddingScriptURL({ - generateBid: ` - forDebuggingOnly.reportAdAuctionWin('${bidderDebugReportURL}'); - return {bid: 1, render: '${renderURL}'};` - }); - - await Promise.all([ - joinInterestGroup( - test, uuid, - {name: 'o1', ads: [{renderURL: renderURL}], biddingLogicURL}), - joinInterestGroup( - test, uuid, - {name: 'o2', ads: [{renderURL: renderURL}], biddingLogicURL}) - ]); - - // Run an auction to put the origin to cooldown, or lockout. - await runBasicFledgeAuctionAndNavigate(test, uuid); - - const result = await navigator.getInterestGroupAdAuctionData({ - coordinatorOrigin: await BA.configureCoordinator(), - seller: window.location.origin - }); - assert_true(result.requestId !== null); - assert_true(result.request.length > 0); - - let decoded = await BA.decodeInterestGroupData(result.request); - assert_equals(decoded.message.version, 0); - assert_equals(decoded.message.publisher, window.location.hostname); - assert_equals(typeof decoded.message.generationId, 'string'); - - assert_equals( - decoded.message.interestGroups[window.location.origin].length, 2); - assert_equals( - decoded.message.interestGroups[window.location.origin][0] - .inCooldownOrLockout, - true); - assert_equals( - decoded.message.interestGroups[window.location.origin][1] - .inCooldownOrLockout, - true); -}, 'getInterestGroupAdAuctionData() InCooldownOrLockout in each IG'); - -subsetTest(promise_test, async test => { - const uuid = generateUuid(test); - await joinCrossOriginIG(test, uuid, OTHER_ORIGIN1, 'o1'); await joinCrossOriginIG(test, uuid, OTHER_ORIGIN2, 'o2'); await joinCrossOriginIG(test, uuid, OTHER_ORIGIN3, 'o3'); diff --git a/testing/web-platform/tests/fledge/tentative/reporting-ids.https.window.js b/testing/web-platform/tests/fledge/tentative/reporting-ids.https.window.js @@ -1,310 +0,0 @@ -// META: script=/resources/testdriver.js -// META: script=/resources/testdriver-vendor.js -// META: script=/common/utils.js -// META: script=resources/fledge-util.sub.js -// META: script=/common/subset-tests.js -// META: timeout=long -// META: variant=?1-5 -// META: variant=?6-last - - -"use strict"; - -const makeTest = ({ - // Name of the test. - name, - // The value of the selectableReportingIds to be used in the test. - selectableBuyerAndSellerReportingIds = undefined, - // The value of the buyerAndSellerReportingId to be used in the test. - buyerAndSellerReportingId = undefined, - // The value of the buyerReportingId to be used in the test. - buyerReportingId = undefined, - // The javascript comparison to be used in generateBid() - generateBidComparison, - // what gets returned by generateBid() - generateBidReturn, - // The javascript comparison to be used in scoreAd() - scoreAdComparison, - // The javascript comparison to be used in reportWin() - reportWinComparison, - // The javascript comparison to be used in reportResult() - reportResultComparison, - // Whether we expect the auction to have a winner or not. - expectWinner = true, -}) => { - subsetTest(promise_test, async test => { - const uuid = generateUuid(test); - let renderURL = createRenderURL(uuid); - const bidderReportURL = createBidderReportURL(uuid); - const sellerReportURL = createSellerReportURL(uuid); - - let interestGroupOverrides = {}; - interestGroupOverrides.ads = [{ - renderURL: renderURL, - selectableBuyerAndSellerReportingIds: selectableBuyerAndSellerReportingIds, - buyerAndSellerReportingId: buyerAndSellerReportingId, - buyerReportingId: buyerReportingId, - }]; - interestGroupOverrides.biddingLogicURL = createBiddingScriptURL( - { - generateBid: - ` - if(${(generateBidComparison)}){ - return ${generateBidReturn}; - } - throw "Failed comparison in generateBid: " + interestGroup["ads"][0]; - `, - reportWin: - ` - if(${reportWinComparison}) - sendReportTo('${bidderReportURL}') - else - throw "Failed comparison in reportWin"; - ` - }); - - let auctionConfigOverrides = {}; - auctionConfigOverrides.decisionLogicURL = createDecisionScriptURL( - uuid, - { - scoreAd: - ` - if (${scoreAdComparison}){ - return {desirability: 10, bid: 10} - } - throw "Failed comparison in scoreAd "; - `, - reportResult: - ` - if(${reportResultComparison}) - sendReportTo("${sellerReportURL}"); - else - throw "Failed comparison in reportResult"; - ` - }); - - await joinInterestGroup(test, uuid, interestGroupOverrides); - - if (expectWinner) { - await runBasicFledgeAuctionAndNavigate(test, uuid, auctionConfigOverrides); - await waitForObservedRequests( - uuid, - [bidderReportURL, sellerReportURL]); - } - else { - await runBasicFledgeTestExpectingNoWinner(test, uuid, auctionConfigOverrides); - } - }, name); -}; - -// Verify that basic form of selectableReportingIds and selectedReportingId are where they should be. -makeTest({ - name: "selectableBuyerAndSellerReportingIds", - selectableBuyerAndSellerReportingIds: ["selectable_id1", "selectable_id2"], - generateBidComparison: `deepEquals(interestGroup["ads"][0].selectableBuyerAndSellerReportingIds, ["selectable_id1", "selectable_id2"])`, - generateBidReturn: `{bid:10, render: interestGroup.ads[0].renderURL, - selectedBuyerAndSellerReportingId:interestGroup.ads[0].selectableBuyerAndSellerReportingIds[0]}`, - scoreAdComparison: `browserSignals.selectedBuyerAndSellerReportingId === "selectable_id1" && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, - reportWinComparison: `browserSignals.selectedBuyerAndSellerReportingId === "selectable_id1" && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, - reportResultComparison: `browserSignals.selectedBuyerAndSellerReportingId === "selectable_id1" && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, -}); - -// Verify the buyer and seller reporting id is where we expect it when it is present alongside the selected reporting id. -makeTest({ - name: "selectableBuyerAndSellerReportingIds and buyerAndSellerReportingId", - selectableBuyerAndSellerReportingIds: ["selectable_id1", "selectable_id2"], - buyerAndSellerReportingId: "buyer_and_seller_reporting_id", - generateBidComparison: `deepEquals(interestGroup["ads"][0].selectableBuyerAndSellerReportingIds, ["selectable_id1", "selectable_id2"]) && - interestGroup["ads"][0].buyerAndSellerReportingId === "buyer_and_seller_reporting_id"`, - generateBidReturn: `{bid:10, render: interestGroup.ads[0].renderURL, - selectedBuyerAndSellerReportingId:interestGroup.ads[0].selectableBuyerAndSellerReportingIds[0]}`, - scoreAdComparison: `browserSignals.selectedBuyerAndSellerReportingId === "selectable_id1" && - browserSignals.buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - browserSignals.buyerReportingId === undefined`, - reportWinComparison: `browserSignals.selectedBuyerAndSellerReportingId === "selectable_id1" && - browserSignals.buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - browserSignals.buyerReportingId === undefined`, - reportResultComparison: `browserSignals.selectedBuyerAndSellerReportingId === "selectable_id1" && - browserSignals.buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - browserSignals.buyerReportingId === undefined`, -}); - -// Verify the buyer reporting id is where we expect it when it is present alongside the selected reporting id. -makeTest({ - name: "selectableBuyerAndSellerReportingIds and buyerReportingId", - selectableBuyerAndSellerReportingIds: ["selectable_id1", "selectable_id2"], - buyerReportingId: "buyer_reporting_id", - generateBidComparison: `deepEquals(interestGroup["ads"][0].selectableBuyerAndSellerReportingIds, ["selectable_id1", "selectable_id2"]) && - interestGroup["ads"][0].buyerReportingId === "buyer_reporting_id"`, - generateBidReturn: `{bid:10, render: interestGroup.ads[0].renderURL, - selectedBuyerAndSellerReportingId:interestGroup.ads[0].selectableBuyerAndSellerReportingIds[0]}`, - scoreAdComparison: `browserSignals.selectedBuyerAndSellerReportingId === "selectable_id1" && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, - reportWinComparison: `browserSignals.selectedBuyerAndSellerReportingId === "selectable_id1" && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === "buyer_reporting_id"`, - reportResultComparison: `browserSignals.selectedBuyerAndSellerReportingId === "selectable_id1" && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, -}); - -// Verify all reporting ids are where we expect when they are all present alongside the selected reporting id. -makeTest({ - name: "selectableBuyerAndSellerReportingIds, buyerAndSellerReportingId, and buyerReportingId", - selectableBuyerAndSellerReportingIds: ["selectable_id1", "selectable_id2"], - buyerAndSellerReportingId: "buyer_and_seller_reporting_id", - buyerReportingId: "buyer_reporting_id", - generateBidComparison: `deepEquals(interestGroup["ads"][0].selectableBuyerAndSellerReportingIds, ["selectable_id1", "selectable_id2"]) && - interestGroup["ads"][0].buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - interestGroup["ads"][0].buyerReportingId === "buyer_reporting_id"`, - generateBidReturn: `{bid:10, render: interestGroup.ads[0].renderURL, - selectedBuyerAndSellerReportingId:interestGroup.ads[0].selectableBuyerAndSellerReportingIds[0]}`, - scoreAdComparison: `browserSignals.selectedBuyerAndSellerReportingId === "selectable_id1" && - browserSignals.buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - browserSignals.buyerReportingId === undefined`, - reportWinComparison: `browserSignals.selectedBuyerAndSellerReportingId === "selectable_id1" && - browserSignals.buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - browserSignals.buyerReportingId === "buyer_reporting_id"`, - reportResultComparison: `browserSignals.selectedBuyerAndSellerReportingId === "selectable_id1" && - browserSignals.buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - browserSignals.buyerReportingId === undefined`, -}); - -// Verify old behavior occurs when no id was selected, even though there was selectable ids. -makeTest({ - name: "selectableBuyerAndSellerReportingIds but none selected, buyerAndSellerReportingId, and buyerReportingId", - selectableBuyerAndSellerReportingIds: ["selectable_id1", "selectable_id2"], - buyerAndSellerReportingId: "buyer_and_seller_reporting_id", - buyerReportingId: "buyer_reporting_id", - generateBidComparison: `deepEquals(interestGroup["ads"][0].selectableBuyerAndSellerReportingIds, ["selectable_id1", "selectable_id2"]) && - interestGroup["ads"][0].buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - interestGroup["ads"][0].buyerReportingId === "buyer_reporting_id"`, - generateBidReturn: `{bid:10, render: interestGroup.ads[0].renderURL}`, - scoreAdComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, - reportWinComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - browserSignals.buyerReportingId === undefined`, - reportResultComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - browserSignals.buyerReportingId === undefined`, -}); - -// Make sure if there was a selectedReportingId that's not within the selectables, -// that the worklet throws an error and the auction does not have a winner. -makeTest({ - name: "selected not included selectables", - selectableBuyerAndSellerReportingIds: ["selectable_id1", "selectable_id2"], - buyerAndSellerReportingId: "buyer_and_seller_reporting_id", - buyerReportingId: "buyer_reporting_id", - generateBidComparison: `deepEquals(interestGroup["ads"][0].selectableBuyerAndSellerReportingIds, ["selectable_id1", "selectable_id2"]) && - interestGroup["ads"][0].buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - interestGroup["ads"][0].buyerReportingId === "buyer_reporting_id"`, - generateBidReturn: `{bid:10, render: interestGroup.ads[0].renderURL, selectedBuyerAndSellerReportingId:"invalid_id"}`, - scoreAdComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, - reportWinComparison: `false`, - reportResultComparison: `false"`, - expectWinner: false -}); - -// Make sure if there was a selectedReportingId but no selectables, -// that the worklet throws an error and the auction does not have a winner -makeTest({ - name: "selected without selectables", - buyerAndSellerReportingId: "buyer_and_seller_reporting_id", - buyerReportingId: "buyer_reporting_id", - generateBidComparison: `interestGroup["ads"][0].selectableBuyerAndSellerReportingIds === undefined && - interestGroup["ads"][0].buyerAndSellerReportingId === undefined && - interestGroup["ads"][0].buyerReportingId === undefined`, - generateBidReturn: `{bid:10, render: interestGroup.ads[0].renderURL, selectedBuyerAndSellerReportingId:"invalid_id"}`, - scoreAdComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, - reportWinComparison: `false`, - reportResultComparison: `false`, - expectWinner: false -}); - -// Verify old behavior occurs when there are no present selectable ids. -makeTest({ - name: "buyerAndSellerReportingId, and buyerReportingId, but no selectables present", - buyerAndSellerReportingId: "buyer_and_seller_reporting_id", - buyerReportingId: "buyer_reporting_id", - generateBidComparison: `interestGroup["ads"][0].selectableBuyerAndSellerReportingIds === undefined && - interestGroup["ads"][0].buyerAndSellerReportingId === undefined && - interestGroup["ads"][0].buyerReportingId === undefined`, - generateBidReturn: `{bid:10, render: interestGroup.ads[0].renderURL}`, - scoreAdComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, - reportWinComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - browserSignals.buyerReportingId === undefined`, - reportResultComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - browserSignals.buyerReportingId === undefined`, -}); - -makeTest({ - name: "only buyerAndSellerReportingId", - buyerAndSellerReportingId: "buyer_and_seller_reporting_id", - generateBidComparison: `interestGroup["ads"][0].selectableBuyerAndSellerReportingIds === undefined && - interestGroup["ads"][0].buyerAndSellerReportingId === undefined && - interestGroup["ads"][0].buyerReportingId === undefined`, - generateBidReturn: `{bid:10, render: interestGroup.ads[0].renderURL}`, - scoreAdComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, - reportWinComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - browserSignals.buyerReportingId === undefined`, - reportResultComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === "buyer_and_seller_reporting_id" && - browserSignals.buyerReportingId === undefined`, -}); - -makeTest({ - name: "only buyerReportingId", - buyerReportingId: "buyer_reporting_id", - generateBidComparison: `interestGroup["ads"][0].selectableBuyerAndSellerReportingIds === undefined && - interestGroup["ads"][0].buyerAndSellerReportingId === undefined && - interestGroup["ads"][0].buyerReportingId === undefined`, - generateBidReturn: `{bid:10, render: interestGroup.ads[0].renderURL}`, - scoreAdComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, - reportWinComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === "buyer_reporting_id"`, - reportResultComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, -}); - -makeTest({ - name: "no reporting ids, expect IG name", - generateBidComparison: `interestGroup["ads"][0].selectableBuyerAndSellerReportingIds === undefined && - interestGroup["ads"][0].buyerAndSellerReportingId === undefined && - interestGroup["ads"][0].buyerReportingId === undefined`, - generateBidReturn: `{bid:10, render: interestGroup.ads[0].renderURL}`, - scoreAdComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, - reportWinComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined && - browserSignals.interestGroupName === "default name"`, - reportResultComparison: `browserSignals.selectedBuyerAndSellerReportingId === undefined && - browserSignals.buyerAndSellerReportingId === undefined && - browserSignals.buyerReportingId === undefined`, -}); diff --git a/testing/web-platform/tests/fledge/tentative/score-ad-browser-signals.https.window.js b/testing/web-platform/tests/fledge/tentative/score-ad-browser-signals.https.window.js @@ -58,78 +58,3 @@ 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'); diff --git a/testing/web-platform/tests/fledge/tentative/server-response.https.window.js b/testing/web-platform/tests/fledge/tentative/server-response.https.window.js @@ -89,49 +89,6 @@ subsetTest(promise_test, async test => { let decoded = await BA.decodeInterestGroupData(result.request); let serverResponseMsg = { - 'nonce': uuid, - 'biddingGroups': {}, - 'adRenderURL': adsArray[0].renderURL, - 'interestGroupName': DEFAULT_INTEREST_GROUP_NAME, - 'interestGroupOwner': window.location.origin, - }; - serverResponseMsg.biddingGroups[window.location.origin] = [0]; - - let serverResponse = - await BA.encodeServerResponse(serverResponseMsg, decoded); - - let hashString = await BA.payloadHash(serverResponse); - await BA.authorizeServerResponseNonces([uuid]); - - let auctionResult = await navigator.runAdAuction({ - 'seller': window.location.origin, - 'requestId': result.requestId, - 'serverResponse': serverResponse, - 'resolveToConfig': true, - }); - expectSuccess(auctionResult); - createAndNavigateFencedFrame(test, auctionResult); - await waitForObservedRequests(uuid, [adA]); -}, 'Basic B&A auction - nonces'); - -subsetTest(promise_test, async test => { - const uuid = generateUuid(test); - const adA = createTrackerURL(window.location.origin, uuid, 'track_get', 'a'); - const adB = createTrackerURL(window.location.origin, uuid, 'track_get', 'b'); - const adsArray = - [{renderURL: adA, adRenderId: 'a'}, {renderURL: adB, adRenderId: 'b'}]; - await joinInterestGroup(test, uuid, {ads: adsArray}); - - const result = await navigator.getInterestGroupAdAuctionData({ - coordinatorOrigin: await BA.configureCoordinator(), - seller: window.location.origin - }); - assert_true(result.requestId !== null); - assert_true(result.request.length > 0); - - let decoded = await BA.decodeInterestGroupData(result.request); - - let serverResponseMsg = { 'biddingGroups': {}, 'adRenderURL': adsArray[0].renderURL, 'interestGroupName': DEFAULT_INTEREST_GROUP_NAME, diff --git a/testing/web-platform/tests/fledge/tentative/trusted-scoring-signals.https.window.js b/testing/web-platform/tests/fledge/tentative/trusted-scoring-signals.https.window.js @@ -14,8 +14,7 @@ // META: variant=?36-40 // META: variant=?41-45 // META: variant=?46-50 -// META: variant=?51-55 -// META: variant=?56-last +// META: variant=?51-last "use strict"; @@ -787,327 +786,3 @@ subsetTest(promise_test, async test => { await runBasicFledgeTestExpectingWinner(test, uuid, auctionConfigOverrides); }, 'Trusted scoring signals splits the request if the combined URL length exceeds the limit of small value.'); - -// A little helper to extract out trusted signals query params echoed back -// by trusted-scoring-signals.py; sticks them in a map named `parsed`. -function makeParseHelper(renderURL) { - return ` - let payload = trustedScoringSignals.renderURL['${renderURL}']; - payload = payload.substring(payload.indexOf('?') + 1).split('&'); - let parsed = new Map(); - for (let entry of payload) { - let kv = entry.split('='); - parsed.set(kv[0], decodeURIComponent(kv[1])); - } - `; -} - -subsetTest(promise_test, async test => { - const uuid = generateUuid(test); - const renderURL = - createRenderURL(uuid, /*script=*/null, /*signalsParam=*/'url'); - - const bidder_origin = OTHER_ORIGIN1; - - await joinCrossOriginInterestGroup(test, uuid, bidder_origin, { - ads: [{ - renderURL: renderURL, - creativeScanningMetadata: 'hello', - buyerAndSellerReportingId: 'chair' - }] - }); - - const scoreAdBody = ` - ${makeParseHelper(renderURL)} - if (parsed.get('renderUrls') !== '${renderURL}') - throw 'Wrong URL'; - if (parsed.get('adCreativeScanningMetadata') !== 'hello') - throw 'Wrong creative scanning metadata'; - if (parsed.get('adBuyerAndSellerReportingIds') !== 'chair') - throw 'Wrong BSRID'; - if (parsed.get('adSizes') !== ',') - throw 'Wrong adSizes'; - if (parsed.get('adBuyer') !== '${bidder_origin}') - throw 'Wrong adBuyer'; - if (parsed.has('adComponentRenderUrls')) - throw 'Unexpected adComponentRenderUrls'; - if (parsed.has('adComponentCreativeScanningMetadata')) - throw 'Unexpected adComponentCreativeScanningMetadata'; - if (parsed.has('adComponentSizes')) - throw 'Unexpected adComponentSizes'; - if (parsed.has('adComponentBuyer')) - throw 'Unexpected adComponentBuyer'; - `; - - const auctionConfigOverrides = { - interestGroupBuyers : [bidder_origin], - trustedScoringSignalsURL: TRUSTED_SCORING_SIGNALS_URL, - sendCreativeScanningMetadata: true, - decisionLogicURL: createDecisionScriptURL(uuid, {scoreAd: scoreAdBody}) - }; - - await runBasicFledgeTestExpectingWinner(test, uuid, auctionConfigOverrides); -}, 'Creative scanning metadata - basic data flow'); - -subsetTest(promise_test, async test => { - const uuid = generateUuid(test); - const renderURL = - createRenderURL(uuid, /*script=*/null, /*signalsParam=*/'url'); - - const bidder_origin = OTHER_ORIGIN1; - - await joinCrossOriginInterestGroup( - test, uuid, bidder_origin, - {ads: [{renderURL: renderURL, buyerAndSellerReportingId: 'sofa'}]}); - - const scoreAdBody = ` - ${makeParseHelper(renderURL)} - if (parsed.get('renderUrls') !== '${renderURL}') - throw 'Wrong URL'; - if (parsed.get('adCreativeScanningMetadata') !== '') - throw 'Wrong creative scanning metadata'; - if (parsed.get('adBuyerAndSellerReportingIds') !== 'sofa') - throw 'Wrong BSRID'; - if (parsed.get('adSizes') !== ',') - throw 'Wrong adSizes'; - if (parsed.get('adBuyer') !== '${bidder_origin}') - throw 'Wrong adBuyer'; - if (parsed.has('adComponentRenderUrls')) - throw 'Unexpected adComponentRenderUrls'; - if (parsed.has('adComponentCreativeScanningMetadata')) - throw 'Unexpected adComponentCreativeScanningMetadata'; - if (parsed.has('adComponentSizes')) - throw 'Unexpected adComponentSizes'; - if (parsed.has('adComponentBuyer')) - throw 'Unexpected adComponentBuyer'; - `; - - const auctionConfigOverrides = { - interestGroupBuyers : [bidder_origin], - trustedScoringSignalsURL: TRUSTED_SCORING_SIGNALS_URL, - sendCreativeScanningMetadata: true, - decisionLogicURL: createDecisionScriptURL(uuid, {scoreAd: scoreAdBody}) - }; - - await runBasicFledgeTestExpectingWinner(test, uuid, auctionConfigOverrides); -}, 'Creative scanning metadata - sending enabled but no metadata specified'); - -subsetTest(promise_test, async test => { - const uuid = generateUuid(test); - const renderURL = - createRenderURL(uuid, /*script=*/null, /*signalsParam=*/'url'); - - await joinInterestGroup( - test, uuid, - {ads: [{renderURL: renderURL, creativeScanningMetadata: 'hello'}]}); - - const scoreAdBody = ` - ${makeParseHelper(renderURL)} - if (parsed.get('renderUrls') !== '${renderURL}') - throw 'Wrong URL'; - if (parsed.has('adCreativeScanningMetadata')) - throw 'Unexpected creative scanning metadata'; - if (parsed.has('adBuyerAndSellerReportingIds')) - throw 'Unexpected BSRID'; - if (parsed.has('adSizes')) - throw 'Unexpected adSizes'; - if (parsed.has('adBuyer')) - throw 'Unexpected adBuyer'; - if (parsed.has('adComponentRenderUrls')) - throw 'Unexpected adComponentRenderUrls'; - if (parsed.has('adComponentCreativeScanningMetadata')) - throw 'Unexpected adComponentCreativeScanningMetadata'; - if (parsed.has('adComponentSizes')) - throw 'Unexpected adComponentSizes'; - if (parsed.has('adComponentBuyer')) - throw 'Unexpected adComponentBuyer'; - `; - - const auctionConfigOverrides = { - trustedScoringSignalsURL: TRUSTED_SCORING_SIGNALS_URL, - sendCreativeScanningMetadata: false, - decisionLogicURL: createDecisionScriptURL(uuid, {scoreAd: scoreAdBody}) - }; - - await runBasicFledgeTestExpectingWinner(test, uuid, auctionConfigOverrides); -}, 'Creative scanning metadata - disabled'); - -subsetTest(promise_test, async test => { - const uuid = generateUuid(test); - const renderURL = - createRenderURL(uuid, /*script=*/null, /*signalsParam=*/'url'); - - const generateBidBody = ` - return { - bid: 1, - render: { - url: interestGroup.ads[0].renderURL, - width: '100px', - height: '10sh' - } - }; - `; - - await joinInterestGroup(test, uuid, { - ads: [{ - renderURL: renderURL, - creativeScanningMetadata: 'hello', - sizeGroup: 'flexible' - }], - sizeGroups: {'flexible': ['small', 'big']}, - adSizes: { - 'small': {width: '100px', height: '10sh'}, - 'big': {width: '50sw', height: '200px'}, - }, - biddingLogicURL: createBiddingScriptURL({generateBid: generateBidBody}) - }); - - const scoreAdBody = ` - ${makeParseHelper(renderURL)} - if (parsed.get('renderUrls') !== '${renderURL}') - throw 'Wrong URL'; - if (parsed.get('adCreativeScanningMetadata') !== 'hello') - throw 'Wrong creative scanning metadata'; - if (parsed.get('adBuyerAndSellerReportingIds') !== '') - throw 'Wrong BSRID'; - if (parsed.get('adSizes') !== '100px,10sh') - throw 'Wrong adSizes'; - if (parsed.get('adBuyer') !== '${window.location.origin}') - throw 'Wrong adBuyer'; - if (parsed.has('adComponentRenderUrls')) - throw 'Unexpected adComponentRenderUrls'; - if (parsed.has('adComponentCreativeScanningMetadata')) - throw 'Unexpected adComponentCreativeScanningMetadata'; - if (parsed.has('adComponentSizes')) - throw 'Unexpected adComponentSizes'; - if (parsed.has('adComponentBuyer')) - throw 'Unexpected adComponentBuyer'; - `; - - const auctionConfigOverrides = { - trustedScoringSignalsURL: TRUSTED_SCORING_SIGNALS_URL, - sendCreativeScanningMetadata: true, - decisionLogicURL: createDecisionScriptURL(uuid, {scoreAd: scoreAdBody}) - }; - - await runBasicFledgeTestExpectingWinner(test, uuid, auctionConfigOverrides); -}, 'Creative scanning metadata - ad size'); - -subsetTest(promise_test, async test => { - const uuid = generateUuid(test); - const renderURL = - createRenderURL(uuid, /*script=*/null, /*signalsParam=*/'url'); - const componentURL1 = createRenderURL( - uuid, /*script=*/null, /*signalsParam=*/'url,component1'); - const componentURL2 = createRenderURL( - uuid, /*script=*/null, /*signalsParam=*/'url,component2'); - - const generateBidBody = ` - return { - bid: 1, - render: { - url: interestGroup.ads[0].renderURL, - }, - 'adComponents': [ - {url: '${componentURL1}'}, - {url: '${componentURL2}', width: '50sw', height: '200px'}, - ] - }; - `; - - await joinInterestGroup(test, uuid, { - ads: [{ - renderURL: renderURL, - creativeScanningMetadata: 'hello', - sizeGroup: 'flexible' - }], - adComponents: [ - { - renderURL: componentURL1, - sizeGroup: 'flexible', - creativeScanningMetadata: 'c1' - }, - { - renderURL: componentURL2, - sizeGroup: 'flexible', - creativeScanningMetadata: 'c2' - } - ], - sizeGroups: {'flexible': ['small', 'big']}, - adSizes: { - 'small': {width: '100px', height: '10sh'}, - 'big': {width: '50sw', height: '200px'}, - }, - biddingLogicURL: createBiddingScriptURL({generateBid: generateBidBody}) - }); - - const scoreAdBody = ` - ${makeParseHelper(renderURL)} - if (parsed.get('renderUrls') !== '${renderURL}') - throw 'Wrong URL'; - if (parsed.get('adCreativeScanningMetadata') !== 'hello') - throw 'Wrong creative scanning metadata'; - if (parsed.get('adBuyerAndSellerReportingIds') !== '') - throw 'Wrong BSRID'; - if (parsed.get('adSizes') !== ',') - throw 'Wrong adSizes'; - if (parsed.get('adBuyer') !== '${window.location.origin}') - throw 'Wrong adBuyer'; - - // We have to be careful here since we don't order which order the - // components are going to be reported in; so we normalize them and sort - // them. - let adComponentRenderUrls = parsed.get('adComponentRenderUrls').split(','); - let adComponentCreativeScanningMetadata = - parsed.get('adComponentCreativeScanningMetadata').split(','); - let adComponentSizes = parsed.get('adComponentSizes').split(','); - let adComponentBuyer = parsed.get('adComponentBuyer').split(','); - - if (adComponentCreativeScanningMetadata.length != - adComponentRenderUrls.length) { - throw 'Wrong adComponentCreativeScanningMetadata.length'; - } - - if (adComponentSizes.length !== 2 * adComponentRenderUrls.length) { - throw 'Wrong adComponentSizes.length'; - } - - if (adComponentBuyer.length !== adComponentRenderUrls.length) { - throw 'Wrong adComponentBuyer.length'; - } - - let composed = []; - for (let i = 0; i < adComponentRenderUrls.length; ++i) { - let entry = 'url:' + adComponentRenderUrls[i] + - '; creativeScanningMetadata:' + - adComponentCreativeScanningMetadata[i] + - '; size:' + adComponentSizes[2*i] + 'x' + adComponentSizes[2*i+1] + - '; buyer:' + adComponentBuyer[i]; - entry = entry.replaceAll('${componentURL1}', 'componentURL1'); - entry = entry.replaceAll('${componentURL2}', 'componentURL2'); - entry = entry.replaceAll('${window.location.origin}', 'buyer'); - composed.push(entry); - } - composed.sort(); - if (composed.length !== 2) { - throw 'Wrong # of component entries overall'; - } - if (composed[0] !== - 'url:componentURL1; creativeScanningMetadata:c1; size:x; buyer:buyer') { - throw 'Wrong component 0'; - } - if (composed[1] !== - 'url:componentURL2; creativeScanningMetadata:c2; size:50swx200px; ' + - 'buyer:buyer') { - throw 'Wrong component 1'; - } - `; - - const auctionConfigOverrides = { - trustedScoringSignalsURL: TRUSTED_SCORING_SIGNALS_URL, - sendCreativeScanningMetadata: true, - decisionLogicURL: createDecisionScriptURL(uuid, {scoreAd: scoreAdBody}) - }; - - await runBasicFledgeTestExpectingWinner(test, uuid, auctionConfigOverrides); -}, 'Creative scanning metadata - ad components'); diff --git a/testing/web-platform/tests/fledge/tentative/utf8-helpers.https.window.js b/testing/web-platform/tests/fledge/tentative/utf8-helpers.https.window.js @@ -1,209 +0,0 @@ -// META: script=/resources/testdriver.js -// META: script=/resources/testdriver-vendor.js -// META: script=/common/utils.js -// META: script=resources/fledge-util.sub.js -// META: script=/common/subset-tests.js -// META: timeout=long -// META: variant=?1-5 -// META: variant=?6-10 -// META: variant=?11-15 - -'use strict'; - -// These tests cover encodeUtf8 and decodeUtf8. - -const helpers = ` - function assertEq(l, r, label) { - if (l !== r) - throw 'Mismatch ' + label; - } - - function assertByteArray(result, expect) { - if (!(result instanceof Uint8Array)) { - throw 'Not a Uint8Array!'; - } - assertEq(result.length, expect.length, 'length'); - for (var i = 0; i < result.length; ++i) { - assertEq(result[i], expect[i], i); - } - } - - function assertString(result, expect) { - if (typeof result !== 'string') { - throw 'Not a string'; - } - assertEq(result.length, expect.length, 'length'); - for (var i = 0; i < result.length; ++i) { - assertEq(result.charCodeAt(i), expect.charCodeAt(i), i); - } - } -` - -async function testConversion(test, conversionBody) { - const uuid = generateUuid(test); - let sellerReportURL = createSellerReportURL(uuid); - let bidderReportURL = createBidderReportURL(uuid); - - let fullBody = ` - ${helpers} - ${conversionBody} - `; - - let biddingLogicURL = createBiddingScriptURL({ - generateBid: fullBody, - reportWin: fullBody + `sendReportTo('${bidderReportURL}')` - }); - - let decisionLogicURL = createDecisionScriptURL(uuid, { - scoreAd: fullBody, - reportResult: fullBody + `sendReportTo('${sellerReportURL}')` - }); - - await joinInterestGroup(test, uuid, {biddingLogicURL: biddingLogicURL}); - await runBasicFledgeAuctionAndNavigate( - test, uuid, {decisionLogicURL: decisionLogicURL}); - await waitForObservedRequests(uuid, [sellerReportURL, bidderReportURL]); -} - -async function testConversionException(test, conversionBody) { - const uuid = generateUuid(test); - let sellerReportURL = createSellerReportURL(uuid); - let bidderReportURL = createBidderReportURL(uuid); - - let fullBody = ` - ${helpers} - try { - ${conversionBody}; - return -1; - } catch (e) { - } - `; - - let biddingLogicURL = createBiddingScriptURL({ - generateBid: fullBody, - reportWin: fullBody + `sendReportTo('${bidderReportURL}')` - }); - - let decisionLogicURL = createDecisionScriptURL(uuid, { - scoreAd: fullBody, - reportResult: fullBody + `sendReportTo('${sellerReportURL}')` - }); - - await joinInterestGroup(test, uuid, {biddingLogicURL: biddingLogicURL}); - await runBasicFledgeAuctionAndNavigate( - test, uuid, {decisionLogicURL: decisionLogicURL}); - await waitForObservedRequests(uuid, [sellerReportURL, bidderReportURL]); -} - -subsetTest(promise_test, async test => { - await testConversion( - test, `let result = protectedAudience.encodeUtf8('ABC\u0490'); - assertByteArray(result, [65, 66, 67, 0xD2, 0x90])`); -}, 'encodeUtf8 - basic'); - -subsetTest(promise_test, async test => { - await testConversion( - test, `let result = protectedAudience.encodeUtf8('A\uD800C'); - assertByteArray(result, [65, 0xEF, 0xBF, 0xBD, 67])`); -}, 'encodeUtf8 - mismatched surrogate gets replaced'); - -subsetTest(promise_test, async test => { - await testConversion( - test, `let result = protectedAudience.encodeUtf8('A\uD83D\uDE02C'); - assertByteArray(result, [65, 0xF0, 0x9F, 0x98, 0x82, 67])`); -}, 'encodeUtf8 - surrogate pair combined'); - -subsetTest(promise_test, async test => { - const conversionBody = ` - let obj = { - toString: () => "ABC" - }; - let result = protectedAudience.encodeUtf8(obj); - assertByteArray(result, [65, 66, 67]) - `; - await testConversion(test, conversionBody); -}, 'encodeUtf8 - custom string conversion'); - -subsetTest(promise_test, async test => { - const conversionBody = ` - let result = protectedAudience.encodeUtf8(); - `; - await testConversionException(test, conversionBody); -}, 'encodeUtf8 - not enough arguments'); - -subsetTest(promise_test, async test => { - const conversionBody = ` - let obj = { - toString: () => { throw 'no go' } - }; - let result = protectedAudience.encodeUtf8(obj); - `; - await testConversionException(test, conversionBody); -}, 'encodeUtf8 - custom string conversion failure'); - -subsetTest(promise_test, async test => { - const conversionBody = ` - let input = new Uint8Array([65, 66, 0xD2, 0x90, 67]); - let result = protectedAudience.decodeUtf8(input); - assertString(result, 'AB\u0490C'); - `; - await testConversion(test, conversionBody); -}, 'decodeUtf8 - basic'); - -subsetTest(promise_test, async test => { - const conversionBody = ` - let input = new Uint8Array([65, 32, 0xD2]); - let result = protectedAudience.decodeUtf8(input); - if (result.indexOf('\uFFFD') === -1) - throw 'Should have replacement character'; - `; - await testConversion(test, conversionBody); -}, 'decodeUtf8 - broken utf-8'); - -subsetTest(promise_test, async test => { - const conversionBody = ` - let input = new Uint8Array([65, 32, 0xED, 0xA0, 0x80, 66]); - let result = protectedAudience.decodeUtf8(input); - if (result.indexOf('\uFFFD') === -1) - throw 'Should have replacement character'; - `; - await testConversion(test, conversionBody); -}, 'decodeUtf8 - mismatched surrogate'); - -subsetTest(promise_test, async test => { - const conversionBody = ` - let input = new Uint8Array([65, 0xF0, 0x9F, 0x98, 0x82, 67]); - let result = protectedAudience.decodeUtf8(input); - assertString(result, 'A\uD83D\uDE02C'); - `; - await testConversion(test, conversionBody); -}, 'decodeUtf8 - non-BMP character'); - -subsetTest(promise_test, async test => { - const conversionBody = ` - let buffer = new ArrayBuffer(8); - let fullView = new Uint8Array(buffer); - for (let i = 0; i < fullView.length; ++i) - fullView[i] = 65 + i; - let partialView = new Uint8Array(buffer, 2, 3); - assertString(protectedAudience.decodeUtf8(fullView), - 'ABCDEFGH'); - assertString(protectedAudience.decodeUtf8(partialView), - 'CDE'); - `; - await testConversion(test, conversionBody); -}, 'decodeUtf8 - proper Uint8Array handling'); - -subsetTest(promise_test, async test => { - const conversionBody = ` - let result = protectedAudience.decodeUtf8(); - `; - await testConversionException(test, conversionBody); -}, 'decodeUtf8 - not enough arguments'); - -subsetTest(promise_test, async test => { - const conversionBody = ` - let result = protectedAudience.decodeUtf8([65, 32, 66]); - `; - await testConversionException(test, conversionBody); -}, 'decodeUtf8 - wrong type');