Bug 1773157 [wpt PR 34335] - [FedCM] Test that we reject the promise if the manifest...
[gecko.git] / testing / web-platform / tests / credential-management / fedcm-network-requests.sub.https.html
blob93899619e3f5dcbce6b7e5ef3d257e8e3a0827e1
1 <!DOCTYPE html>
2 <title>Federated Credential Management API network request tests.</title>
3 <link rel="help" href="https://fedidcg.github.io/FedCM">
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
7 <body>
9 <script type="module">
10 import {set_fedcm_cookie} from './support/fedcm-helper.js';
12 const url_prefix = 'https://{{host}}:{{ports[https][0]}}/credential-management/support/';
13 promise_test(async t => {
14 await set_fedcm_cookie();
15 const result = await navigator.credentials.get({
16 federated: {
17 providers: [{
18 url: url_prefix,
19 clientId: '1',
22 });
23 const token = await result.login({nonce: '1'});
24 assert_equals(token.idToken, 'token');
25 }, 'Test that COEP policy do not apply to FedCM requests');
27 promise_test(async t => {
28 await set_fedcm_cookie();
29 const result = await navigator.credentials.get({
30 federated: {
31 providers: [{
32 url: url_prefix + "fedcm-manifest-not-in-list/",
33 clientId: '1',
36 });
37 return promise_rejects_dom(t, 'NetworkError', result.login({nonce: '1'}));
38 }, 'Test that the promise is rejected if the manifest is not in the manifest list');
39 </script>