dom/mobileconnection/tests/marionette/test_call_barring_get_option.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/mobileconnection/tests/marionette/test_call_barring_get_option.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +MARIONETTE_TIMEOUT = 60000;
     1.8 +
     1.9 +SpecialPowers.addPermission("mobileconnection", true, document);
    1.10 +
    1.11 +// Permission changes can't change existing Navigator.prototype
    1.12 +// objects, so grab our objects from a new Navigator
    1.13 +let ifr = document.createElement("iframe");
    1.14 +let connection;
    1.15 +ifr.onload = function() {
    1.16 +  connection = ifr.contentWindow.navigator.mozMobileConnections[0];
    1.17 +
    1.18 +  ok(connection instanceof ifr.contentWindow.MozMobileConnection,
    1.19 +     "connection is instanceof " + connection.constructor);
    1.20 +
    1.21 +  testGetCallBarringOption();
    1.22 +};
    1.23 +document.body.appendChild(ifr);
    1.24 +
    1.25 +function testGetCallBarringOption() {
    1.26 +  let option = {'program': 0, 'password': '', 'serviceClass': 0};
    1.27 +  let request = connection.getCallBarringOption(option);
    1.28 +  request.onsuccess = function() {
    1.29 +    ok(request.result);
    1.30 +    ok('enabled' in request.result, 'should have "enabled" field');
    1.31 +    cleanUp();
    1.32 +  };
    1.33 +  request.onerror = function() {
    1.34 +    // Call barring is not supported by current emulator.
    1.35 +    cleanUp();
    1.36 +  };
    1.37 +}
    1.38 +
    1.39 +function cleanUp() {
    1.40 +  SpecialPowers.removePermission("mobileconnection", document);
    1.41 +  finish();
    1.42 +}

mercurial