зеркало из https://github.com/mozilla/gecko-dev.git
Bug 906603 - Update the related testcase. r=aknow
This commit is contained in:
Родитель
cf0fd0d19c
Коммит
f19e29b3b2
|
@ -4,33 +4,11 @@
|
|||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
const TEST_DATA = [
|
||||
// [<pin>, <new pin>, <expected error>]
|
||||
function testChangeCallBarringPassword(aExpectedError, aOptions) {
|
||||
log("Test changing call barring password from " +
|
||||
aOptions.pin + " to " + aOptions.newPin);
|
||||
|
||||
// Test passing an invalid pin or newPin.
|
||||
[null, "0000", "InvalidPassword"],
|
||||
["0000", null, "InvalidPassword"],
|
||||
[null, null, "InvalidPassword"],
|
||||
|
||||
// Test passing mismatched newPin.
|
||||
["000", "0000", "InvalidPassword"],
|
||||
["00000", "1111", "InvalidPassword"],
|
||||
["abcd", "efgh", "InvalidPassword"],
|
||||
|
||||
// TODO: Bug 906603 - B2G RIL: Support Change Call Barring Password on Emulator.
|
||||
// Currently emulator doesn't support REQUEST_CHANGE_BARRING_PASSWORD, so we
|
||||
// expect to get a 'RequestNotSupported' error here.
|
||||
["1234", "1234", "RequestNotSupported"]
|
||||
];
|
||||
|
||||
function testChangeCallBarringPassword(aPin, aNewPin, aExpectedError) {
|
||||
log("Test changing call barring password to " + aPin + "/" + aNewPin);
|
||||
|
||||
let options = {
|
||||
pin: aPin,
|
||||
newPin: aNewPin
|
||||
};
|
||||
return changeCallBarringPassword(options)
|
||||
return changeCallBarringPassword(aOptions)
|
||||
.then(function resolve() {
|
||||
ok(!aExpectedError, "changeCallBarringPassword success");
|
||||
}, function reject(aError) {
|
||||
|
@ -40,11 +18,67 @@ function testChangeCallBarringPassword(aPin, aNewPin, aExpectedError) {
|
|||
|
||||
// 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(() => testChangeCallBarringPassword(data[0], data[1], data[2]));
|
||||
}
|
||||
return promise;
|
||||
return Promise.resolve()
|
||||
|
||||
// According to TS.22.004 clause 5.2, the password should consist of four
|
||||
// digits in the range 0000 to 9999.
|
||||
|
||||
// Test passing an invalid pin.
|
||||
.then(() => testChangeCallBarringPassword("InvalidPassword", {
|
||||
pin: null,
|
||||
newPin: "0000"
|
||||
}))
|
||||
|
||||
.then(() => testChangeCallBarringPassword("InvalidPassword", {
|
||||
pin: "000",
|
||||
newPin: "0000"
|
||||
}))
|
||||
|
||||
.then(() => testChangeCallBarringPassword("InvalidPassword", {
|
||||
pin: "00000",
|
||||
newPin: "0000"
|
||||
}))
|
||||
|
||||
.then(() => testChangeCallBarringPassword("InvalidPassword", {
|
||||
pin: "abcd",
|
||||
newPin: "0000"
|
||||
}))
|
||||
|
||||
// Test passing an invalid newPin
|
||||
.then(() => testChangeCallBarringPassword("InvalidPassword", {
|
||||
pin: "0000",
|
||||
newPin: null
|
||||
}))
|
||||
|
||||
.then(() => testChangeCallBarringPassword("InvalidPassword", {
|
||||
pin: "0000",
|
||||
newPin: "000"
|
||||
}))
|
||||
|
||||
.then(() => testChangeCallBarringPassword("InvalidPassword", {
|
||||
pin: "0000",
|
||||
newPin: "00000"
|
||||
}))
|
||||
|
||||
.then(() => testChangeCallBarringPassword("InvalidPassword", {
|
||||
pin: "0000",
|
||||
newPin: "abcd"
|
||||
}))
|
||||
|
||||
// Test passing an incorrect password, where the default password is "0000".
|
||||
.then(() => testChangeCallBarringPassword("IncorrectPassword", {
|
||||
pin: "1111",
|
||||
newPin: "2222"
|
||||
}))
|
||||
|
||||
// Sucessful
|
||||
.then(() => testChangeCallBarringPassword(null, {
|
||||
pin: "0000",
|
||||
newPin: "2222"
|
||||
}))
|
||||
|
||||
.then(() => testChangeCallBarringPassword(null, {
|
||||
pin: "2222",
|
||||
newPin: "0000"
|
||||
}));
|
||||
});
|
||||
|
|
|
@ -41,16 +41,17 @@ const TEST_DATA = [
|
|||
name: "emMmiErrorInvalidPassword"
|
||||
}
|
||||
},
|
||||
// TODO: Bug 906603 - B2G RIL: Support Change Call Barring Password on Emulator.
|
||||
// Currently emulator doesn't support REQUEST_CHANGE_BARRING_PASSWORD, so we
|
||||
// expect to get a 'RequestNotSupported' error here.
|
||||
// Expect to succeed.
|
||||
{
|
||||
password: "0000",
|
||||
password: "0000", // 0000 is the default password for call barring
|
||||
newPassword: "1234",
|
||||
newPasswordAgain: "1234",
|
||||
expectedError: {
|
||||
name: "RequestNotSupported"
|
||||
}
|
||||
newPasswordAgain: "1234"
|
||||
},
|
||||
// Restore to the default password
|
||||
{
|
||||
password: "1234",
|
||||
newPassword: "0000",
|
||||
newPasswordAgain: "0000"
|
||||
}
|
||||
];
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче