dom/mobileconnection/tests/marionette/test_call_barring_get_option.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:5e10d1f6c227
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 MARIONETTE_TIMEOUT = 60000;
5
6 SpecialPowers.addPermission("mobileconnection", true, document);
7
8 // Permission changes can't change existing Navigator.prototype
9 // objects, so grab our objects from a new Navigator
10 let ifr = document.createElement("iframe");
11 let connection;
12 ifr.onload = function() {
13 connection = ifr.contentWindow.navigator.mozMobileConnections[0];
14
15 ok(connection instanceof ifr.contentWindow.MozMobileConnection,
16 "connection is instanceof " + connection.constructor);
17
18 testGetCallBarringOption();
19 };
20 document.body.appendChild(ifr);
21
22 function testGetCallBarringOption() {
23 let option = {'program': 0, 'password': '', 'serviceClass': 0};
24 let request = connection.getCallBarringOption(option);
25 request.onsuccess = function() {
26 ok(request.result);
27 ok('enabled' in request.result, 'should have "enabled" field');
28 cleanUp();
29 };
30 request.onerror = function() {
31 // Call barring is not supported by current emulator.
32 cleanUp();
33 };
34 }
35
36 function cleanUp() {
37 SpecialPowers.removePermission("mobileconnection", document);
38 finish();
39 }

mercurial