michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: MARIONETTE_TIMEOUT = 60000; michael@0: MARIONETTE_HEAD_JS = "head.js"; michael@0: michael@0: function verifyVoiceCellLocationInfo(aLac, aCid) { michael@0: let cell = mobileConnection.voice.cell; michael@0: ok(cell, "location available"); michael@0: michael@0: // Initial LAC/CID. Android emulator initializes both value to michael@0: // 0xffff/0xffffffff. michael@0: is(cell.gsmLocationAreaCode, aLac, "check voice.cell.gsmLocationAreaCode"); michael@0: is(cell.gsmCellId, aCid, "check voice.cell.gsmCellId"); michael@0: is(cell.cdmaBaseStationId, -1, "check voice.cell.cdmaBaseStationId"); michael@0: is(cell.cdmaBaseStationLatitude, -2147483648, michael@0: "check voice.cell.cdmaBaseStationLatitude"); michael@0: is(cell.cdmaBaseStationLongitude, -2147483648, michael@0: "check voice.cell.cdmaBaseStationLongitude"); michael@0: is(cell.cdmaSystemId, -1, "check voice.cell.cdmaSystemId"); michael@0: is(cell.cdmaNetworkId, -1, "check voice.cell.cdmaNetworkId"); michael@0: } michael@0: michael@0: /* Test Voice Cell Location Info Change */ michael@0: function testVoiceCellLocationUpdate(aLac, aCid) { michael@0: // Set emulator's lac/cid and wait for 'onvoicechange' event. michael@0: log("Test cell location with lac=" + aLac + " and cid=" + aCid); michael@0: michael@0: let promises = []; michael@0: promises.push(waitForManagerEvent("voicechange")); michael@0: promises.push(setEmulatorGsmLocation(aLac, aCid)); michael@0: return Promise.all(promises) michael@0: .then(() => verifyVoiceCellLocationInfo(aLac, aCid)); michael@0: } michael@0: michael@0: startTestCommon(function() { michael@0: return getEmulatorGsmLocation() michael@0: .then(function(aResult) { michael@0: log("Test initial voice location info"); michael@0: verifyVoiceCellLocationInfo(aResult.lac, aResult.cid); michael@0: michael@0: return Promise.resolve() michael@0: .then(() => testVoiceCellLocationUpdate(100, 100)) michael@0: .then(() => testVoiceCellLocationUpdate(2000, 2000)) michael@0: michael@0: // Reset back to initial values. michael@0: .then(() => testVoiceCellLocationUpdate(aResult.lac, aResult.cid)); michael@0: }); michael@0: });