dom/telephony/test/marionette/test_outgoing_hangup_alerting.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 let number = "5555552368";
     8 let outgoing;
     9 let calls;
    11 function dial() {
    12   log("Make an outgoing call.");
    14   telephony.dial(number).then(call => {
    15     outgoing = call;
    16     ok(outgoing);
    17     is(outgoing.number, number);
    18     is(outgoing.state, "dialing");
    20     is(outgoing, telephony.active);
    21     //ok(telephony.calls === calls); // bug 717414
    22     is(telephony.calls.length, 1);
    23     is(telephony.calls[0], outgoing);
    25     outgoing.onalerting = function onalerting(event) {
    26       log("Received 'alerting' call event.");
    27       emulator.run("gsm list", function(result) {
    28         log("Call list is now: " + result);
    29         is(result[0], "outbound to  " + number + " : ringing");
    30         is(result[1], "OK");
    31         hangUp();
    32       });
    33     };
    34   });
    35 }
    37 function hangUp() {
    38   log("Hang up the outgoing call.");
    40   let gotDisconnecting = false;
    42   outgoing.ondisconnecting = function ondisconnecting(event) {
    43     log("Received 'disconnecting' call event.");
    44     is(outgoing, event.call);
    45     is(outgoing.state, "disconnecting");
    46     gotDisconnecting = true;
    47   };
    49   outgoing.ondisconnected = function ondisconnected(event) {
    50     log("Received 'disconnected' call event.");
    51     is(outgoing, event.call);
    52     is(outgoing.state, "disconnected");
    53     ok(gotDisconnecting);
    55     is(telephony.active, null);
    56     is(telephony.calls.length, 0);
    58     emulator.run("gsm list", function(result) {
    59       log("Call list is now: " + result);
    60       is(result[0], "OK");
    61       cleanUp();
    62     });
    63   };
    65   outgoing.hangUp();
    66 }
    68 function cleanUp() {
    69   finish();
    70 }
    72 startTest(function() {
    73   dial();
    74 });

mercurial