tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

store-account-list.tentative.https.html (1758B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>FedCM IDP sign-in status API tests</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/testdriver.js"></script>
      7 <script src="/resources/testdriver-vendor.js"></script>
      8 
      9 <script type="module">
     10 
     11 promise_test(
     12  async t => {
     13    assert_equals(await navigator.login.setStatus('logged-in', {
     14        accounts: [{
     15          id: '1234',
     16          email: 'alpha@example.com',
     17          name: 'Alpha',
     18          picture: 'https://cataas.com/cat?width=128&height=128',
     19        }],
     20        expiration: 60*1000 // 60 seconds
     21      }), undefined, 'A valid setStatus call should resolve with undefined.');
     22  },
     23  'login.setStatus with valid account list succeeds.'
     24 );
     25 
     26 promise_test(
     27  async t => {
     28    assert_equals(await navigator.login.setStatus('logged-in', {
     29        accounts: [],
     30        expiration: 60*1000 // 60 seconds
     31      }), undefined, 'A setStatus call with an empty account list should resolve with undefined.');
     32  },
     33  'login.setStatus with empty account list succeeds.'
     34 );
     35 
     36 promise_test(
     37  async t => {
     38    assert_equals(await navigator.login.setStatus('logged-in', {
     39        expiration: 60*1000 // 60 seconds
     40      }), undefined, 'A setStatus with an no account list call resolves with undefined.');
     41  },
     42  'login.setStatus with no account list succeeds.'
     43 );
     44 
     45 promise_test(
     46  async t => {
     47    return promise_rejects_js(t, TypeError, navigator.login.setStatus('logged-in', {
     48        accounts: [{name: 'Underspecified'}],
     49        expiration: 60*1000 // 60 seconds
     50      }), 'A setStatus with an invalid account should throw a type error.');
     51  },
     52  'login.setStatus with an invalid account throws a TypeError.'
     53 );
     54 
     55 
     56 </script>