зеркало из https://github.com/mozilla/gecko-dev.git
Bug 875710: Added marionette tests for getCardLockRetryCount, r=vyang
The marionette tests for getCardLockRetryCount test retrieving the retry count for 'pin', 'puk', and an invalid lock type. The former two must return success or 'NotSupportedError', the latter may only return 'IllegalAccessError'. * * * fix mar --HG-- extra : rebase_source : 509cd74e783eaf8d77be8b37c7143f3043d69b28
This commit is contained in:
Родитель
86b5023ccf
Коммит
87b5f80b6f
|
@ -90,10 +90,80 @@ function testPinChangeSuccess() {
|
|||
};
|
||||
}
|
||||
|
||||
/* Read PIN-lock retry count */
|
||||
function testPinCardLockRetryCount() {
|
||||
let request = icc.getCardLockRetryCount('pin');
|
||||
|
||||
ok(request instanceof DOMRequest,
|
||||
'request instanceof ' + request.constructor);
|
||||
|
||||
request.onsuccess = function onsuccess() {
|
||||
is(request.result.lockType, 'pin',
|
||||
'lockType is ' + request.result.lockType);
|
||||
ok(request.result.retryCount >= 0,
|
||||
'retryCount is ' + request.result.retryCount);
|
||||
runNextTest();
|
||||
};
|
||||
request.onerror = function onerror() {
|
||||
// The operation is optional any might not be supported for all
|
||||
// all locks. In this case, we generate 'NotSupportedError' for
|
||||
// the valid lock types.
|
||||
is(request.error.name, 'RequestNotSupported',
|
||||
'error name is ' + request.error.name);
|
||||
runNextTest();
|
||||
};
|
||||
}
|
||||
|
||||
/* Read PUK-lock retry count */
|
||||
function testPukCardLockRetryCount() {
|
||||
let request = icc.getCardLockRetryCount('puk');
|
||||
|
||||
ok(request instanceof DOMRequest,
|
||||
'request instanceof ' + request.constructor);
|
||||
|
||||
request.onsuccess = function onsuccess() {
|
||||
is(request.result.lockType, 'puk',
|
||||
'lockType is ' + request.result.lockType);
|
||||
ok(request.result.retryCount >= 0,
|
||||
'retryCount is ' + request.result.retryCount);
|
||||
runNextTest();
|
||||
};
|
||||
request.onerror = function onerror() {
|
||||
// The operation is optional any might not be supported for all
|
||||
// all locks. In this case, we generate 'NotSupportedError' for
|
||||
// the valid lock types.
|
||||
is(request.error.name, 'RequestNotSupported',
|
||||
'error name is ' + request.error.name);
|
||||
runNextTest();
|
||||
};
|
||||
}
|
||||
|
||||
/* Read lock retry count for an invalid entries */
|
||||
function testInvalidCardLockRetryCount() {
|
||||
let request = icc.getCardLockRetryCount('invalid-lock-type');
|
||||
|
||||
ok(request instanceof DOMRequest,
|
||||
'request instanceof ' + request.constructor);
|
||||
|
||||
request.onsuccess = function onsuccess() {
|
||||
ok(false,
|
||||
'request should never return success for an invalid lock type');
|
||||
runNextTest();
|
||||
};
|
||||
request.onerror = function onerror() {
|
||||
is(request.error.name, 'GenericFailure',
|
||||
'error name is ' + request.error.name);
|
||||
runNextTest();
|
||||
};
|
||||
}
|
||||
|
||||
let tests = [
|
||||
testPinChangeFailed,
|
||||
testPinChangeFailedNotification,
|
||||
testPinChangeSuccess,
|
||||
testPinCardLockRetryCount,
|
||||
testPukCardLockRetryCount,
|
||||
testInvalidCardLockRetryCount
|
||||
];
|
||||
|
||||
function runNextTest() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче