Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / js / xpconnect / tests / unit / test_rtcIdentityProvider.js
blob7786691513ee6db888ec8d29a2c3fa746c231400
1 /* Any copyright is dedicated to the Public Domain.
2  * http://creativecommons.org/publicdomain/zero/1.0/ */
4 function run_test() {
5   let sb = new Cu.Sandbox('https://www.example.com',
6                           { wantGlobalProperties: ['rtcIdentityProvider'] });
8   function exerciseInterface() {
9     equal(typeof rtcIdentityProvider, 'object');
10     equal(typeof rtcIdentityProvider.register, 'function');
11     rtcIdentityProvider.register({
12       generateAssertion: function(a, b, c) {
13         return Promise.resolve({
14           idp: { domain: 'example.com' },
15           assertion: JSON.stringify([a, b, c])
16         });
17       },
18       validateAssertion: function(d, e) {
19         return Promise.resolve({
20           identity: 'user@example.com',
21           contents: JSON.stringify([d, e])
22         });
23       }
24     });
25   }
27   sb.equal = equal;
28   Cu.evalInSandbox('(' + exerciseInterface.toSource() + ')();', sb);
29   ok(sb.rtcIdentityProvider.hasIdp);
31   Cu.importGlobalProperties(['rtcIdentityProvider']);
32   exerciseInterface();
33   ok(rtcIdentityProvider.hasIdp);