From 8969965f2a5f0e7ad096c87e336a06a17b2b89f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Pe=C3=B1a?= Date: Wed, 7 Jun 2023 18:37:17 -0700 Subject: [PATCH] [FedCM] Add WPTs for loginHint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The base::Feature needs to be enabled in order to allow the WPTs to be run correctly. Note that the feature is still gated on the Blink RuntimeEnabledFeature. Bug: 1440192 Change-Id: I67a05889234451c126190c91030201dbfe5dbd60 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4595640 Reviewed-by: Christian Biesinger Reviewed-by: Rakina Zata Amni Commit-Queue: Nicolás Peña Cr-Commit-Position: refs/heads/main@{#1154713} --- .../fedcm-loginhint.https.html | 33 +++++++++++++++++++ .../support/fedcm-helper.sub.js | 7 ++++ .../support/fedcm/accounts.py | 3 +- .../support/fedcm/two_accounts.py | 3 +- 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 credential-management/fedcm-loginhint.https.html diff --git a/credential-management/fedcm-loginhint.https.html b/credential-management/fedcm-loginhint.https.html new file mode 100644 index 00000000000000..6db67138167276 --- /dev/null +++ b/credential-management/fedcm-loginhint.https.html @@ -0,0 +1,33 @@ + +Federated Credential Management API login hint tests. + + + + + + + diff --git a/credential-management/support/fedcm-helper.sub.js b/credential-management/support/fedcm-helper.sub.js index 1f6292b9fa0cff..270ac1d743ab4c 100644 --- a/credential-management/support/fedcm-helper.sub.js +++ b/credential-management/support/fedcm-helper.sub.js @@ -110,3 +110,10 @@ export function select_manifest(test, test_options) { const manifest_url = test_options.identity.providers[0].configURL; return select_manifest_impl(manifest_url); } + +export function request_options_with_login_hint(manifest_filename, login_hint) { + let options = request_options_with_mediation_required(manifest_filename); + options.identity.providers[0].loginHint = login_hint; + + return options; +} diff --git a/credential-management/support/fedcm/accounts.py b/credential-management/support/fedcm/accounts.py index 3dbc7403dc2810..11c1c32b61af83 100644 --- a/credential-management/support/fedcm/accounts.py +++ b/credential-management/support/fedcm/accounts.py @@ -20,7 +20,8 @@ def main(request, response): "name": "John Doe", "email": "john_doe@idp.example", "picture": "https://idp.example/profile/123", - "approved_clients": ["123", "456", "789"] + "approved_clients": ["123", "456", "789"], + "login_hints": ["john_doe"] }] } """ diff --git a/credential-management/support/fedcm/two_accounts.py b/credential-management/support/fedcm/two_accounts.py index 48451740663ada..97ee92f676042a 100644 --- a/credential-management/support/fedcm/two_accounts.py +++ b/credential-management/support/fedcm/two_accounts.py @@ -29,7 +29,8 @@ def main(request, response): "name": "John Doe", "email": "john_doe@idp.example", "picture": "https://idp.example/profile/123", - "approved_clients": ["123", "456", "789"] + "approved_clients": ["123", "456", "789"], + "login_hints": ["john_doe"] } ] }