Files
sousa-gecko/testing/web-platform/tests/fledge/tentative/abort.https.window.js
T
Maks Orlovich 1527ae393a Bug 1954914 [wpt PR 51432] - FLEDGE: Fix invalid and missing strict mode decls, a=testonly
Automatic update from web-platform-tests
FLEDGE: Fix invalid and missing strict mode decls

... and adjust tests to actually work in strict mode in a few spots;
basically just missing declarations.

Change-Id: Ia0f0b2fd3850283076190f5353455449527b1b34
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6368195
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Reviewed-by: Qingxin Wu <qingxinwu@google.com>
Cr-Commit-Position: refs/heads/main@{#1434317}

--

wpt-commits: 3bcb50c358ab68861dfdc5f64abeef1aa31eece3
wpt-pr: 51432
2025-03-22 10:05:41 +00:00

105 lines
3.2 KiB
JavaScript

// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/common/utils.js
// META: script=resources/fledge-util.sub.js
// META: timeout=long
"use strict";
promise_test(async test => {
const uuid = generateUuid(test);
// To minimize the risk of the auction completing before the abort signal,
// make the bid script hand, and increase the per-buyer script timeout.
await joinInterestGroup(
test, uuid,
createBiddingScriptURL({generateBid: 'while(1);'}));
let abortController = new AbortController();
let promise = runBasicFledgeAuction(
test, uuid,
{ signal: abortController.signal,
perBuyerTimeouts: {'*': 1000}
});
abortController.abort('reason');
try {
await promise;
} catch (e) {
assert_equals(e, 'reason');
return;
}
throw 'Exception unexpectedly not thrown';
}, 'Abort auction.');
promise_test(async test => {
const uuid = generateUuid(test);
await joinInterestGroup(test, uuid);
let abortController = new AbortController();
abortController.abort('reason');
try {
await runBasicFledgeAuction(test, uuid, {signal: abortController.signal});
} catch (e) {
assert_equals(e, 'reason');
return;
}
throw 'Exception unexpectedly not thrown';
}, 'Abort triggered before auction started.');
promise_test(async test => {
const uuid = generateUuid(test);
// This doesn't have the header to be loaded in a fenced frame, but can still
// check that it was requested, which is all this test needs.
let trackingRenderURL =
createTrackerURL(origin, uuid, `track_get`, `tracking_render_url`);
await joinInterestGroup(
test, uuid,
{ads: [{renderURL: trackingRenderURL}]});
let abortController = new AbortController();
let fencedFrameConfig = await runBasicFledgeTestExpectingWinner(
test, uuid, {signal: abortController.signal});
// Aborting now should have no effect - in particular, it should still be
// possible to navigate to the winning ad, and it should still send reports.
abortController.abort('reason');
// Load the fencedFrameConfig in a fenced frame, and make sure reports are
// still sent and the render URL still loaded.
createAndNavigateFencedFrame(test, fencedFrameConfig);
await waitForObservedRequests(
uuid,
[trackingRenderURL, createBidderReportURL(uuid), createSellerReportURL(uuid)]);
}, 'Abort signalled after auction completes.');
promise_test(async test => {
const uuid = generateUuid(test);
await joinInterestGroup(
test, uuid,
{ biddingLogicURL: createBiddingScriptURL(
{ allowComponentAuction: true })});
let abortController = new AbortController();
let componentAuctionConfig = {
seller: window.location.origin,
decisionLogicURL: createDecisionScriptURL(uuid),
interestGroupBuyers: [window.location.origin],
signal: abortController.signal
};
let auctionConfigOverrides = {
decisionLogicURL: createDecisionScriptURL(uuid),
interestGroupBuyers: [],
componentAuctions: [componentAuctionConfig]
};
abortController.abort();
// Aborting a component auction has no effect.
await runBasicFledgeTestExpectingWinner(test, uuid, auctionConfigOverrides);
}, 'Abort component auction.');