Bug 1870928 [wpt PR 43735] - [FedCM] Add a couple of disconnect failure WPTs, a=testonly

Automatic update from web-platform-tests
[FedCM] Add a couple of disconnect failure WPTs

Bug: 1473134
Change-Id: Ic9c8d9d772dabb029e678ef1aba26df89ed64211
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5137837
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1239389}

--

wpt-commits: cb5696c95d796c2db8cc1f6cabe2d2db5d85959c
wpt-pr: 43735
This commit is contained in:
Nicolás Peña 2023-12-21 17:10:42 +00:00 коммит произвёл moz-wptsync-bot
Родитель 2e994cab05
Коммит 619a84a2a5
4 изменённых файлов: 54 добавлений и 2 удалений

Просмотреть файл

@ -14,13 +14,16 @@ import {fedcm_test,
set_fedcm_cookie,
fedcm_get_and_select_first_account,
manifest_origin,
request_options_with_mediation_required} from './support/fedcm-helper.sub.js';
request_options_with_mediation_required,
select_manifest,
disconnect_options} from './support/fedcm-helper.sub.js';
fedcm_test(async t => {
await mark_signed_in();
await set_fedcm_cookie();
// Get at least one connected account that can be disconnected.
const cred = await fedcm_get_and_select_first_account(t, request_options_with_mediation_required());
const cred = await fedcm_get_and_select_first_account(t,
request_options_with_mediation_required());
const manifest = `${manifest_origin}/\
credential-management/support/fedcm/manifest.py`;
await promise_rejects_js(t, TypeError, IdentityCredential.disconnect({
@ -36,4 +39,31 @@ credential-management/support/fedcm/manifest.py`;
accountHint: 'hint'
}));
}, "disconnect requires 3 parameters: configURL, clientId, and accountHint");
fedcm_test(async t => {
await mark_signed_in();
await set_fedcm_cookie();
// Get at least one connected account that can be disconnected.
const cred = await fedcm_get_and_select_first_account(t,
request_options_with_mediation_required());
const manifest = `manifest_with_cross_origin_disconnect.sub.json`;
await select_manifest(t, request_options_with_mediation_required(manifest));
return promise_rejects_dom(t, 'NetworkError',
IdentityCredential.disconnect(disconnect_options('1234', manifest)));
}, "disconnect fails if the disconnect endpoint is cross-origin with respect\
to the config file");
fedcm_test(async t => {
await mark_signed_in();
await set_fedcm_cookie();
// Get at least one connected account that can be disconnected.
const cred = await fedcm_get_and_select_first_account(t,
request_options_with_mediation_required());
const manifest = `manifest_with_disconnect_failure.json`;
await select_manifest(t, request_options_with_mediation_required(manifest));
return promise_rejects_dom(t, 'NetworkError',
IdentityCredential.disconnect(disconnect_options('1234', manifest)));
}, "disconnect fails if the server sends failure");
</script>

Просмотреть файл

@ -0,0 +1,8 @@
import importlib
def main(request, response):
response.headers.set(b"Content-Type", b"application/json")
response.headers.set(b"Access-Control-Allow-Origin", request.headers.get(b"origin"))
response.headers.set(b"Access-Control-Allow-Credentials", b"true")
return (599, [], "Server failure")

Просмотреть файл

@ -0,0 +1,7 @@
{
"accounts_endpoint": "accounts.py",
"client_metadata_endpoint": "client_metadata.py",
"id_assertion_endpoint": "token.py",
"disconnect_endpoint": "https://{{hosts[alt][]}}:{{ports[https][0]}}/credential-management/support/fedcm/disconnect.py",
"login_url": "login.html"
}

Просмотреть файл

@ -0,0 +1,7 @@
{
"accounts_endpoint": "accounts.py",
"client_metadata_endpoint": "client_metadata.py",
"id_assertion_endpoint": "token.py",
"disconnect_endpoint": "disconnect_failure.py",
"login_url": "login.html"
}