summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/credential-management/support/fedcm-mojojs-helper.js
blob: 40ab729b1f9555f751611e845fac6360d0cbdd30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// The testing infra for FedCM is loaded using mojo js shim. To enable these
// tests the browser must be run with these options:
//
//   --enable-blink-features=MojoJS,MojoJSTest

import { MockFederatedAuthRequest } from './fedcm-mock.js';

export function fedcm_mojo_mock_test(test_func, name, exception, properties) {
  promise_test(async (t) => {
    assert_implements(navigator.credentials, 'missing navigator.credentials');
    const mock = new MockFederatedAuthRequest();
    try {
      await test_func(t, mock);
    } catch (e) {
      assert_equals(exception, e.message)
    } finally {
      await mock.reset();
    }
  }, name, properties);
}