dom/telephony/test/marionette/test_incoming_remote_cancel.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 inNumber = "5555551111";
     8 let incomingCall;
    10 function simulateIncoming() {
    11   log("Simulating an incoming call.");
    13   telephony.onincoming = function onincoming(event) {
    14     log("Received 'incoming' call event.");
    15     incomingCall = event.call;
    16     ok(incomingCall);
    17     is(incomingCall.number, inNumber);
    18     is(incomingCall.state, "incoming");
    20     is(telephony.calls.length, 1);
    21     is(telephony.calls[0], incomingCall);
    23     emulator.run("gsm list", function(result) {
    24       log("Call list is now: " + result);
    25       is(result[0], "inbound from " + inNumber + " : incoming");
    26       is(result[1], "OK");
    27       cancelIncoming();
    28     });
    29   };
    30   emulator.run("gsm call " + inNumber);
    31 }
    33 function cancelIncoming(){
    34   log("Remote party cancelling call before it is answered.");
    36   // We get no 'disconnecting' event when remote party cancels/hangs-up call
    38   incomingCall.ondisconnected = function ondisconnected(event) {
    39     log("Received 'disconnected' call event.");
    40     is(incomingCall, event.call);
    41     is(incomingCall.state, "disconnected");
    43     is(telephony.active, null);
    44     is(telephony.calls.length, 0);
    46     emulator.run("gsm list", function(result) {
    47       log("Call list is now: " + result);
    48       is(result[0], "OK");
    49       cleanUp();
    50     });
    51   };
    52   emulator.run("gsm cancel " + inNumber);
    53 }
    55 function cleanUp() {
    56   telephony.onincoming = null;
    57   finish();
    58 }
    60 startTest(function() {
    61   simulateIncoming();
    62 });

mercurial