Sat, 03 Jan 2015 20:18:00 +0100
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 = "5555557777";
8 let connectedCalls;
9 let outgoingCall;
11 function dial() {
12 log("Make an outgoing call.");
14 telephony.dial(number).then(call => {
15 outgoingCall = call;
16 ok(outgoingCall);
17 is(outgoingCall.number, number);
18 is(outgoingCall.state, "dialing");
20 is(outgoingCall, telephony.active);
21 is(telephony.calls.length, 1);
22 is(telephony.calls[0], outgoingCall);
24 outgoingCall.onalerting = function onalerting(event) {
25 log("Received 'onalerting' call event.");
26 is(outgoingCall, event.call);
27 is(outgoingCall.state, "alerting");
29 emulator.run("gsm list", function(result) {
30 log("Call list is now: " + result);
31 is(result[0], "outbound to " + number + " : ringing");
32 is(result[1], "OK");
33 answer();
34 });
35 };
36 });
37 }
39 function answer() {
40 log("Answering the outgoing call.");
42 // We get no "connecting" event when the remote party answers the call.
44 outgoingCall.onconnected = function onconnected(event) {
45 log("Received 'connected' call event.");
46 is(outgoingCall, event.call);
47 is(outgoingCall.state, "connected");
49 is(outgoingCall, telephony.active);
51 emulator.run("gsm list", function(result) {
52 log("Call list is now: " + result);
53 is(result[0], "outbound to " + number + " : active");
54 is(result[1], "OK");
55 hold();
56 });
57 };
58 emulator.run("gsm accept " + number);
59 }
61 function hold() {
62 log("Putting the call on hold.");
64 let gotHolding = false;
65 outgoingCall.onholding = function onholding(event) {
66 log("Received 'holding' call event");
67 is(outgoingCall, event.call);
68 is(outgoingCall.state, "holding");
69 gotHolding = true;
70 };
72 outgoingCall.onheld = function onheld(event) {
73 log("Received 'held' call event");
74 is(outgoingCall, event.call);
75 is(outgoingCall.state, "held");
76 ok(gotHolding);
78 is(telephony.active, null);
79 is(telephony.calls.length, 1);
80 is(telephony.calls[0], outgoingCall);
82 emulator.run("gsm list", function(result) {
83 log("Call list is now: " + result);
84 is(result[0], "outbound to " + number + " : held");
85 is(result[1], "OK");
86 // Bug 781604: emulator assertion if outgoing call kept on hold
87 // Wait on hold for a couple of seconds
88 //log("Pausing 2 seconds while on hold");
89 //setTimeout(resume, 2000);
90 resume();
91 });
92 };
93 outgoingCall.hold();
94 }
96 function resume() {
97 log("Resuming the held call.");
99 let gotResuming = false;
100 outgoingCall.onresuming = function onresuming(event) {
101 log("Received 'resuming' call event");
102 is(outgoingCall, event.call);
103 is(outgoingCall.state, "resuming");
104 gotResuming = true;
105 };
107 outgoingCall.onconnected = function onconnected(event) {
108 log("Received 'connected' call event");
109 is(outgoingCall, event.call);
110 is(outgoingCall.state, "connected");
111 ok(gotResuming);
113 is(outgoingCall, telephony.active);
114 is(telephony.calls.length, 1);
115 is(telephony.calls[0], outgoingCall);
117 emulator.run("gsm list", function(result) {
118 log("Call list is now: " + result);
119 is(result[0], "outbound to " + number + " : active");
120 is(result[1], "OK");
121 hangUp();
122 });
123 };
124 outgoingCall.resume();
125 }
127 function hangUp() {
128 log("Hanging up the outgoing call.");
130 let gotDisconnecting = false;
131 outgoingCall.ondisconnecting = function ondisconnecting(event) {
132 log("Received 'disconnecting' call event.");
133 is(outgoingCall, event.call);
134 is(outgoingCall.state, "disconnecting");
135 gotDisconnecting = true;
136 };
138 outgoingCall.ondisconnected = function ondisconnected(event) {
139 log("Received 'disconnected' call event.");
140 is(outgoingCall, event.call);
141 is(outgoingCall.state, "disconnected");
142 ok(gotDisconnecting);
144 is(telephony.active, null);
145 is(telephony.calls.length, 0);
147 emulator.run("gsm list", function(result) {
148 log("Call list is now: " + result);
149 is(result[0], "OK");
150 cleanUp();
151 });
152 };
153 outgoingCall.hangUp();
154 }
156 function cleanUp() {
157 finish();
158 }
160 startTest(function() {
161 dial();
162 });