mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 861725 - Part 2: Revise the call forwarding test cases. r=vicamo
--HG-- rename : dom/mobileconnection/tests/marionette/test_mobile_call_forwarding_get.js => dom/mobileconnection/tests/marionette/test_mobile_call_forwarding_get_error.js rename : dom/mobileconnection/tests/marionette/test_mobile_call_forwarding_set.js => dom/mobileconnection/tests/marionette/test_mobile_call_forwarding_set_error.js
This commit is contained in:
parent
cf14ef6cc7
commit
1a6ed6b955
@ -28,10 +28,9 @@ qemu = true
|
|||||||
[test_mobile_data_ipv6.js]
|
[test_mobile_data_ipv6.js]
|
||||||
disabled = Bug 979137
|
disabled = Bug 979137
|
||||||
[test_mobile_supported_network_types.js]
|
[test_mobile_supported_network_types.js]
|
||||||
[test_mobile_call_forwarding_set.js]
|
[test_mobile_call_forwarding.js]
|
||||||
disabled = Bug 861725
|
[test_mobile_call_forwarding_set_error.js]
|
||||||
[test_mobile_call_forwarding_get.js]
|
[test_mobile_call_forwarding_get_error.js]
|
||||||
disabled = Bug 861725
|
|
||||||
[test_mobile_voice_privacy.js]
|
[test_mobile_voice_privacy.js]
|
||||||
[test_dsds_mobile_data_connection.js]
|
[test_dsds_mobile_data_connection.js]
|
||||||
[test_mobile_clir.js]
|
[test_mobile_clir.js]
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
/* 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 = [
|
||||||
|
{
|
||||||
|
action: MozMobileConnection.CALL_FORWARD_ACTION_REGISTRATION,
|
||||||
|
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
||||||
|
number: "0912345678",
|
||||||
|
timeSeconds: 5,
|
||||||
|
// Currently gecko only support ICC_SERVICE_CLASS_VOICE.
|
||||||
|
serviceClass: MozMobileConnection.ICC_SERVICE_CLASS_VOICE
|
||||||
|
}, {
|
||||||
|
action: MozMobileConnection.CALL_FORWARD_ACTION_ENABLE,
|
||||||
|
reason: MozMobileConnection.CALL_FORWARD_REASON_NO_REPLY,
|
||||||
|
number: "+886912345678",
|
||||||
|
timeSeconds: 20,
|
||||||
|
// Currently gecko only support ICC_SERVICE_CLASS_VOICE.
|
||||||
|
serviceClass: MozMobileConnection.ICC_SERVICE_CLASS_VOICE
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
function testSetCallForwardingOption(aOptions) {
|
||||||
|
log("Test setting call forwarding to " + JSON.stringify(aOptions));
|
||||||
|
|
||||||
|
let promises = [];
|
||||||
|
|
||||||
|
// Check cfstatechange event.
|
||||||
|
promises.push(waitForManagerEvent("cfstatechange").then(function(aEvent) {
|
||||||
|
is(aEvent.success, true, "check success");
|
||||||
|
is(aEvent.action, aOptions.action, "check action");
|
||||||
|
is(aEvent.reason, aOptions.reason, "check reason");
|
||||||
|
is(aEvent.number, aOptions.number, "check number");
|
||||||
|
is(aEvent.timeSeconds, aOptions.timeSeconds, "check timeSeconds");
|
||||||
|
is(aEvent.serviceClass, aOptions.serviceClass, "check serviceClass");
|
||||||
|
}));
|
||||||
|
// Check DOMRequest's result.
|
||||||
|
promises.push(setCallForwardingOption(aOptions).then(null, (aError) => {
|
||||||
|
ok(false, "got '" + aError.name + "' error");
|
||||||
|
}));
|
||||||
|
|
||||||
|
return Promise.all(promises);
|
||||||
|
}
|
||||||
|
|
||||||
|
function testGetCallForwardingOption(aReason, aExpectedResult) {
|
||||||
|
log("Test getting call forwarding for " + aReason);
|
||||||
|
|
||||||
|
return getCallForwardingOption(aReason)
|
||||||
|
.then(function resolve(aResults) {
|
||||||
|
is(Array.isArray(aResults), true, "results should be an array");
|
||||||
|
|
||||||
|
for (let i = 0; i < aResults.length; i++) {
|
||||||
|
let result = aResults[i];
|
||||||
|
|
||||||
|
// Only need to check the result containing the serviceClass that we are
|
||||||
|
// interesting in.
|
||||||
|
if (!(result.serviceClass & aExpectedResult.serviceClass)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let expectedActive =
|
||||||
|
aExpectedResult.action === MozMobileConnection.CALL_FORWARD_ACTION_ENABLE ||
|
||||||
|
aExpectedResult.action === MozMobileConnection.CALL_FORWARD_ACTION_REGISTRATION;
|
||||||
|
is(result.active, expectedActive, "check active");
|
||||||
|
is(result.reason, aExpectedResult.reason, "check reason");
|
||||||
|
is(result.number, aExpectedResult.number, "check number");
|
||||||
|
is(result.timeSeconds, aExpectedResult.timeSeconds, "check timeSeconds");
|
||||||
|
}
|
||||||
|
}, function reject(aError) {
|
||||||
|
ok(false, "got '" + aError.name + "' error");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearAllCallForwardingSettings() {
|
||||||
|
log("Clear all call forwarding settings");
|
||||||
|
|
||||||
|
let promise = Promise.resolve();
|
||||||
|
for (let reason = MozMobileConnection.CALL_FORWARD_REASON_UNCONDITIONAL;
|
||||||
|
reason <= MozMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING;
|
||||||
|
reason++) {
|
||||||
|
let options = {
|
||||||
|
reason: reason,
|
||||||
|
action: MozMobileConnection.CALL_FORWARD_ACTION_ERASURE
|
||||||
|
};
|
||||||
|
promise =
|
||||||
|
promise.then(() => setCallForwardingOption(options).then(null, () => {}));
|
||||||
|
}
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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))
|
||||||
|
.then(() => testGetCallForwardingOption(data.reason, data));
|
||||||
|
}
|
||||||
|
// reset call forwarding settings.
|
||||||
|
return promise.then(null, () => {})
|
||||||
|
.then(() => clearAllCallForwardingSettings());
|
||||||
|
});
|
||||||
|
|
@ -1,58 +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 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,45 @@
|
|||||||
|
/* 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 = [
|
||||||
|
// Currently emulator doesn't support CALL_FORWARD_REASON_ALL_CALL_FORWARDING
|
||||||
|
// and CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING, so
|
||||||
|
// we expect to get a 'GenericFailure' error here.
|
||||||
|
{
|
||||||
|
reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CALL_FORWARDING,
|
||||||
|
errorMsg: "GenericFailure"
|
||||||
|
}, {
|
||||||
|
reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING,
|
||||||
|
errorMsg: "GenericFailure"
|
||||||
|
},
|
||||||
|
// Test passing invalid reason
|
||||||
|
{
|
||||||
|
reason: 10 /* Invalid reason */,
|
||||||
|
errorMsg: "InvalidParameter"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
function testGetCallForwardingOptionError(aReason, aErrorMsg) {
|
||||||
|
log("Test getting call forwarding for " + aReason);
|
||||||
|
|
||||||
|
return getCallForwardingOption(aReason)
|
||||||
|
.then(function resolve() {
|
||||||
|
ok(false, "getCallForwardingOption success");
|
||||||
|
}, function reject(aError) {
|
||||||
|
is(aError.name, aErrorMsg, "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(() => testGetCallForwardingOptionError(data.reason,
|
||||||
|
data.errorMsg));
|
||||||
|
}
|
||||||
|
return promise;
|
||||||
|
});
|
@ -7,22 +7,21 @@ MARIONETTE_HEAD_JS = "head.js";
|
|||||||
const TEST_NUMBER = "0912345678";
|
const TEST_NUMBER = "0912345678";
|
||||||
const TEST_TIME_SECONDS = 5;
|
const TEST_TIME_SECONDS = 5;
|
||||||
const TEST_DATA = [
|
const TEST_DATA = [
|
||||||
// Test get calling forwarding.
|
// Currently emulator doesn't support CALL_FORWARD_REASON_ALL_CALL_FORWARDING
|
||||||
// TODO: Bug 861725 - B2G Emulator: support call forwarding
|
// and CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING, so
|
||||||
// Currently emulator doesn't support REQUEST_QUERY_CALL_FORWARD_STATUS, so
|
// we expect to get a 'GenericFailure' error here.
|
||||||
// we expect to get a 'RequestNotSupported' error here.
|
|
||||||
{
|
{
|
||||||
options: {
|
options: {
|
||||||
action: MozMobileConnection.CALL_FORWARD_ACTION_DISABLE,
|
action: MozMobileConnection.CALL_FORWARD_ACTION_DISABLE,
|
||||||
reason: MozMobileConnection.CALL_FORWARD_REASON_UNCONDITIONAL,
|
reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CALL_FORWARDING,
|
||||||
},
|
},
|
||||||
expectedErrorMsg: "RequestNotSupported"
|
errorMsg: "GenericFailure"
|
||||||
}, {
|
}, {
|
||||||
options: {
|
options: {
|
||||||
action: MozMobileConnection.CALL_FORWARD_ACTION_ENABLE,
|
action: MozMobileConnection.CALL_FORWARD_ACTION_ENABLE,
|
||||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING,
|
||||||
},
|
},
|
||||||
expectedErrorMsg: "RequestNotSupported"
|
errorMsg: "GenericFailure"
|
||||||
},
|
},
|
||||||
// Test passing invalid action. We expect to get a 'InvalidParameter' error.
|
// Test passing invalid action. We expect to get a 'InvalidParameter' error.
|
||||||
{
|
{
|
||||||
@ -31,13 +30,13 @@ const TEST_DATA = [
|
|||||||
action: MozMobileConnection.CALL_FORWARD_ACTION_QUERY_STATUS,
|
action: MozMobileConnection.CALL_FORWARD_ACTION_QUERY_STATUS,
|
||||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
||||||
},
|
},
|
||||||
expectedErrorMsg: "InvalidParameter"
|
errorMsg: "InvalidParameter"
|
||||||
}, {
|
}, {
|
||||||
options: {
|
options: {
|
||||||
action: 10 /* Invalid action */,
|
action: 10 /* Invalid action */,
|
||||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
||||||
},
|
},
|
||||||
expectedErrorMsg: "InvalidParameter"
|
errorMsg: "InvalidParameter"
|
||||||
},
|
},
|
||||||
// Test passing invalid reason. We expect to get a 'InvalidParameter' error.
|
// Test passing invalid reason. We expect to get a 'InvalidParameter' error.
|
||||||
{
|
{
|
||||||
@ -45,11 +44,11 @@ const TEST_DATA = [
|
|||||||
action: MozMobileConnection.CALL_FORWARD_ACTION_DISABLE,
|
action: MozMobileConnection.CALL_FORWARD_ACTION_DISABLE,
|
||||||
reason: 10 /*Invalid reason*/,
|
reason: 10 /*Invalid reason*/,
|
||||||
},
|
},
|
||||||
expectedErrorMsg: "InvalidParameter"
|
errorMsg: "InvalidParameter"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
function testSetCallForwardingOption(aOptions, aExpectedErrorMsg) {
|
function testSetCallForwardingOption(aOptions, aErrorMsg) {
|
||||||
log("Test setting call forwarding to " + JSON.stringify(aOptions));
|
log("Test setting call forwarding to " + JSON.stringify(aOptions));
|
||||||
|
|
||||||
aOptions.number = TEST_NUMBER;
|
aOptions.number = TEST_NUMBER;
|
||||||
@ -57,9 +56,9 @@ function testSetCallForwardingOption(aOptions, aExpectedErrorMsg) {
|
|||||||
|
|
||||||
return setCallForwardingOption(aOptions)
|
return setCallForwardingOption(aOptions)
|
||||||
.then(function resolve() {
|
.then(function resolve() {
|
||||||
ok(!aExpectedErrorMsg, "setCallForwardingOption success");
|
ok(false, "setCallForwardingOption success");
|
||||||
}, function reject(aError) {
|
}, function reject(aError) {
|
||||||
is(aError.name, aExpectedErrorMsg, "failed to setCallForwardingOption");
|
is(aError.name, aErrorMsg, "failed to setCallForwardingOption");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +68,7 @@ startTestCommon(function() {
|
|||||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||||
let data = TEST_DATA[i];
|
let data = TEST_DATA[i];
|
||||||
promise = promise.then(() => testSetCallForwardingOption(data.options,
|
promise = promise.then(() => testSetCallForwardingOption(data.options,
|
||||||
data.expectedErrorMsg));
|
data.errorMsg));
|
||||||
}
|
}
|
||||||
return promise;
|
return promise;
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user