зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changesets a7ea2d51414d and 901717199390 (bug 957917) for causing bug 980375.
This commit is contained in:
Родитель
5c5909660e
Коммит
cb6ce085e9
|
@ -9,13 +9,12 @@ let Promise =
|
|||
|
||||
let bluetoothManager;
|
||||
|
||||
/**
|
||||
* Get mozSettings value specified by @aKey.
|
||||
/* Get mozSettings value specified by @aKey.
|
||||
*
|
||||
* Resolve if that mozSettings value is retrieved successfully, reject
|
||||
* otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
* Forfill params:
|
||||
* The corresponding mozSettings value of the key.
|
||||
* Reject params: (none)
|
||||
*
|
||||
|
@ -40,12 +39,11 @@ function getSettings(aKey) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mozSettings values.
|
||||
/* Set mozSettings values.
|
||||
*
|
||||
* Resolve if that mozSettings value is set successfully, reject otherwise.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Forfill params: (none)
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aSettings
|
||||
|
@ -69,13 +67,12 @@ function setSettings(aSettings) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mozSettings value of 'bluetooth.enabled'.
|
||||
/* Get mozSettings value of 'bluetooth.enabled'.
|
||||
*
|
||||
* Resolve if that mozSettings value is retrieved successfully, reject
|
||||
* otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
* Forfill params:
|
||||
* A boolean value.
|
||||
* Reject params: (none)
|
||||
*
|
||||
|
@ -85,12 +82,11 @@ function getBluetoothEnabled() {
|
|||
return getSettings("bluetooth.enabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mozSettings value of 'bluetooth.enabled'.
|
||||
/* Set mozSettings value of 'bluetooth.enabled'.
|
||||
*
|
||||
* Resolve if that mozSettings value is set successfully, reject otherwise.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Forfill params: (none)
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aEnabled
|
||||
|
@ -104,11 +100,10 @@ function setBluetoothEnabled(aEnabled) {
|
|||
return setSettings(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push required permissions and test if |navigator.mozBluetooth| exists.
|
||||
/* Push required permissions and test if |navigator.mozBluetooth| exists.
|
||||
* Resolve if it does, reject otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
* Forfill params:
|
||||
* bluetoothManager -- an reference to navigator.mozBluetooth.
|
||||
* Reject params: (none)
|
||||
*
|
||||
|
@ -156,12 +151,11 @@ function ensureBluetoothManager(aPermissions) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for one named BluetoothManager event.
|
||||
/* Wait for one named BluetoothManager event.
|
||||
*
|
||||
* Resolve if that named event occurs. Never reject.
|
||||
*
|
||||
* Fulfill params: the DOMEvent passed.
|
||||
* Forfill params: the DOMEvent passed.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
|
@ -178,13 +172,12 @@ function waitForManagerEvent(aEventName) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient function for setBluetoothEnabled and waitForManagerEvent
|
||||
/* Convenient function for setBluetoothEnabled and waitForManagerEvent
|
||||
* combined.
|
||||
*
|
||||
* Resolve if that named event occurs. Reject if we can't set settings.
|
||||
*
|
||||
* Fulfill params: the DOMEvent passed.
|
||||
* Forfill params: the DOMEvent passed.
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @return A deferred promise.
|
||||
|
@ -205,12 +198,11 @@ function setBluetoothEnabledAndWait(aEnabled) {
|
|||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default adapter.
|
||||
/* Get default adapter.
|
||||
*
|
||||
* Resolve if that default adapter is got, reject otherwise.
|
||||
*
|
||||
* Fulfill params: a BluetoothAdapter instance.
|
||||
* Forfill params: a BluetoothAdapter instance.
|
||||
* Reject params: a DOMError, or null if if there is no adapter ready yet.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
|
@ -245,8 +237,7 @@ function getDefaultAdapter() {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
/* Flush permission settings and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
SpecialPowers.flushPermissions(function() {
|
||||
|
|
|
@ -1,399 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers;
|
||||
|
||||
const SETTINGS_KEY_DATA_ENABLED = "ril.data.enabled";
|
||||
const SETTINGS_KEY_DATA_ROAMING_ENABLED = "ril.data.roaming_enabled";
|
||||
const SETTINGS_KEY_DATA_APN_SETTINGS = "ril.data.apnSettings";
|
||||
|
||||
let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise;
|
||||
|
||||
let _pendingEmulatorCmdCount = 0;
|
||||
|
||||
/**
|
||||
* Send emulator command with safe guard.
|
||||
*
|
||||
* We should only call |finish()| after all emulator command transactions
|
||||
* end, so here comes with the pending counter. Resolve when the emulator
|
||||
* gives positive response, and reject otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- an array of emulator response lines.
|
||||
* Reject params:
|
||||
* result -- an array of emulator response lines.
|
||||
*
|
||||
* @param aCommand
|
||||
* A string command to be passed to emulator through its telnet console.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function runEmulatorCmdSafe(aCommand) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
++_pendingEmulatorCmdCount;
|
||||
runEmulatorCmd(aCommand, function(aResult) {
|
||||
--_pendingEmulatorCmdCount;
|
||||
|
||||
ok(true, "Emulator response: " + JSON.stringify(aResult));
|
||||
if (Array.isArray(aResult) && aResult[0] === "OK") {
|
||||
deferred.resolve(aResult);
|
||||
} else {
|
||||
deferred.reject(aResult);
|
||||
}
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mozSettings value specified by @aKey.
|
||||
*
|
||||
* Resolve if that mozSettings value is retrieved successfully, reject
|
||||
* otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
* The corresponding mozSettings value of the key.
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aKey
|
||||
* A string.
|
||||
* @param aAllowError [optional]
|
||||
* A boolean value. If set to true, an error response won't be treated
|
||||
* as test failure. Default: false.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function getSettings(aKey, aAllowError) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let request = navigator.mozSettings.createLock().get(aKey);
|
||||
request.addEventListener("success", function(aEvent) {
|
||||
ok(true, "getSettings(" + aKey + ") - success");
|
||||
deferred.resolve(aEvent.target.result[aKey]);
|
||||
});
|
||||
request.addEventListener("error", function() {
|
||||
ok(aAllowError, "getSettings(" + aKey + ") - error");
|
||||
deferred.reject();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mozSettings values.
|
||||
*
|
||||
* Resolve if that mozSettings value is set successfully, reject otherwise.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aSettings
|
||||
* An object of format |{key1: value1, key2: value2, ...}|.
|
||||
* @param aAllowError [optional]
|
||||
* A boolean value. If set to true, an error response won't be treated
|
||||
* as test failure. Default: false.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setSettings(aSettings, aAllowError) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let request = navigator.mozSettings.createLock().set(aSettings);
|
||||
request.addEventListener("success", function() {
|
||||
ok(true, "setSettings(" + JSON.stringify(aSettings) + ")");
|
||||
deferred.resolve();
|
||||
});
|
||||
request.addEventListener("error", function() {
|
||||
ok(aAllowError, "setSettings(" + JSON.stringify(aSettings) + ")");
|
||||
deferred.reject();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mozSettings value with only one key.
|
||||
*
|
||||
* Resolve if that mozSettings value is set successfully, reject otherwise.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aKey
|
||||
* A string key.
|
||||
* @param aValue
|
||||
* An object value.
|
||||
* @param aAllowError [optional]
|
||||
* A boolean value. If set to true, an error response won't be treated
|
||||
* as test failure. Default: false.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setSettings1(aKey, aValue, aAllowError) {
|
||||
let settings = {};
|
||||
settings[aKey] = aValue;
|
||||
return setSettings(settings, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings getter for SETTINGS_KEY_DATA_ENABLED.
|
||||
*/
|
||||
function getDataEnabled(aAllowError) {
|
||||
return getSettings(SETTINGS_KEY_DATA_ENABLED, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings setter for SETTINGS_KEY_DATA_ENABLED.
|
||||
*/
|
||||
function setDataEnabled(aEnabled, aAllowError) {
|
||||
return setSettings1(SETTINGS_KEY_DATA_ENABLED, aEnabled, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings getter for SETTINGS_KEY_DATA_ROAMING_ENABLED.
|
||||
*/
|
||||
function getDataRoamingEnabled(aAllowError) {
|
||||
return getSettings(SETTINGS_KEY_DATA_ROAMING_ENABLED, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings setter for SETTINGS_KEY_DATA_ROAMING_ENABLED.
|
||||
*/
|
||||
function setDataRoamingEnabled(aEnabled, aAllowError) {
|
||||
return setSettings1(SETTINGS_KEY_DATA_ROAMING_ENABLED, aEnabled, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings getter for SETTINGS_KEY_DATA_APN_SETTINGS.
|
||||
*/
|
||||
function getDataApnSettings(aAllowError) {
|
||||
return getSettings(SETTINGS_KEY_DATA_APN_SETTINGS, aAllowError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient MozSettings setter for SETTINGS_KEY_DATA_APN_SETTINGS.
|
||||
*/
|
||||
function setDataApnSettings(aApnSettings, aAllowError) {
|
||||
return setSettings1(SETTINGS_KEY_DATA_APN_SETTINGS, aApnSettings, aAllowError);
|
||||
}
|
||||
|
||||
let mobileConnection;
|
||||
|
||||
/**
|
||||
* Push required permissions and test if
|
||||
* |navigator.mozMobileConnections[<aServiceId>]| exists. Resolve if it does,
|
||||
* reject otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
* mobileConnection -- an reference to navigator.mozMobileMessage.
|
||||
*
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aAdditonalPermissions [optional]
|
||||
* An array of permission strings other than "mobileconnection" to be
|
||||
* pushed. Default: empty string.
|
||||
* @param aServiceId [optional]
|
||||
* A numeric DSDS service id. Default: 0.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function ensureMobileConnection(aAdditionalPermissions, aServiceId) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
aAdditionalPermissions = aAdditionalPermissions || [];
|
||||
aServiceId = aServiceId || 0;
|
||||
|
||||
if (aAdditionalPermissions.indexOf("mobileconnection") < 0) {
|
||||
aAdditionalPermissions.push("mobileconnection");
|
||||
}
|
||||
let permissions = [];
|
||||
for (let perm of aAdditionalPermissions) {
|
||||
permissions.push({ "type": perm, "allow": 1, "context": document });
|
||||
}
|
||||
|
||||
SpecialPowers.pushPermissions(permissions, function() {
|
||||
ok(true, "permissions pushed: " + JSON.stringify(permissions));
|
||||
|
||||
// Permission changes can't change existing Navigator.prototype
|
||||
// objects, so grab our objects from a new Navigator.
|
||||
let ifr = document.createElement("iframe");
|
||||
ifr.addEventListener("load", function load() {
|
||||
ifr.removeEventListener("load", load);
|
||||
|
||||
mobileConnection =
|
||||
ifr.contentWindow.navigator.mozMobileConnections[aServiceId];
|
||||
|
||||
if (mobileConnection) {
|
||||
log("navigator.mozMobileConnections[" + aServiceId + "] is instance of " +
|
||||
mobileConnection.constructor);
|
||||
} else {
|
||||
log("navigator.mozMobileConnections[" + aServiceId + "] is undefined");
|
||||
}
|
||||
|
||||
if (mobileConnection instanceof MozMobileConnection) {
|
||||
deferred.resolve(mobileConnection);
|
||||
} else {
|
||||
deferred.reject();
|
||||
}
|
||||
});
|
||||
|
||||
document.body.appendChild(ifr);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for one named MobileConnection event.
|
||||
*
|
||||
* Resolve if that named event occurs. Never reject.
|
||||
*
|
||||
* Fulfill params: the DOMEvent passed.
|
||||
*
|
||||
* @param aEventName
|
||||
* A string event name.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function waitForManagerEvent(aEventName) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
mobileConnection.addEventListener(aEventName, function onevent(aEvent) {
|
||||
mobileConnection.removeEventListener(aEventName, onevent);
|
||||
|
||||
ok(true, "MobileConnection event '" + aEventName + "' got.");
|
||||
deferred.resolve(aEvent);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set data connection enabling state and wait for "datachange" event.
|
||||
*
|
||||
* Resolve if data connection state changed to the expected one. Never reject.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
*
|
||||
* @param aEnabled
|
||||
* A boolean state.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setDataEnabledAndWait(aEnabled) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let promises = [];
|
||||
promises.push(waitForManagerEvent("datachange"));
|
||||
promises.push(setDataEnabled(aEnabled));
|
||||
Promise.all(promises).then(function keepWaiting() {
|
||||
// To ignore some transient states, we only resolve that deferred promise
|
||||
// when the |connected| state equals to the expected one and never rejects.
|
||||
let connected = mobileConnection.data.connected;
|
||||
if (connected == aEnabled) {
|
||||
deferred.resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
return waitForManagerEvent("datachange").then(keepWaiting);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set voice/data roaming emulation and wait for state change.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
*
|
||||
* @param aRoaming
|
||||
* A boolean state.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setEmulatorRoamingAndWait(aRoaming) {
|
||||
function doSetAndWait(aWhich, aRoaming) {
|
||||
let promises = [];
|
||||
promises.push(waitForManagerEvent(aWhich + "change"));
|
||||
|
||||
let cmd = "gsm " + aWhich + " " + (aRoaming ? "roaming" : "home");
|
||||
promises.push(runEmulatorCmdSafe(cmd));
|
||||
return Promise.all(promises)
|
||||
.then(() => is(mobileConnection[aWhich].roaming, aRoaming,
|
||||
aWhich + ".roaming"));
|
||||
}
|
||||
|
||||
// Set voice registration state first and then data registration state.
|
||||
return doSetAndWait("voice", aRoaming)
|
||||
.then(() => doSetAndWait("data", aRoaming));
|
||||
}
|
||||
|
||||
let _networkManager;
|
||||
|
||||
/**
|
||||
* Get internal NetworkManager service.
|
||||
*/
|
||||
function getNetworkManager() {
|
||||
if (!_networkManager) {
|
||||
_networkManager = Cc["@mozilla.org/network/manager;1"]
|
||||
.getService(Ci.nsINetworkManager);
|
||||
ok(_networkManager, "NetworkManager");
|
||||
}
|
||||
|
||||
return _networkManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
waitFor(function() {
|
||||
SpecialPowers.flushPermissions(function() {
|
||||
// Use ok here so that we have at least one test run.
|
||||
ok(true, "permissions flushed");
|
||||
|
||||
finish();
|
||||
});
|
||||
}, function() {
|
||||
return _pendingEmulatorCmdCount === 0;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic test routine helper for mobile connection tests.
|
||||
*
|
||||
* This helper does nothing but clean-ups.
|
||||
*
|
||||
* @param aTestCaseMain
|
||||
* A function that takes no parameter.
|
||||
*/
|
||||
function startTestBase(aTestCaseMain) {
|
||||
Promise.resolve()
|
||||
.then(aTestCaseMain)
|
||||
.then(cleanUp, function() {
|
||||
ok(false, 'promise rejects during test.');
|
||||
cleanUp();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Common test routine helper for mobile connection tests.
|
||||
*
|
||||
* This function ensures global |mobileConnection| variable is available during
|
||||
* the process and performs clean-ups as well.
|
||||
*
|
||||
* @param aTestCaseMain
|
||||
* A function that takes one parameter -- mobileConnection.
|
||||
* @param aAdditonalPermissions [optional]
|
||||
* An array of permission strings other than "mobileconnection" to be
|
||||
* pushed. Default: empty string.
|
||||
* @param aServiceId [optional]
|
||||
* A numeric DSDS service id. Default: 0.
|
||||
*/
|
||||
function startTestCommon(aTestCaseMain, aAdditionalPermissions, aServiceId) {
|
||||
startTestBase(function() {
|
||||
return ensureMobileConnection(aAdditionalPermissions, aServiceId)
|
||||
.then(aTestCaseMain);
|
||||
});
|
||||
}
|
|
@ -23,5 +23,3 @@ disabled = Bug 808783
|
|||
[test_mobile_last_known_network.js]
|
||||
[test_mobile_icc_change.js]
|
||||
[test_mobile_connections_array_uninitialized.js]
|
||||
[test_mobile_data_ipv6.js]
|
||||
disabled = Bug 978071
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
/**
|
||||
* Test resulting IP address format with given APN settings.
|
||||
*
|
||||
* This test utility function performs following steps:
|
||||
*
|
||||
* 1) set "ril.data.apnSettings" to a given settings object,
|
||||
* 2) enable data connection and wait for a "datachange" event,
|
||||
* 3) check the IP address type of the active network interface,
|
||||
* 4) disable data connection.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Reject params: (none)
|
||||
*
|
||||
* @param aApnSettings
|
||||
* An APN settings value.
|
||||
* @param aIsIPv6
|
||||
* A boolean value indicating whether we're expecting an IPv6 address.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function doTest(aApnSettings, aIsIPv6) {
|
||||
return setDataApnSettings([])
|
||||
.then(() => setDataApnSettings(aApnSettings))
|
||||
.then(() => setDataEnabledAndWait(true))
|
||||
.then(function() {
|
||||
let nm = getNetworkManager();
|
||||
let active = nm.active;
|
||||
ok(active, "Active network interface");
|
||||
|
||||
log(" Interface: " + active.name);
|
||||
log(" Address: " + active.ip);
|
||||
if (aIsIPv6) {
|
||||
ok(active.ip.indexOf(":") > 0, "IPv6 address");
|
||||
} else {
|
||||
ok(active.ip.indexOf(":") < 0, "IPv4 address");
|
||||
}
|
||||
})
|
||||
.then(() => setDataEnabledAndWait(false));
|
||||
}
|
||||
|
||||
function doTestHome(aApnSettings, aProtocol) {
|
||||
log("Testing \"" + aProtocol + "\"@HOME... ");
|
||||
|
||||
// aApnSettings is a double-array of per PDP context settings. The first
|
||||
// index is a DSDS service ID, and the second one is the index of pre-defined
|
||||
// PDP context settings of a specified radio interface. We use 0 for both as
|
||||
// default here.
|
||||
aApnSettings[0][0].protocol = aProtocol;
|
||||
delete aApnSettings[0][0].roaming_protocol;
|
||||
|
||||
return doTest(aApnSettings, aProtocol === "IPV6");
|
||||
}
|
||||
|
||||
function doTestRoaming(aApnSettings, aRoaminProtocol) {
|
||||
log("Testing \"" + aRoaminProtocol + "\"@ROMAING... ");
|
||||
|
||||
// aApnSettings is a double-array of per PDP context settings. The first
|
||||
// index is a DSDS service ID, and the second one is the index of pre-defined
|
||||
// PDP context settings of a specified radio interface. We use 0 for both as
|
||||
// default here.
|
||||
delete aApnSettings[0][0].protocol;
|
||||
aApnSettings[0][0].roaming_protocol = aRoaminProtocol;
|
||||
|
||||
return doTest(aApnSettings, aRoaminProtocol === "IPV6");
|
||||
}
|
||||
|
||||
startTestCommon(function() {
|
||||
let origApnSettings;
|
||||
|
||||
return setDataRoamingEnabled(true)
|
||||
.then(getDataApnSettings)
|
||||
.then(function(aResult) {
|
||||
// If already set, then save original APN settings.
|
||||
origApnSettings = JSON.parse(JSON.stringify(aResult));
|
||||
return aResult;
|
||||
}, function() {
|
||||
// Return our own default value.
|
||||
return [[{ "carrier": "T-Mobile US",
|
||||
"apn": "epc.tmobile.com",
|
||||
"mmsc": "http://mms.msg.eng.t-mobile.com/mms/wapenc",
|
||||
"types": ["default", "supl", "mms"] }]];
|
||||
})
|
||||
|
||||
.then(function(aApnSettings) {
|
||||
return Promise.resolve()
|
||||
|
||||
.then(() => doTestHome(aApnSettings, "NoSuchProtocol"))
|
||||
.then(() => doTestHome(aApnSettings, "IP"))
|
||||
.then(() => doTestHome(aApnSettings, "IPV6"))
|
||||
|
||||
.then(() => setEmulatorRoamingAndWait(true))
|
||||
|
||||
.then(() => doTestRoaming(aApnSettings, "NoSuchProtocol"))
|
||||
.then(() => doTestRoaming(aApnSettings, "IP"))
|
||||
.then(() => doTestRoaming(aApnSettings, "IPV6"))
|
||||
|
||||
.then(() => setEmulatorRoamingAndWait(false));
|
||||
})
|
||||
|
||||
.then(() => setDataRoamingEnabled(false))
|
||||
.then(function() {
|
||||
if (origApnSettings) {
|
||||
return setDataApnSettings(origApnSettings);
|
||||
}
|
||||
});
|
||||
}, ["settings-read", "settings-write"]);
|
|
@ -5,8 +5,7 @@ const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers;
|
|||
|
||||
let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise;
|
||||
|
||||
/**
|
||||
* Push required permissions and test if |navigator.mozMobileMessage| exists.
|
||||
/* Push required permissions and test if |navigator.mozMobileMessage| exists.
|
||||
* Resolve if it does, reject otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
|
@ -45,8 +44,7 @@ function ensureMobileMessage() {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a SMS message to a single receiver. Resolve if it succeeds, reject
|
||||
/* Send a SMS message to a single receiver. Resolve if it succeeds, reject
|
||||
* otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
|
@ -74,8 +72,7 @@ function sendSmsWithSuccess(aReceiver, aText) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a MMS message with specified parameters. Resolve if it fails, reject
|
||||
/* Send a MMS message with specified parameters. Resolve if it fails, reject
|
||||
* otherwise.
|
||||
*
|
||||
* Fulfill params:
|
||||
|
@ -103,8 +100,7 @@ function sendMmsWithFailure(aMmsParameters) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve messages from database.
|
||||
/* Retrieve messages from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* messages -- an array of {Sms,Mms}Message instances.
|
||||
|
@ -140,8 +136,7 @@ function getMessages(aFilter, aReverse) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all messages from database.
|
||||
/* Retrieve all messages from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* messages -- an array of {Sms,Mms}Message instances.
|
||||
|
@ -155,8 +150,7 @@ function getAllMessages() {
|
|||
return getMessages(null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all threads from database.
|
||||
/* Retrieve all threads from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* threads -- an array of MozMobileMessageThread instances.
|
||||
|
@ -185,8 +179,7 @@ function getAllThreads() {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a single specified thread from database.
|
||||
/* Retrieve a single specified thread from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* thread -- a MozMobileMessageThread instance.
|
||||
|
@ -211,8 +204,7 @@ function getThreadById(aThreadId) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete messages specified from database.
|
||||
/* Delete messages specified from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- an array of boolean values indicating whether delesion was
|
||||
|
@ -242,8 +234,7 @@ function deleteMessagesById(aMessageIds) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete messages specified from database.
|
||||
/* Delete messages specified from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- an array of boolean values indicating whether delesion was
|
||||
|
@ -261,8 +252,7 @@ function deleteMessages(aMessages) {
|
|||
return deleteMessagesById(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all messages from database.
|
||||
/* Delete all messages from database.
|
||||
*
|
||||
* Fulfill params:
|
||||
* ids -- an array of numeric values identifying those deleted
|
||||
|
@ -279,8 +269,7 @@ function deleteAllMessages() {
|
|||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
|
||||
/**
|
||||
* Send emulator command with safe guard.
|
||||
/* Send emulator command with safe guard.
|
||||
*
|
||||
* We should only call |finish()| after all emulator command transactions
|
||||
* end, so here comes with the pending counter. Resolve when the emulator
|
||||
|
@ -312,8 +301,7 @@ function runEmulatorCmdSafe(aCommand) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send simple text SMS to emulator.
|
||||
/* Send simple text SMS to emulator.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- an array of emulator response lines.
|
||||
|
@ -328,8 +316,7 @@ function sendTextSmsToEmulator(aFrom, aText) {
|
|||
return runEmulatorCmdSafe(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send raw SMS TPDU to emulator.
|
||||
/* Send raw SMS TPDU to emulator.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- an array of emulator response lines.
|
||||
|
@ -344,8 +331,7 @@ function sendRawSmsToEmulator(aPdu) {
|
|||
return runEmulatorCmdSafe(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Name space for MobileMessageDB.jsm. Only initialized after first call to
|
||||
/* Name space for MobileMessageDB.jsm. Only initialized after first call to
|
||||
* newMobileMessageDB.
|
||||
*/
|
||||
let MMDB;
|
||||
|
@ -362,8 +348,7 @@ function newMobileMessageDB() {
|
|||
return mmdb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a MobileMessageDB. Resolve if initialized with success, reject
|
||||
/* Initialize a MobileMessageDB. Resolve if initialized with success, reject
|
||||
* otherwise.
|
||||
*
|
||||
* Fulfill params: a MobileMessageDB instance.
|
||||
|
@ -393,8 +378,7 @@ function initMobileMessageDB(aMmdb, aDbName, aDbVersion) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close a MobileMessageDB.
|
||||
/* Close a MobileMessageDB.
|
||||
*
|
||||
* @return The passed MobileMessageDB instance.
|
||||
*/
|
||||
|
@ -403,8 +387,7 @@ function closeMobileMessageDB(aMmdb) {
|
|||
return aMmdb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new array of id attribute of input messages.
|
||||
/* Create a new array of id attribute of input messages.
|
||||
*
|
||||
* @param aMessages an array of {Sms,Mms}Message instances.
|
||||
*
|
||||
|
@ -421,8 +404,7 @@ function messagesToIds(aMessages) {
|
|||
// A reference to a nsIUUIDGenerator service.
|
||||
let uuidGenerator;
|
||||
|
||||
/**
|
||||
* Generate a new UUID.
|
||||
/* Generate a new UUID.
|
||||
*
|
||||
* @return A UUID string.
|
||||
*/
|
||||
|
@ -436,8 +418,7 @@ function newUUID() {
|
|||
return uuidGenerator.generateUUID().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush permission settings and call |finish()|.
|
||||
/* Flush permission settings and call |finish()|.
|
||||
*/
|
||||
function cleanUp() {
|
||||
waitFor(function() {
|
||||
|
@ -452,14 +433,6 @@ function cleanUp() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic test routine helper for mobile message tests.
|
||||
*
|
||||
* This helper does nothing but clean-ups.
|
||||
*
|
||||
* @param aTestCaseMain
|
||||
* A function that takes no parameter.
|
||||
*/
|
||||
function startTestBase(aTestCaseMain) {
|
||||
Promise.resolve()
|
||||
.then(aTestCaseMain)
|
||||
|
@ -469,15 +442,6 @@ function startTestBase(aTestCaseMain) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Common test routine helper for mobile message tests.
|
||||
*
|
||||
* This function ensures global |manager| variable is available during the
|
||||
* process and performs clean-ups as well.
|
||||
*
|
||||
* @param aTestCaseMain
|
||||
* A function that takes no parameter.
|
||||
*/
|
||||
function startTestCommon(aTestCaseMain) {
|
||||
startTestBase(function() {
|
||||
return ensureMobileMessage()
|
||||
|
|
|
@ -4525,22 +4525,12 @@ RILNetworkInterface.prototype = {
|
|||
}
|
||||
authType = RIL.RIL_DATACALL_AUTH_TO_GECKO.indexOf(RIL.GECKO_DATACALL_AUTH_DEFAULT);
|
||||
}
|
||||
let pdptype = !radioInterface.rilContext.data.roaming
|
||||
? this.apnSetting.protocol
|
||||
: this.apnSetting.roaming_protocol;
|
||||
if (RIL.RIL_DATACALL_PDP_TYPES.indexOf(pdptype) < 0) {
|
||||
if (DEBUG) {
|
||||
this.debug("Invalid pdptype '" + pdptype + "', using '" +
|
||||
RIL.GECKO_DATACALL_PDP_TYPE_DEFAULT + "'");
|
||||
}
|
||||
pdptype = RIL.GECKO_DATACALL_PDP_TYPE_DEFAULT;
|
||||
}
|
||||
radioInterface.setupDataCall(radioTechnology,
|
||||
this.apnSetting.apn,
|
||||
this.apnSetting.user,
|
||||
this.apnSetting.password,
|
||||
authType,
|
||||
pdptype);
|
||||
"IP");
|
||||
this.connecting = true;
|
||||
},
|
||||
|
||||
|
|
|
@ -2361,15 +2361,6 @@ this.RIL_DATACALL_AUTH_TO_GECKO = [
|
|||
GECKO_DATACALL_AUTH_PAP_OR_CHAP // DATACALL_AUTH_PAP_OR_CHAP
|
||||
];
|
||||
|
||||
this.GECKO_DATACALL_PDP_TYPE_IP = "IP";
|
||||
this.GECKO_DATACALL_PDP_TYPE_IPV6 = "IPV6";
|
||||
this.GECKO_DATACALL_PDP_TYPE_DEFAULT = GECKO_DATACALL_PDP_TYPE_IP;
|
||||
this.RIL_DATACALL_PDP_TYPES = [
|
||||
GECKO_DATACALL_PDP_TYPE_IP,
|
||||
GECKO_DATACALL_PDP_TYPE_IPV6,
|
||||
// TODO: Bug 978711 - Support IPV4V6
|
||||
];
|
||||
|
||||
this.DATACALL_PROFILE_DEFAULT = 0;
|
||||
this.DATACALL_PROFILE_TETHERED = 1;
|
||||
this.DATACALL_PROFILE_OEM_BASE = 1000;
|
||||
|
|
|
@ -3962,9 +3962,8 @@ RilObject.prototype = {
|
|||
}
|
||||
currentDataCall.gw = updatedDataCall.gw;
|
||||
if (updatedDataCall.dns) {
|
||||
currentDataCall.dns = updatedDataCall.dns.slice();
|
||||
} else {
|
||||
currentDataCall.dns = [];
|
||||
currentDataCall.dns[0] = updatedDataCall.dns[0];
|
||||
currentDataCall.dns[1] = updatedDataCall.dns[1];
|
||||
}
|
||||
currentDataCall.rilMessageType = "datacallstatechange";
|
||||
this.sendChromeMessage(currentDataCall);
|
||||
|
|
Загрузка…
Ссылка в новой задаче