From e583aa2754ab2782c9aef8ac14b8f5c3c4e4717f Mon Sep 17 00:00:00 2001 From: Yi Gu Date: Thu, 9 Dec 2021 15:58:36 +0000 Subject: [PATCH] Bug 1743820 [wpt PR 31811] - [FedCM] Make nonce an optional field in FederatedIdentityProvider, a=testonly Automatic update from web-platform-tests [FedCM] Make nonce an optional field in FederatedIdentityProvider nonce should not be required in FederatedIdentityProvider. If RP does not specify a nonce, IDP may create one instead. Bug: 1275311 Change-Id: Ic6cf70c5662e735444009181ad19a0b94040c17b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3308919 Reviewed-by: Ken Buchanan Commit-Queue: Yi Gu Cr-Commit-Position: refs/heads/main@{#947074} -- wpt-commits: e52234647f628070de56411ab29a4fba73e8d527 wpt-pr: 31811 --- .../tests/credential-management/fedcm.https.html | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/testing/web-platform/tests/credential-management/fedcm.https.html b/testing/web-platform/tests/credential-management/fedcm.https.html index 6933e58b7081..4b10b1727188 100644 --- a/testing/web-platform/tests/credential-management/fedcm.https.html +++ b/testing/web-platform/tests/credential-management/fedcm.https.html @@ -77,8 +77,9 @@ return promise_rejects_dom(t, "InvalidStateError", result); }, "Reject when clientId is empty"); - promise_test(async t => { - const result = navigator.credentials.get({ + fedcm_test(async (t, mock) => { + mock.returnIdToken("a_token"); + const token = await navigator.credentials.get({ federated: { providers: [{ url: 'https://idp.test', @@ -86,21 +87,9 @@ }] } }); - return promise_rejects_js(t, TypeError, result); - }, "Reject when nonce is missing" ); - promise_test(async t => { - const result = navigator.credentials.get({ - federated: { - providers: [{ - url: 'https://idp.test', - clientId: '1', - nonce: '', - }] - } - }); - return promise_rejects_dom(t, "InvalidStateError", result); - }, "Reject when nonce is empty"); + assert_equals(token, "a_token"); + }, "nonce is not required in FederatedIdentityProvider."); promise_test(function(t) { // Logout API not supported yet. -- 2.11.4.GIT