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.

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

mercurial