dom/mobileconnection/tests/marionette/test_mobile_voice_location.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 function verifyVoiceCellLocationInfo(aLac, aCid) {
     8   let cell = mobileConnection.voice.cell;
     9   ok(cell, "location available");
    11   // Initial LAC/CID. Android emulator initializes both value to
    12   // 0xffff/0xffffffff.
    13   is(cell.gsmLocationAreaCode, aLac, "check voice.cell.gsmLocationAreaCode");
    14   is(cell.gsmCellId, aCid, "check voice.cell.gsmCellId");
    15   is(cell.cdmaBaseStationId, -1, "check voice.cell.cdmaBaseStationId");
    16   is(cell.cdmaBaseStationLatitude, -2147483648,
    17      "check voice.cell.cdmaBaseStationLatitude");
    18   is(cell.cdmaBaseStationLongitude, -2147483648,
    19      "check voice.cell.cdmaBaseStationLongitude");
    20   is(cell.cdmaSystemId, -1, "check voice.cell.cdmaSystemId");
    21   is(cell.cdmaNetworkId, -1, "check voice.cell.cdmaNetworkId");
    22 }
    24 /* Test Voice Cell Location Info Change */
    25 function testVoiceCellLocationUpdate(aLac, aCid) {
    26   // Set emulator's lac/cid and wait for 'onvoicechange' event.
    27   log("Test cell location with lac=" + aLac + " and cid=" + aCid);
    29   let promises = [];
    30   promises.push(waitForManagerEvent("voicechange"));
    31   promises.push(setEmulatorGsmLocation(aLac, aCid));
    32   return Promise.all(promises)
    33     .then(() => verifyVoiceCellLocationInfo(aLac, aCid));
    34 }
    36 startTestCommon(function() {
    37   return getEmulatorGsmLocation()
    38     .then(function(aResult) {
    39       log("Test initial voice location info");
    40       verifyVoiceCellLocationInfo(aResult.lac, aResult.cid);
    42       return Promise.resolve()
    43         .then(() => testVoiceCellLocationUpdate(100, 100))
    44         .then(() => testVoiceCellLocationUpdate(2000, 2000))
    46         // Reset back to initial values.
    47         .then(() => testVoiceCellLocationUpdate(aResult.lac, aResult.cid));
    48     });
    49 });

mercurial