Bug 1930406 [wpt PR 49090] - [Presentation] Make PresentationRequest.getAvailability() return a new Promise, a=testonly

Automatic update from web-platform-tests
[Presentation] Make PresentationRequest.getAvailability() return a new Promise

According to the spec[1], PresentationRequest.getAvailability() should
return a new Promise when called each time.

[1] https://www.w3.org/TR/presentation-api/#dom-presentationrequest-getavailability

Bug: 41455951
Change-Id: I28611ea114d760d72cc395be48f7b028ee626a91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5986368
Commit-Queue: Wei4 Wang <wei4.wang@intel.com>
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1381009}

--

wpt-commits: ea9ca56cf7af0075cc37afaab11c4948d4bd061d
wpt-pr: 49090
This commit is contained in:
Wei Wang 2024-11-11 09:50:22 +00:00 committed by moz-wptsync-bot
parent a498df7d02
commit e6acdab72a

View File

@ -29,9 +29,9 @@
const promise = request.getAvailability();
assert_true(promise instanceof Promise, 'PresentationRequest.getAvailability() returns a Promise.');
const samePromise = request.getAvailability();
assert_true(samePromise instanceof Promise, 'PresentationRequest.getAvailabilty() returns a Promise.');
assert_equals(promise, samePromise, 'If the PresentationRequest object has an unsettled Promise, getAvailability returns that Promise.');
const newPromise = request.getAvailability();
assert_true(newPromise instanceof Promise, 'PresentationRequest.getAvailabilty() returns a Promise.');
assert_not_equals(promise, newPromise, 'PresentationRequest.getAvailability() should return a new Promise each time it is called.');
return promise.then(a => {
availability = a;
@ -44,7 +44,7 @@
assert_not_equals(availability, a, 'A presentation availability object is newly created if the presentation request has a newly added presentation URLs.');
const newPromise = request.getAvailability();
assert_not_equals(promise, newPromise, 'If the Promise from a previous call to getAvailability has already been settled, getAvailability returns a new Promise.');
assert_not_equals(promise, newPromise, 'PresentationRequest.getAvailability() should return a new Promise each time it is called.');
return newPromise.then(newAvailability => {
assert_equals(availability, newAvailability, 'Promises from a PresentationRequest\'s getAvailability are resolved with the same PresentationAvailability object.');