Bug 975144 - Tests for rtcIdentityProvider property, r=gabor
new file mode 100644
--- /dev/null
+++ b/js/xpconnect/tests/unit/test_rtcIdentityProvider.js
@@ -0,0 +1,35 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function run_test() {
+ let Cu = Components.utils;
+ let sb = new Cu.Sandbox('https://www.example.com',
+ { wantGlobalProperties: ['rtcIdentityProvider'] });
+
+ function exerciseInterface() {
+ equal(typeof rtcIdentityProvider, 'object');
+ equal(typeof rtcIdentityProvider.register, 'function');
+ rtcIdentityProvider.register({
+ generateAssertion: function(a, b, c) {
+ return Promise.resolve({
+ idp: { domain: 'example.com' },
+ assertion: JSON.stringify([a, b, c])
+ });
+ },
+ validateAssertion: function(d, e) {
+ return Promise.resolve({
+ identity: 'user@example.com',
+ contents: JSON.stringify([d, e])
+ });
+ }
+ });
+ }
+
+ sb.equal = equal;
+ Cu.evalInSandbox('(' + exerciseInterface.toSource() + ')();', sb);
+ ok(sb.rtcIdentityProvider.idp);
+
+ Cu.importGlobalProperties(['rtcIdentityProvider']);
+ exerciseInterface();
+ ok(rtcIdentityProvider.idp);
+}
--- a/js/xpconnect/tests/unit/xpcshell.ini
+++ b/js/xpconnect/tests/unit/xpcshell.ini
@@ -88,16 +88,17 @@ fail-if = os == "android"
[test_promise.js]
[test_returncode.js]
skip-if = os == "android" # native test components aren't available on Android
[test_textDecoder.js]
[test_url.js]
[test_URLSearchParams.js]
[test_crypto.js]
[test_css.js]
+[test_rtcIdentityProvider.js]
[test_sandbox_atob.js]
[test_isProxy.js]
[test_getObjectPrincipal.js]
[test_watchdog_enable.js]
head = head_watchdog.js
[test_watchdog_disable.js]
head = head_watchdog.js
[test_watchdog_toggle.js]