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 verifyDataCellLocationInfo(aLac, aCid) { michael@0: let cell = mobileConnection.data.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, "data.cell.gsmLocationAreaCode"); michael@0: is(cell.gsmCellId, aCid, "data.cell.gsmCellId"); michael@0: is(cell.cdmaBaseStationId, -1, "data.cell.cdmaBaseStationId"); michael@0: is(cell.cdmaBaseStationLatitude, -2147483648, michael@0: "data.cell.cdmaBaseStationLatitude"); michael@0: is(cell.cdmaBaseStationLongitude, -2147483648, michael@0: "data.cell.cdmaBaseStationLongitude"); michael@0: is(cell.cdmaSystemId, -1, "data.cell.cdmaSystemId"); michael@0: is(cell.cdmaNetworkId, -1, "data.cell.cdmaNetworkId"); michael@0: } michael@0: michael@0: /* Test Data Cell Location Info Change */ michael@0: function testDataCellLocationUpdate(aLac, aCid) { michael@0: // Set emulator's lac/cid and wait for 'ondatachange' event. michael@0: log("Test cell location with lac=" + aLac + " and cid=" + aCid); michael@0: michael@0: let promises = []; michael@0: promises.push(waitForManagerEvent("datachange")); michael@0: promises.push(setEmulatorGsmLocation(aLac, aCid)); michael@0: return Promise.all(promises) michael@0: .then(() => verifyDataCellLocationInfo(aLac, aCid)); michael@0: } michael@0: michael@0: startTestCommon(function() { michael@0: return getEmulatorGsmLocation() michael@0: .then(function(aResult) { michael@0: log("Test initial data location info"); michael@0: verifyDataCellLocationInfo(aResult.lac, aResult.cid); michael@0: michael@0: return Promise.resolve() michael@0: .then(() => testDataCellLocationUpdate(100, 100)) michael@0: .then(() => testDataCellLocationUpdate(2000, 2000)) michael@0: michael@0: // Reset back to initial values. michael@0: .then(() => testDataCellLocationUpdate(aResult.lac, aResult.cid)); michael@0: }); michael@0: });