dom/telephony/test/marionette/test_emergency.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 = "911";
     8 let outgoing;
     9 let calls;
    11 function dial() {
    12   log("Make an emergency call.");
    14   telephony.dialEmergency(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");
    29       is(outgoing.emergency, true);
    31       emulator.run("gsm list", function(result) {
    32         log("Call list is now: " + result);
    33         is(result[0], "outbound to  " + number + "        : ringing");
    34         is(result[1], "OK");
    35         answer();
    36       });
    37     };
    38   });
    39 }
    41 function answer() {
    42   log("Answering the emergency call.");
    44   // We get no "connecting" event when the remote party answers the call.
    46   outgoing.onconnected = function onconnected(event) {
    47     log("Received 'connected' call event.");
    48     is(outgoing, event.call);
    49     is(outgoing.state, "connected");
    51     is(outgoing, telephony.active);
    53     emulator.run("gsm list", function(result) {
    54       log("Call list is now: " + result);
    55       is(result[0], "outbound to  " + number + "        : active");
    56       is(result[1], "OK");
    57       hangUp();
    58     });
    59   };
    60   emulator.run("gsm accept " + number);
    61 }
    63 function hangUp() {
    64   log("Hanging up the emergency call.");
    66   // We get no "disconnecting" event when the remote party terminates the call.
    68   outgoing.ondisconnected = function ondisconnected(event) {
    69     log("Received 'disconnected' call event.");
    70     is(outgoing, event.call);
    71     is(outgoing.state, "disconnected");
    73     is(telephony.active, null);
    74     is(telephony.calls.length, 0);
    76     emulator.run("gsm list", function(result) {
    77       log("Call list is now: " + result);
    78       is(result[0], "OK");
    79       cleanUp();
    80     });
    81   };
    82   emulator.run("gsm cancel " + number);
    83 }
    85 function cleanUp() {
    86   finish();
    87 }
    89 startTest(function() {
    90   dial();
    91 });

mercurial