dom/mobileconnection/tests/marionette/test_mobile_last_known_network.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 MARIONETTE_TIMEOUT = 30000;
     6 SpecialPowers.addPermission("mobilenetwork", true, document);
     8 let connection = navigator.mozMobileConnections[0];
     9 ok(connection instanceof MozMobileConnection,
    10    "connection is instanceof " + connection.constructor);
    13 function testLastKnownNetwork() {
    14   log("testLastKnownNetwork: " + connection.lastKnownNetwork);
    15   // The emulator's hard coded operatoer's mcc and mnc codes.
    16   is(connection.lastKnownNetwork, "310-260");
    17   runNextTest();
    18 }
    20 function testLastKnownHomeNetwork() {
    21   log("testLastKnownHomeNetwork: " + connection.lastKnownHomeNetwork);
    22   // The emulator's hard coded icc's mcc and mnc codes.
    23   is(connection.lastKnownHomeNetwork, "310-260");
    24   runNextTest();
    25 }
    27 let tests = [
    28   testLastKnownNetwork,
    29   testLastKnownHomeNetwork
    30 ];
    32 function runNextTest() {
    33   let test = tests.shift();
    34   if (!test) {
    35     cleanUp();
    36     return;
    37   }
    39   test();
    40 }
    42 function cleanUp() {
    43   SpecialPowers.removePermission("mobilenetwork", document);
    44   finish();
    45 }
    47 runNextTest();

mercurial