-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1835436 [wpt PR 40256] - [PaymentRequest] Only allow show() to be…
… called in a foreground tab, a=testonly Automatic update from web-platform-tests [PaymentRequest] Only allow show() to be called in a foreground tab (#40256) See w3c/payment-request#1005 -- wpt-commits: ce9e78b850380c6bc782efeae6faaded29d0228e wpt-pr: 40256 UltraBlame original commit: 1200c0a52171decd28e41fe24ef83c66ad347680
- Loading branch information
Showing
1 changed file
with
370 additions
and
0 deletions.
There are no files selected for viewing
370 changes: 370 additions & 0 deletions
370
testing/web-platform/tests/payment-request/payment-request-disallowed-when-hidden.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,370 @@ | ||
< | ||
! | ||
DOCTYPE | ||
html | ||
> | ||
< | ||
meta | ||
charset | ||
= | ||
" | ||
utf | ||
- | ||
8 | ||
" | ||
> | ||
< | ||
title | ||
> | ||
Test | ||
for | ||
PaymentRequest | ||
. | ||
show | ||
( | ||
) | ||
method | ||
- | ||
should | ||
fail | ||
when | ||
tab | ||
is | ||
not | ||
visible | ||
< | ||
/ | ||
title | ||
> | ||
< | ||
link | ||
rel | ||
= | ||
" | ||
help | ||
" | ||
href | ||
= | ||
" | ||
https | ||
: | ||
/ | ||
/ | ||
w3c | ||
. | ||
github | ||
. | ||
io | ||
/ | ||
payment | ||
- | ||
request | ||
/ | ||
# | ||
show | ||
- | ||
method | ||
" | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testharness | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testharnessreport | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testdriver | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testdriver | ||
- | ||
vendor | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
! | ||
- | ||
- | ||
For | ||
minimize | ||
( | ||
) | ||
- | ||
- | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
page | ||
- | ||
visibility | ||
/ | ||
resources | ||
/ | ||
window_state_context | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
> | ||
' | ||
use | ||
strict | ||
' | ||
; | ||
promise_test | ||
( | ||
async | ||
t | ||
= | ||
> | ||
{ | ||
const | ||
{ | ||
minimize | ||
restore | ||
} | ||
= | ||
window_state_context | ||
( | ||
t | ||
) | ||
; | ||
const | ||
request | ||
= | ||
new | ||
PaymentRequest | ||
( | ||
[ | ||
{ | ||
supportedMethods | ||
: | ||
" | ||
https | ||
: | ||
/ | ||
/ | ||
apple | ||
. | ||
com | ||
/ | ||
apple | ||
- | ||
pay | ||
" | ||
data | ||
: | ||
{ | ||
version | ||
: | ||
3 | ||
merchantIdentifier | ||
: | ||
" | ||
merchant | ||
. | ||
com | ||
. | ||
example | ||
" | ||
countryCode | ||
: | ||
" | ||
US | ||
" | ||
merchantCapabilities | ||
: | ||
[ | ||
" | ||
supports3DS | ||
" | ||
] | ||
supportedNetworks | ||
: | ||
[ | ||
" | ||
visa | ||
" | ||
] | ||
} | ||
} | ||
] | ||
{ | ||
total | ||
: | ||
{ | ||
label | ||
: | ||
" | ||
Total | ||
" | ||
amount | ||
: | ||
{ | ||
currency | ||
: | ||
" | ||
USD | ||
" | ||
value | ||
: | ||
" | ||
1 | ||
. | ||
00 | ||
" | ||
} | ||
} | ||
} | ||
) | ||
; | ||
/ | ||
/ | ||
Before | ||
we | ||
trigger | ||
the | ||
Payment | ||
Request | ||
minimize | ||
the | ||
window | ||
. | ||
This | ||
should | ||
/ | ||
/ | ||
cause | ||
the | ||
show | ||
( | ||
) | ||
call | ||
to | ||
be | ||
rejected | ||
. | ||
await | ||
minimize | ||
( | ||
) | ||
; | ||
assert_equals | ||
( | ||
document | ||
. | ||
hidden | ||
true | ||
) | ||
; | ||
await | ||
test_driver | ||
. | ||
bless | ||
( | ||
' | ||
user | ||
activation | ||
' | ||
) | ||
; | ||
return | ||
promise_rejects_dom | ||
( | ||
t | ||
" | ||
AbortError | ||
" | ||
request | ||
. | ||
show | ||
( | ||
) | ||
) | ||
; | ||
} | ||
' | ||
PaymentRequest | ||
. | ||
show | ||
( | ||
) | ||
cannot | ||
be | ||
triggered | ||
from | ||
a | ||
hidden | ||
context | ||
' | ||
) | ||
; | ||
< | ||
/ | ||
script | ||
> |