diff --git a/beacon/beacon-common.sub.js b/beacon/beacon-common.sub.js index 3635da73b75400..279ad2229ba3e9 100644 --- a/beacon/beacon-common.sub.js +++ b/beacon/beacon-common.sub.js @@ -98,8 +98,7 @@ function CreateFormDataFromPayload(payload) { return formData; } -// Schedules async_test's for each of the test cases, treating them as a single session, -// and wires up the continueAfterSendingBeacon() and waitForResults() calls. +// Schedules promise_test's for each of the test cases. // Parameters: // testCases: An array of test cases. // suffix [optional]: A string used for the suffix for each test case name. @@ -108,10 +107,10 @@ function CreateFormDataFromPayload(payload) { function runTests(testCases, suffix = '', buildUrl = self.buildUrl, sendData = self.sendData) { for (const testCase of testCases) { const id = token(); - async_test((test) => { + promise_test((test) => { const url = buildUrl(id); assert_true(sendData(url, testCase.data), 'sendBeacon should succeed'); - waitForResult(id).then(() => test.done(), test.step_func((e) => {throw e;})); + return waitForResult(id); }, `Verify 'navigator.sendbeacon()' successfully sends for variant: ${testCase.name}${suffix}`); }; }