michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: MARIONETTE_TIMEOUT = 60000; michael@0: michael@0: SpecialPowers.addPermission("mobileconnection", true, document); michael@0: michael@0: // Permission changes can't change existing Navigator.prototype michael@0: // objects, so grab our objects from a new Navigator michael@0: let ifr = document.createElement("iframe"); michael@0: let connection; michael@0: ifr.onload = function() { michael@0: connection = ifr.contentWindow.navigator.mozMobileConnections[0]; michael@0: michael@0: ok(connection instanceof ifr.contentWindow.MozMobileConnection, michael@0: "connection is instanceof " + connection.constructor); michael@0: michael@0: testGetCallBarringOption(); michael@0: }; michael@0: document.body.appendChild(ifr); michael@0: michael@0: function testGetCallBarringOption() { michael@0: let option = {'program': 0, 'password': '', 'serviceClass': 0}; michael@0: let request = connection.getCallBarringOption(option); michael@0: request.onsuccess = function() { michael@0: ok(request.result); michael@0: ok('enabled' in request.result, 'should have "enabled" field'); michael@0: cleanUp(); michael@0: }; michael@0: request.onerror = function() { michael@0: // Call barring is not supported by current emulator. michael@0: cleanUp(); michael@0: }; michael@0: } michael@0: michael@0: function cleanUp() { michael@0: SpecialPowers.removePermission("mobileconnection", document); michael@0: finish(); michael@0: }