dom/telephony/test/marionette/test_dsds_normal_call.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 * http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 MARIONETTE_TIMEOUT = 60000;
michael@0 5 MARIONETTE_HEAD_JS = 'head.js';
michael@0 6
michael@0 7 function muxModem(id) {
michael@0 8 let deferred = Promise.defer();
michael@0 9
michael@0 10 emulator.run("mux modem " + id, function() {
michael@0 11 deferred.resolve();
michael@0 12 });
michael@0 13
michael@0 14 return deferred.promise;
michael@0 15 }
michael@0 16
michael@0 17 function testOutgoingCallForServiceId(number, serviceId) {
michael@0 18 let outCall;
michael@0 19 let outInfo = gOutCallStrPool(number);
michael@0 20
michael@0 21 return Promise.resolve()
michael@0 22 .then(() => gDial(number, serviceId))
michael@0 23 .then(call => {
michael@0 24 outCall = call;
michael@0 25 is(outCall.serviceId, serviceId);
michael@0 26 })
michael@0 27 .then(() => gCheckAll(outCall, [outCall], '', [], [outInfo.ringing]))
michael@0 28 .then(() => gRemoteAnswer(outCall))
michael@0 29 .then(() => gCheckAll(outCall, [outCall], '', [], [outInfo.active]))
michael@0 30 .then(() => gRemoteHangUp(outCall))
michael@0 31 .then(() => gCheckAll(null, [], '', [], []));
michael@0 32 }
michael@0 33
michael@0 34 function testIncomingCallForServiceId(number, serviceId) {
michael@0 35 let inCall;
michael@0 36 let inInfo = gInCallStrPool(number);
michael@0 37
michael@0 38 return Promise.resolve()
michael@0 39 .then(() => gRemoteDial(number))
michael@0 40 .then(call => {
michael@0 41 inCall = call;
michael@0 42 is(inCall.serviceId, serviceId);
michael@0 43 })
michael@0 44 .then(() => gCheckAll(null, [inCall], '', [], [inInfo.incoming]))
michael@0 45 .then(() => gAnswer(inCall))
michael@0 46 .then(() => gCheckAll(inCall, [inCall], '', [], [inInfo.active]))
michael@0 47 .then(() => gRemoteHangUp(inCall))
michael@0 48 .then(() => gCheckAll(null, [], '', [], []));
michael@0 49 }
michael@0 50
michael@0 51 function testOutgoingCall() {
michael@0 52 log("= testOutgoingCall =");
michael@0 53
michael@0 54 return Promise.resolve()
michael@0 55 .then(() => muxModem(0))
michael@0 56 .then(() => testOutgoingCallForServiceId("0912345000", 0))
michael@0 57 .then(() => muxModem(1))
michael@0 58 .then(() => testOutgoingCallForServiceId("0912345001", 1))
michael@0 59 .then(() => muxModem(0));
michael@0 60 }
michael@0 61
michael@0 62 function testIncomingCall() {
michael@0 63 log("= testIncomingCall =");
michael@0 64
michael@0 65 return Promise.resolve()
michael@0 66 .then(() => muxModem(0))
michael@0 67 .then(() => testIncomingCallForServiceId("0912345000", 0))
michael@0 68 .then(() => muxModem(1))
michael@0 69 .then(() => testIncomingCallForServiceId("0912345001", 1))
michael@0 70 .then(() => muxModem(0));
michael@0 71 }
michael@0 72
michael@0 73 startDSDSTest(function() {
michael@0 74 testOutgoingCall()
michael@0 75 .then(testIncomingCall)
michael@0 76 .then(null, () => {
michael@0 77 ok(false, "promise rejects during test.");
michael@0 78 })
michael@0 79 .then(finish);
michael@0 80 });

mercurial