mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 999458 - 2.b/2: add two more utility functions to head.js. r=echen
* setEmulatorGsmLocationAndWait * setEmulatorOperatorNamesAndWait
This commit is contained in:
parent
17c91840d6
commit
3698eed827
@ -547,6 +547,33 @@ function setEmulatorGsmLocation(aLac, aCid) {
|
||||
return runEmulatorCmdSafe(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set GSM location and wait for voice and/or data state change.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
*
|
||||
* @param aLac
|
||||
* @param aCid
|
||||
* @param aWaitVoice [optional]
|
||||
* A boolean value. Default true.
|
||||
* @param aWaitData [optional]
|
||||
* A boolean value. Default false.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setEmulatorGsmLocationAndWait(aLac, aCid,
|
||||
aWaitVoice = true, aWaitData = false) {
|
||||
let promises = [];
|
||||
if (aWaitVoice) {
|
||||
promises.push(waitForManagerEvent("voicechange"));
|
||||
}
|
||||
if (aWaitData) {
|
||||
promises.push(waitForManagerEvent("datachange"));
|
||||
}
|
||||
promises.push(setEmulatorGsmLocation(aLac, aCid));
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get emulator operators info.
|
||||
*
|
||||
@ -622,6 +649,43 @@ function setEmulatorOperatorNames(aOperator, aLongName, aShortName, aMcc, aMnc)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set emulator operators info and wait for voice and/or data state change.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
*
|
||||
* @param aOperator
|
||||
* "home" or "roaming".
|
||||
* @param aLongName
|
||||
* A string.
|
||||
* @param aShortName
|
||||
* A string.
|
||||
* @param aMcc [optional]
|
||||
* A string.
|
||||
* @param aMnc [optional]
|
||||
* A string.
|
||||
* @param aWaitVoice [optional]
|
||||
* A boolean value. Default true.
|
||||
* @param aWaitData [optional]
|
||||
* A boolean value. Default false.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setEmulatorOperatorNamesAndWait(aOperator, aLongName, aShortName,
|
||||
aMcc, aMnc,
|
||||
aWaitVoice = true, aWaitData = false) {
|
||||
let promises = [];
|
||||
if (aWaitVoice) {
|
||||
promises.push(waitForManagerEvent("voicechange"));
|
||||
}
|
||||
if (aWaitData) {
|
||||
promises.push(waitForManagerEvent("datachange"));
|
||||
}
|
||||
promises.push(setEmulatorOperatorNames(aOperator, aLongName, aShortName,
|
||||
aMcc, aMnc));
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
let _networkManager;
|
||||
|
||||
/**
|
||||
|
@ -26,10 +26,7 @@ function testDataCellLocationUpdate(aLac, aCid) {
|
||||
// Set emulator's lac/cid and wait for 'ondatachange' event.
|
||||
log("Test cell location with lac=" + aLac + " and cid=" + aCid);
|
||||
|
||||
let promises = [];
|
||||
promises.push(waitForManagerEvent("datachange"));
|
||||
promises.push(setEmulatorGsmLocation(aLac, aCid));
|
||||
return Promise.all(promises)
|
||||
return setEmulatorGsmLocationAndWait(aLac, aCid, false, true)
|
||||
.then(() => verifyDataCellLocationInfo(aLac, aCid));
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,8 @@ function check(aLongName, aShortName) {
|
||||
function test(aLongName, aShortName) {
|
||||
log("Testing '" + aLongName + "', '" + aShortName + "':");
|
||||
|
||||
let promises = [];
|
||||
promises.push(waitForManagerEvent("voicechange"));
|
||||
promises.push(setEmulatorOperatorNames("home", aLongName, aShortName));
|
||||
return Promise.all(promises)
|
||||
return setEmulatorOperatorNamesAndWait("home", aLongName, aShortName,
|
||||
null, null, true, false)
|
||||
.then(() => check(aLongName, aShortName));
|
||||
}
|
||||
|
||||
|
@ -17,10 +17,8 @@ function test(aLongName, aShortName, aMcc, aMnc, aExpectedLongName,
|
||||
aExpectedShortName) {
|
||||
log("Testing mcc = " + aMcc + ", mnc = " + aMnc + ":");
|
||||
|
||||
let promises = [];
|
||||
promises.push(waitForManagerEvent("voicechange"));
|
||||
promises.push(setEmulatorOperatorNames("home", aLongName, aShortName, aMcc, aMnc));
|
||||
return Promise.all(promises)
|
||||
return setEmulatorOperatorNamesAndWait("home", aLongName, aShortName,
|
||||
aMcc, aMnc, true, false)
|
||||
.then(() => check(aExpectedLongName, aExpectedShortName, aMcc, aMnc));
|
||||
}
|
||||
|
||||
|
@ -13,13 +13,6 @@ function check(aLongName, aShortName, aRoaming) {
|
||||
is(voice.roaming, aRoaming, "voice.roaming");
|
||||
}
|
||||
|
||||
function setEmulatorOperatorNamesAndWait(aWhich, aLongName, aShortName) {
|
||||
let promises = [];
|
||||
promises.push(waitForManagerEvent("voicechange"));
|
||||
promises.push(setEmulatorOperatorNames(aWhich, aLongName, aShortName));
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
// See bug 797972 - B2G RIL: False roaming situation
|
||||
//
|
||||
// Steps to test:
|
||||
@ -34,7 +27,8 @@ function test(aLongName, aShortName, aRoaming) {
|
||||
return Promise.resolve()
|
||||
|
||||
// We should not have voicechange here, but, yes, we do.
|
||||
.then(() => setEmulatorOperatorNamesAndWait("roaming", aLongName, aShortName))
|
||||
.then(() => setEmulatorOperatorNamesAndWait("roaming", aLongName, aShortName,
|
||||
null, null, true, false))
|
||||
|
||||
.then(() => setEmulatorVoiceDataStateAndWait("voice", "roaming"))
|
||||
.then(() => check(aLongName, aShortName, aRoaming))
|
||||
|
@ -26,10 +26,7 @@ function testVoiceCellLocationUpdate(aLac, aCid) {
|
||||
// Set emulator's lac/cid and wait for 'onvoicechange' event.
|
||||
log("Test cell location with lac=" + aLac + " and cid=" + aCid);
|
||||
|
||||
let promises = [];
|
||||
promises.push(waitForManagerEvent("voicechange"));
|
||||
promises.push(setEmulatorGsmLocation(aLac, aCid));
|
||||
return Promise.all(promises)
|
||||
return setEmulatorGsmLocationAndWait(aLac, aCid, true, false)
|
||||
.then(() => verifyVoiceCellLocationInfo(aLac, aCid));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user