зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1124732 - Make test_outgoing_radio_off.js supporting running on emulator-kk. r=aknow
This commit is contained in:
Родитель
1e15e12fff
Коммит
c1c5575e48
|
@ -4,13 +4,27 @@
|
|||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
let connection;
|
||||
const normalNumber = "0912345678";
|
||||
const emergencyNumber = "112";
|
||||
let outCall;
|
||||
|
||||
function setRadioEnabledAll(enabled) {
|
||||
let promises = [];
|
||||
let numOfSim = navigator.mozMobileConnections.length;
|
||||
|
||||
for (let i = 0; i < numOfSim; i++) {
|
||||
let connection = navigator.mozMobileConnections[i];
|
||||
ok(connection instanceof MozMobileConnection,
|
||||
"connection[" + i + "] is instanceof " + connection.constructor);
|
||||
|
||||
promises.push(gSetRadioEnabled(connection, enabled));
|
||||
}
|
||||
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
function testDial_NormalNumber() {
|
||||
return gSetRadioEnabled(connection, false)
|
||||
return setRadioEnabledAll(false)
|
||||
.then(() => gDial(normalNumber))
|
||||
.catch(cause => {
|
||||
is(cause, "RadioNotAvailable");
|
||||
|
@ -19,7 +33,7 @@ function testDial_NormalNumber() {
|
|||
}
|
||||
|
||||
function testDial_EmergencyNumber() {
|
||||
return gSetRadioEnabled(connection, false)
|
||||
return setRadioEnabledAll(false)
|
||||
.then(() => gDial(emergencyNumber))
|
||||
.then(call => { outCall = call; })
|
||||
.then(() => gRemoteAnswer(outCall))
|
||||
|
@ -28,7 +42,7 @@ function testDial_EmergencyNumber() {
|
|||
}
|
||||
|
||||
function testDialEmergency_NormalNumber() {
|
||||
return gSetRadioEnabled(connection, false)
|
||||
return setRadioEnabledAll(false)
|
||||
.then(() => gDialEmergency(normalNumber))
|
||||
.catch(cause => {
|
||||
is(cause, "RadioNotAvailable");
|
||||
|
@ -37,7 +51,7 @@ function testDialEmergency_NormalNumber() {
|
|||
}
|
||||
|
||||
function testDialEmergency_EmergencyNumber() {
|
||||
return gSetRadioEnabled(connection, false)
|
||||
return setRadioEnabledAll(false)
|
||||
.then(() => gDialEmergency(emergencyNumber))
|
||||
.then(call => { outCall = call; })
|
||||
.then(() => gRemoteAnswer(outCall))
|
||||
|
@ -46,16 +60,12 @@ function testDialEmergency_EmergencyNumber() {
|
|||
}
|
||||
|
||||
startTestWithPermissions(['mobileconnection'], function() {
|
||||
connection = navigator.mozMobileConnections[0];
|
||||
ok(connection instanceof MozMobileConnection,
|
||||
"connection is instanceof " + connection.constructor);
|
||||
|
||||
Promise.resolve()
|
||||
.then(() => testDial_NormalNumber())
|
||||
.then(() => testDial_EmergencyNumber())
|
||||
.then(() => testDialEmergency_NormalNumber())
|
||||
.then(() => testDialEmergency_EmergencyNumber())
|
||||
.then(() => gSetRadioEnabled(connection, true))
|
||||
.then(() => setRadioEnabledAll(true))
|
||||
.catch(error => ok(false, "Promise reject: " + error))
|
||||
.then(finish);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче