зеркало из https://github.com/mozilla/gecko-dev.git
Bug 898445 - Part 6-3: Add marionette test cases for call forwarding. r=hsinyi
This commit is contained in:
Родитель
1dcaebdd73
Коммит
2152a24a7f
|
@ -505,6 +505,45 @@ function sendMMI(aMmi) {
|
|||
.then(() => request.result, () => { throw request.error });
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures call forward options.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Reject params:
|
||||
* 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter', or
|
||||
* 'GenericFailure'.
|
||||
*
|
||||
* @param aOptions
|
||||
* A MozCallForwardingOptions.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function setCallForwardingOption(aOptions) {
|
||||
let request = mobileConnection.setCallForwardingOption(aOptions);
|
||||
return wrapDomRequestAsPromise(request)
|
||||
.then(null, () => { throw request.error });
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures call forward options.
|
||||
*
|
||||
* Fulfill params:
|
||||
* An array of MozCallForwardingOptions.
|
||||
* Reject params:
|
||||
* 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter', or
|
||||
* 'GenericFailure'.
|
||||
*
|
||||
* @param aReason
|
||||
* One of MozMobileConnection.CALL_FORWARD_REASON_* values.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function getCallForwardingOption(aReason) {
|
||||
let request = mobileConnection.getCallForwardingOption(aReason);
|
||||
return wrapDomRequestAsPromise(request)
|
||||
.then(() => request.result, () => { throw request.error });
|
||||
}
|
||||
|
||||
/**
|
||||
* Set data connection enabling state and wait for "datachange" event.
|
||||
*
|
||||
|
|
|
@ -27,5 +27,7 @@ qemu = true
|
|||
[test_mobile_data_ipv6.js]
|
||||
disabled = Bug 979137
|
||||
[test_mobile_supported_network_types.js]
|
||||
[test_mobile_call_forwarding_set.js]
|
||||
[test_mobile_call_forwarding_get.js]
|
||||
[test_dsds_mobile_data_connection.js]
|
||||
[test_mobile_clir_radio_off.js]
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
const TEST_DATA = [
|
||||
// Test get calling forwarding.
|
||||
// TODO: Bug 861725 - B2G Emulator: support call forwarding
|
||||
// Currently emulator doesn't support REQUEST_QUERY_CALL_FORWARD_STATUS, so
|
||||
// we expect to get a 'RequestNotSupported' error here.
|
||||
{
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_UNCONDITIONAL,
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
}, {
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
}, {
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_NO_REPLY,
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
}, {
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_NOT_REACHABLE,
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
}, {
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CALL_FORWARDING,
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
}, {
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING,
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
},
|
||||
// Test passing invalid reason
|
||||
{
|
||||
reason: 10 /* Invalid reason */,
|
||||
expectedErrorMsg: "InvalidParameter"
|
||||
}
|
||||
];
|
||||
|
||||
function testGetCallForwardingOption(aReason, aExpectedErrorMsg) {
|
||||
log("Test getting call forwarding for " + aReason);
|
||||
|
||||
return getCallForwardingOption(aReason)
|
||||
.then(function resolve() {
|
||||
ok(!aExpectedErrorMsg, "getCallForwardingOption success");
|
||||
}, function reject(aError) {
|
||||
is(aError.name, aExpectedErrorMsg, "failed to getCallForwardingOption");
|
||||
});
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => testGetCallForwardingOption(data.reason,
|
||||
data.expectedErrorMsg));
|
||||
}
|
||||
return promise;
|
||||
});
|
|
@ -0,0 +1,75 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
const TEST_NUMBER = "0912345678";
|
||||
const TEST_TIME_SECONDS = 5;
|
||||
const TEST_DATA = [
|
||||
// Test get calling forwarding.
|
||||
// TODO: Bug 861725 - B2G Emulator: support call forwarding
|
||||
// Currently emulator doesn't support REQUEST_QUERY_CALL_FORWARD_STATUS, so
|
||||
// we expect to get a 'RequestNotSupported' error here.
|
||||
{
|
||||
options: {
|
||||
action: MozMobileConnection.CALL_FORWARD_ACTION_DISABLE,
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_UNCONDITIONAL,
|
||||
},
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
}, {
|
||||
options: {
|
||||
action: MozMobileConnection.CALL_FORWARD_ACTION_ENABLE,
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
||||
},
|
||||
expectedErrorMsg: "RequestNotSupported"
|
||||
},
|
||||
// Test passing invalid action. We expect to get a 'InvalidParameter' error.
|
||||
{
|
||||
options: {
|
||||
// Set operation doesn't allow "query" action.
|
||||
action: MozMobileConnection.CALL_FORWARD_ACTION_QUERY_STATUS,
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
||||
},
|
||||
expectedErrorMsg: "InvalidParameter"
|
||||
}, {
|
||||
options: {
|
||||
action: 10 /* Invalid action */,
|
||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
||||
},
|
||||
expectedErrorMsg: "InvalidParameter"
|
||||
},
|
||||
// Test passing invalid reason. We expect to get a 'InvalidParameter' error.
|
||||
{
|
||||
options: {
|
||||
action: MozMobileConnection.CALL_FORWARD_ACTION_DISABLE,
|
||||
reason: 10 /*Invalid reason*/,
|
||||
},
|
||||
expectedErrorMsg: "InvalidParameter"
|
||||
}
|
||||
];
|
||||
|
||||
function testSetCallForwardingOption(aOptions, aExpectedErrorMsg) {
|
||||
log("Test setting call forwarding to " + JSON.stringify(aOptions));
|
||||
|
||||
aOptions.number = TEST_NUMBER;
|
||||
aOptions.timeSeconds = TEST_TIME_SECONDS;
|
||||
|
||||
return setCallForwardingOption(aOptions)
|
||||
.then(function resolve() {
|
||||
ok(!aExpectedErrorMsg, "setCallForwardingOption success");
|
||||
}, function reject(aError) {
|
||||
is(aError.name, aExpectedErrorMsg, "failed to setCallForwardingOption");
|
||||
});
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||
let data = TEST_DATA[i];
|
||||
promise = promise.then(() => testSetCallForwardingOption(data.options,
|
||||
data.expectedErrorMsg));
|
||||
}
|
||||
return promise;
|
||||
});
|
Загрузка…
Ссылка в новой задаче