dom/telephony/test/marionette/test_outgoing_answer_hangup.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 'onalerting' call event.");
    27       is(outgoing, event.call);
    28       is(outgoing.state, "alerting");
    30       emulator.run("gsm list", function(result) {
    31         log("Call list is now: " + result);
    32         is(result[0], "outbound to  " + number + " : ringing");
    33         is(result[1], "OK");
    34         answer();
    35       });
    36     };
    37   });
    38 }
    40 function answer() {
    41   log("Answering the outgoing call.");
    43   // We get no "connecting" event when the remote party answers the call.
    45   outgoing.onconnected = function onconnected(event) {
    46     log("Received 'connected' call event.");
    47     is(outgoing, event.call);
    48     is(outgoing.state, "connected");
    50     is(outgoing, telephony.active);
    52     emulator.run("gsm list", function(result) {
    53       log("Call list is now: " + result);
    54       is(result[0], "outbound to  " + number + " : active");
    55       is(result[1], "OK");
    56       hangUp();
    57     });
    58   };
    59   emulator.run("gsm accept " + number);
    60 }
    62 function hangUp() {
    63   log("Hanging up the outgoing call.");
    65   // We get no "disconnecting" event when the remote party terminates the call.
    67   outgoing.ondisconnected = function ondisconnected(event) {
    68     log("Received 'disconnected' call event.");
    69     is(outgoing, event.call);
    70     is(outgoing.state, "disconnected");
    72     is(telephony.active, null);
    73     is(telephony.calls.length, 0);
    75     emulator.run("gsm list", function(result) {
    76       log("Call list is now: " + result);
    77       is(result[0], "OK");
    78       cleanUp();
    79     });
    80   };
    81   emulator.run("gsm cancel " + number);
    82 }
    84 function cleanUp() {
    85   finish();
    86 }
    88 startTest(function() {
    89   dial();
    90 });

mercurial