mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1100200 - Part 5: Merge emergency and radio-off related tests. r=hsinyi
This commit is contained in:
parent
79380f89c8
commit
4139e9a79b
@ -1046,6 +1046,10 @@ let emulator = (function() {
|
||||
let desiredRadioState = enabled ? 'enabled' : 'disabled';
|
||||
log("Set radio: " + desiredRadioState);
|
||||
|
||||
if (connection.radioState === desiredRadioState) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
let promises = [];
|
||||
|
||||
let promise = gWaitForEvent(connection, "radiostatechange", event => {
|
||||
|
@ -21,7 +21,6 @@ qemu = true
|
||||
[test_dsds_default_service_id.js]
|
||||
[test_dsds_normal_call.js]
|
||||
[test_emergency.js]
|
||||
[test_emergency_badNumber.js]
|
||||
[test_emergency_label.js]
|
||||
[test_incall_mmi_call_hold.js]
|
||||
[test_incall_mmi_call_waiting.js]
|
||||
@ -44,8 +43,6 @@ qemu = true
|
||||
[test_outgoing_badNumber.js]
|
||||
[test_outgoing_basic_operations.js]
|
||||
[test_outgoing_busy.js]
|
||||
[test_outgoing_emergency_in_airplane_mode.js]
|
||||
[test_outgoing_error_state.js]
|
||||
[test_outgoing_onstatechange.js]
|
||||
[test_outgoing_radio_off.js]
|
||||
[test_outgoing_when_two_calls_on_line.js]
|
||||
|
@ -4,13 +4,36 @@
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
startTest(function() {
|
||||
let outCall;
|
||||
let outCall;
|
||||
|
||||
gDialEmergency("911")
|
||||
function testEmergencyNumber() {
|
||||
return gDialEmergency("911")
|
||||
.then(call => outCall = call)
|
||||
.then(() => gRemoteAnswer(outCall))
|
||||
.then(() => gHangUp(outCall))
|
||||
.then(() => gHangUp(outCall));
|
||||
}
|
||||
|
||||
function testNormalNumber() {
|
||||
return gDialEmergency("0912345678")
|
||||
.catch(cause => {
|
||||
is(cause, "BadNumberError");
|
||||
return gCheckAll(null, [], "", [], []);
|
||||
});
|
||||
}
|
||||
|
||||
function testBadNumber() {
|
||||
return gDialEmergency("not a valid emergency number")
|
||||
.catch(cause => {
|
||||
is(cause, "BadNumberError");
|
||||
return gCheckAll(null, [], "", [], []);
|
||||
});
|
||||
}
|
||||
|
||||
startTest(function() {
|
||||
Promise.resolve()
|
||||
.then(() => testEmergencyNumber())
|
||||
.then(() => testNormalNumber())
|
||||
.then(() => testBadNumber())
|
||||
.catch(error => ok(false, "Promise reject: " + error))
|
||||
.then(finish);
|
||||
});
|
||||
|
@ -1,15 +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';
|
||||
|
||||
startTest(function() {
|
||||
gDialEmergency("not a valid emergency number")
|
||||
.catch(cause => {
|
||||
is(cause, "BadNumberError");
|
||||
return gCheckAll(null, [], "", [], []);
|
||||
})
|
||||
.catch(error => ok(false, "Promise reject: " + error))
|
||||
.then(finish);
|
||||
});
|
@ -1,22 +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';
|
||||
|
||||
startTestWithPermissions(['mobileconnection'], function() {
|
||||
let connection = navigator.mozMobileConnections[0];
|
||||
ok(connection instanceof MozMobileConnection,
|
||||
"connection is instanceof " + connection.constructor);
|
||||
|
||||
let outCall;
|
||||
|
||||
gSetRadioEnabled(connection, false)
|
||||
.then(() => gDial("112"))
|
||||
.then(call => { outCall = call; })
|
||||
.then(() => gRemoteAnswer(outCall))
|
||||
.then(() => gDelay(1000)) // See Bug 1018051 for the purpose of the delay.
|
||||
.then(() => gRemoteHangUp(outCall))
|
||||
.catch(error => ok(false, "Promise reject: " + error))
|
||||
.then(finish);
|
||||
});
|
@ -1,25 +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';
|
||||
|
||||
const number = "0912345678";
|
||||
|
||||
startTestWithPermissions(['mobileconnection'], function() {
|
||||
let connection = navigator.mozMobileConnections[0];
|
||||
ok(connection instanceof MozMobileConnection,
|
||||
"connection is instanceof " + connection.constructor);
|
||||
|
||||
let outCall;
|
||||
|
||||
gSetRadioEnabled(connection, false)
|
||||
.then(() => gDial(number))
|
||||
.then(null, cause => { is(cause, "RadioNotAvailable"); })
|
||||
.then(() => gDialEmergency(number))
|
||||
.then(null, cause => { is(cause, "RadioNotAvailable"); })
|
||||
.then(() => gSetRadioEnabled(connection, true))
|
||||
.then(() => gDialEmergency(number))
|
||||
.then(null, cause => { is(cause, "BadNumberError"); })
|
||||
.then(finish);
|
||||
});
|
@ -4,18 +4,57 @@
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
let connection;
|
||||
const normalNumber = "0912345678";
|
||||
const emergencyNumber = "112";
|
||||
let outCall;
|
||||
|
||||
function testDial_NormalNumber() {
|
||||
return gSetRadioEnabled(connection, false)
|
||||
.then(() => gDial(normalNumber))
|
||||
.catch(cause => {
|
||||
is(cause, "RadioNotAvailable");
|
||||
return gCheckAll(null, [], "", [], []);
|
||||
});
|
||||
}
|
||||
|
||||
function testDial_EmergencyNumber() {
|
||||
return gSetRadioEnabled(connection, false)
|
||||
.then(() => gDial(emergencyNumber))
|
||||
.then(call => { outCall = call; })
|
||||
.then(() => gRemoteAnswer(outCall))
|
||||
.then(() => gDelay(1000)) // See Bug 1018051 for the purpose of the delay.
|
||||
.then(() => gRemoteHangUp(outCall));
|
||||
}
|
||||
|
||||
function testDialEmergency_NormalNumber() {
|
||||
return gSetRadioEnabled(connection, false)
|
||||
.then(() => gDialEmergency(normalNumber))
|
||||
.catch(cause => {
|
||||
is(cause, "RadioNotAvailable");
|
||||
return gCheckAll(null, [], "", [], []);
|
||||
});
|
||||
}
|
||||
|
||||
function testDialEmergency_EmergencyNumber() {
|
||||
return gSetRadioEnabled(connection, false)
|
||||
.then(() => gDialEmergency(emergencyNumber))
|
||||
.then(call => { outCall = call; })
|
||||
.then(() => gRemoteAnswer(outCall))
|
||||
.then(() => gDelay(1000)) // See Bug 1018051 for the purpose of the delay.
|
||||
.then(() => gRemoteHangUp(outCall));
|
||||
}
|
||||
|
||||
startTestWithPermissions(['mobileconnection'], function() {
|
||||
let connection = navigator.mozMobileConnections[0];
|
||||
connection = navigator.mozMobileConnections[0];
|
||||
ok(connection instanceof MozMobileConnection,
|
||||
"connection is instanceof " + connection.constructor);
|
||||
|
||||
gSetRadioEnabled(connection, false)
|
||||
.then(() => gDial("0912345678"))
|
||||
.catch(cause => {
|
||||
is(telephony.active, null);
|
||||
is(telephony.calls.length, 0);
|
||||
is(cause, "RadioNotAvailable");
|
||||
})
|
||||
Promise.resolve()
|
||||
.then(() => testDial_NormalNumber())
|
||||
.then(() => testDial_EmergencyNumber())
|
||||
.then(() => testDialEmergency_NormalNumber())
|
||||
.then(() => testDialEmergency_EmergencyNumber())
|
||||
.then(() => gSetRadioEnabled(connection, true))
|
||||
.catch(error => ok(false, "Promise reject: " + error))
|
||||
.then(finish);
|
||||
|
Loading…
Reference in New Issue
Block a user