Bug 1018051 - Delay 1s in test_outgoing_emergency_in_airplane_mode.js. r=echen

This commit is contained in:
Szu-Yu Chen [:aknow] 2014-05-30 03:33:00 +08:00
parent 75e34e20fb
commit 8e3266a3c8
2 changed files with 19 additions and 0 deletions

View File

@ -55,6 +55,23 @@ let emulator = (function() {
* Telephony related helper functions.
*/
(function() {
/**
* @return Promise
*/
function delay(ms) {
let deferred = Promise.defer();
let startTime = Date.now();
waitFor(function() {
deferred.resolve();
},function() {
let duration = Date.now() - startTime;
return (duration >= ms);
});
return deferred.promise;
}
/**
* @return Promise
*/
@ -1016,6 +1033,7 @@ let emulator = (function() {
* Public members.
*/
this.gDelay = delay;
this.gCheckInitialState = checkInitialState;
this.gClearCalls = clearCalls;
this.gOutCallStrPool = outCallStrPool;

View File

@ -34,6 +34,7 @@ startTestWithPermissions(['mobileconnection'], function() {
.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))
.then(null, () => {
ok(false, "promise rejects during test.");