dom/telephony/test/marionette/test_outgoing_badNumber.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/telephony/test/marionette/test_outgoing_badNumber.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +MARIONETTE_TIMEOUT = 60000;
     1.8 +MARIONETTE_HEAD_JS = 'head.js';
     1.9 +
    1.10 +let number = "****5555552368****";
    1.11 +let outgoing;
    1.12 +
    1.13 +
    1.14 +function dial() {
    1.15 +  log("Make an outgoing call to an invalid number.");
    1.16 +
    1.17 +  // Note: The number is valid from the view of phone and the call could be
    1.18 +  // dialed out successfully. However, it will later receive the BadNumberError
    1.19 +  // from network side.
    1.20 +  telephony.dial(number).then(call => {
    1.21 +    outgoing = call;
    1.22 +    ok(outgoing);
    1.23 +    is(outgoing.number, number);
    1.24 +    is(outgoing.state, "dialing");
    1.25 +
    1.26 +    is(outgoing, telephony.active);
    1.27 +    is(telephony.calls.length, 1);
    1.28 +    is(telephony.calls[0], outgoing);
    1.29 +
    1.30 +    outgoing.onerror = function onerror(event) {
    1.31 +      log("Received 'error' event.");
    1.32 +      is(event.call, outgoing);
    1.33 +      ok(event.call.error);
    1.34 +      is(event.call.error.name, "BadNumberError");
    1.35 +
    1.36 +      emulator.run("gsm list", function(result) {
    1.37 +        log("Initial call list: " + result);
    1.38 +        is(result[0], "OK");
    1.39 +        cleanUp();
    1.40 +      });
    1.41 +    };
    1.42 +  });
    1.43 +}
    1.44 +
    1.45 +function cleanUp() {
    1.46 +  finish();
    1.47 +}
    1.48 +
    1.49 +startTest(function() {
    1.50 +  dial();
    1.51 +});

mercurial