dom/telephony/test/marionette/test_outgoing_badNumber.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:29a9cca61d78
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 MARIONETTE_TIMEOUT = 60000;
5 MARIONETTE_HEAD_JS = 'head.js';
6
7 let number = "****5555552368****";
8 let outgoing;
9
10
11 function dial() {
12 log("Make an outgoing call to an invalid number.");
13
14 // Note: The number is valid from the view of phone and the call could be
15 // dialed out successfully. However, it will later receive the BadNumberError
16 // from network side.
17 telephony.dial(number).then(call => {
18 outgoing = call;
19 ok(outgoing);
20 is(outgoing.number, number);
21 is(outgoing.state, "dialing");
22
23 is(outgoing, telephony.active);
24 is(telephony.calls.length, 1);
25 is(telephony.calls[0], outgoing);
26
27 outgoing.onerror = function onerror(event) {
28 log("Received 'error' event.");
29 is(event.call, outgoing);
30 ok(event.call.error);
31 is(event.call.error.name, "BadNumberError");
32
33 emulator.run("gsm list", function(result) {
34 log("Initial call list: " + result);
35 is(result[0], "OK");
36 cleanUp();
37 });
38 };
39 });
40 }
41
42 function cleanUp() {
43 finish();
44 }
45
46 startTest(function() {
47 dial();
48 });

mercurial