Skip to content

Commit

Permalink
Bug 1796027 [wpt PR 36544] - [FedCM][Test] Add filename parameter to …
Browse files Browse the repository at this point in the history
…default_request_options(), a=testonly

Automatic update from web-platform-tests
[FedCM][Test] Add filename parameter to default_request_options()

This CL adds optional filename parameter to default_request_options()
in fedcm-helper.sub.js

BUG=368434

Change-Id: I5a7a270e3e4dcacdf89c336c2d098c4f2c1024d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3964956
Reviewed-by: Christian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1062196}

--

wpt-commits: f1eadcdbaa60f945d5df7ea3d58e981afad50068
wpt-pr: 36544
  • Loading branch information
pkotwicz authored and moz-wptsync-bot committed Nov 7, 2022
1 parent a3371b1 commit f8af722
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
<script type="module">
import {default_request_options, fedcm_test, set_fedcm_cookie} from './support/fedcm-helper.sub.js';

const url_prefix = 'https://{{host}}:{{ports[https][0]}}/credential-management/support/fedcm/';

fedcm_test(async t => {
const cred = await navigator.credentials.get(default_request_options());
assert_equals(cred.token, "token");
Expand Down Expand Up @@ -102,8 +100,7 @@
}, 'Test that COEP policy do not apply to FedCM requests');

fedcm_test(async t => {
let test_options = default_request_options();
test_options.identity.providers[0].configURL = url_prefix + 'manifest-not-in-list.json';
let test_options = default_request_options('manifest-not-in-list.json');
const cred = navigator.credentials.get(test_options);
return promise_rejects_dom(t, 'NetworkError', cred);
}, 'Test that the promise is rejected if the manifest is not in the manifest list');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ export function set_fedcm_cookie() {

// Returns FedCM CredentialRequestOptions for which navigator.credentials.get()
// succeeds.
export function default_request_options() {
const manifest_origin = 'https://{{hosts[][]}}:{{ports[https][0]}}';
export function default_request_options(manifest_filename) {
if (manifest_filename === undefined) {
manifest_filename = "manifest.py";
}
const manifest_path = `https://{{host}}:{{ports[https][0]}}/\
credential-management/support/fedcm/${manifest_filename}`;
return {
identity: {
providers: [{
configURL: manifest_origin + '/credential-management/support/fedcm/manifest.py',
configURL: manifest_path,
clientId: '1',
nonce: '2',
}]
Expand Down

0 comments on commit f8af722

Please sign in to comment.