gecko/dom/telephony/test/marionette/test_dsds_connection_conflict.js
Hsin-Yi Tsai bc06b6fedb Bug 989728 - [B2G] [RIL] split test_conference.js into smaller pieces to avoid timeout failure. r=vicamo
* * *
split test_conference.js - p4 - split test_conference
2014-04-08 14:10:06 +08:00

54 lines
1.4 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = 'head.js';
function muxModem(id) {
let deferred = Promise.defer();
emulator.run("mux modem " + id, function() {
deferred.resolve();
});
return deferred.promise;
}
function testNewCallWhenOtherConnectionInUse(firstServiceId, secondServiceId) {
log("= testNewCallWhenOtherConnectionInUse =");
log("1st call on " + firstServiceId + ", 2nd call on " + secondServiceId);
let outCall;
return Promise.resolve()
.then(() => muxModem(firstServiceId))
.then(() => {
return telephony.dial("0912345000", firstServiceId);
})
.then(call => {
outCall = call;
is(outCall.serviceId, firstServiceId);
})
.then(() => gRemoteAnswer(outCall))
.then(() => {
return telephony.dial("0912345001", secondServiceId);
})
.then(() => {
log("The promise should not be resolved");
ok(false);
}, cause => {
is(cause, "OtherConnectionInUse");
})
.then(() => gRemoteHangUp(outCall));
}
startDSDSTest(function() {
testNewCallWhenOtherConnectionInUse(0, 1)
.then(() => testNewCallWhenOtherConnectionInUse(1, 0))
.then(() => muxModem(0))
.then(null, () => {
ok(false, "promise rejects during test.");
})
.then(finish);
});