1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/system/gonk/tests/marionette/test_dsds_numRadioInterfaces.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 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 +MARIONETTE_CONTEXT = "chrome"; 1.9 + 1.10 +Cu.import("resource://gre/modules/Promise.jsm"); 1.11 +Cu.import("resource://gre/modules/systemlibs.js"); 1.12 + 1.13 +const NS_RIL_CONTRACTID = "@mozilla.org/ril;1"; 1.14 + 1.15 +const PROP_RO_MOZ_RIL_NUMCLIENTS = "ro.moz.ril.numclients"; 1.16 + 1.17 +const PREF_RIL_NUM_RADIO_INTERFACES = "ril.numRadioInterfaces"; 1.18 + 1.19 +ok(libcutils, "libcutils is available"); 1.20 + 1.21 +let propNum = (function() { 1.22 + try { 1.23 + let numString = libcutils.property_get(PROP_RO_MOZ_RIL_NUMCLIENTS, "1"); 1.24 + let num = parseInt(numString, 10); 1.25 + if (num >= 0) { 1.26 + return num; 1.27 + } 1.28 + } catch (e) {} 1.29 +})(); 1.30 + 1.31 +log("Retrieved '" + PROP_RO_MOZ_RIL_NUMCLIENTS + "' = " + propNum); 1.32 +ok(propNum, PROP_RO_MOZ_RIL_NUMCLIENTS); 1.33 + 1.34 +let prefNum = Services.prefs.getIntPref(PREF_RIL_NUM_RADIO_INTERFACES); 1.35 +log("Retrieved '" + PREF_RIL_NUM_RADIO_INTERFACES + "' = " + prefNum); 1.36 + 1.37 +let ril = Cc[NS_RIL_CONTRACTID].getService(Ci.nsIRadioInterfaceLayer); 1.38 +ok(ril, "ril.constructor is " + ril.constructor); 1.39 + 1.40 +let ifaceNum = ril.numRadioInterfaces; 1.41 +log("Retrieved 'nsIRadioInterfaceLayer.numRadioInterfaces' = " + ifaceNum); 1.42 + 1.43 +is(propNum, prefNum); 1.44 +is(propNum, ifaceNum); 1.45 + 1.46 +finish();