dom/telephony/test/marionette/test_incoming_reject.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.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 * http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 MARIONETTE_TIMEOUT = 60000;
michael@0 5 MARIONETTE_HEAD_JS = 'head.js';
michael@0 6
michael@0 7 let number = "5555552368";
michael@0 8 let incoming;
michael@0 9 let calls;
michael@0 10
michael@0 11 function simulateIncoming() {
michael@0 12 log("Simulating an incoming call.");
michael@0 13
michael@0 14 telephony.onincoming = function onincoming(event) {
michael@0 15 log("Received 'incoming' call event.");
michael@0 16 incoming = event.call;
michael@0 17 ok(incoming);
michael@0 18 is(incoming.number, number);
michael@0 19 is(incoming.state, "incoming");
michael@0 20
michael@0 21 //ok(telephony.calls === calls); // bug 717414
michael@0 22 is(telephony.calls.length, 1);
michael@0 23 is(telephony.calls[0], incoming);
michael@0 24
michael@0 25 emulator.run("gsm list", function(result) {
michael@0 26 log("Call list is now: " + result);
michael@0 27 is(result[0], "inbound from " + number + " : incoming");
michael@0 28 is(result[1], "OK");
michael@0 29 reject();
michael@0 30 });
michael@0 31 };
michael@0 32 emulator.run("gsm call " + number);
michael@0 33 }
michael@0 34
michael@0 35 function reject() {
michael@0 36 log("Reject the incoming call.");
michael@0 37
michael@0 38 let gotDisconnecting = false;
michael@0 39 incoming.ondisconnecting = function ondisconnecting(event) {
michael@0 40 log("Received 'disconnecting' call event.");
michael@0 41 is(incoming, event.call);
michael@0 42 is(incoming.state, "disconnecting");
michael@0 43 gotDisconnecting = true;
michael@0 44 };
michael@0 45
michael@0 46 incoming.ondisconnected = function ondisconnected(event) {
michael@0 47 log("Received 'disconnected' call event.");
michael@0 48 is(incoming, event.call);
michael@0 49 is(incoming.state, "disconnected");
michael@0 50 ok(gotDisconnecting);
michael@0 51
michael@0 52 is(telephony.active, null);
michael@0 53 is(telephony.calls.length, 0);
michael@0 54
michael@0 55 emulator.run("gsm list", function(result) {
michael@0 56 log("Call list is now: " + result);
michael@0 57 is(result[0], "OK");
michael@0 58 cleanUp();
michael@0 59 });
michael@0 60 };
michael@0 61 incoming.hangUp();
michael@0 62 }
michael@0 63
michael@0 64 function cleanUp() {
michael@0 65 telephony.onincoming = null;
michael@0 66 finish();
michael@0 67 }
michael@0 68
michael@0 69 startTest(function() {
michael@0 70 simulateIncoming();
michael@0 71 });

mercurial