1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/mobileconnection/tests/marionette/test_mobile_voice_location.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 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 +function verifyVoiceCellLocationInfo(aLac, aCid) { 1.11 + let cell = mobileConnection.voice.cell; 1.12 + ok(cell, "location available"); 1.13 + 1.14 + // Initial LAC/CID. Android emulator initializes both value to 1.15 + // 0xffff/0xffffffff. 1.16 + is(cell.gsmLocationAreaCode, aLac, "check voice.cell.gsmLocationAreaCode"); 1.17 + is(cell.gsmCellId, aCid, "check voice.cell.gsmCellId"); 1.18 + is(cell.cdmaBaseStationId, -1, "check voice.cell.cdmaBaseStationId"); 1.19 + is(cell.cdmaBaseStationLatitude, -2147483648, 1.20 + "check voice.cell.cdmaBaseStationLatitude"); 1.21 + is(cell.cdmaBaseStationLongitude, -2147483648, 1.22 + "check voice.cell.cdmaBaseStationLongitude"); 1.23 + is(cell.cdmaSystemId, -1, "check voice.cell.cdmaSystemId"); 1.24 + is(cell.cdmaNetworkId, -1, "check voice.cell.cdmaNetworkId"); 1.25 +} 1.26 + 1.27 +/* Test Voice Cell Location Info Change */ 1.28 +function testVoiceCellLocationUpdate(aLac, aCid) { 1.29 + // Set emulator's lac/cid and wait for 'onvoicechange' event. 1.30 + log("Test cell location with lac=" + aLac + " and cid=" + aCid); 1.31 + 1.32 + let promises = []; 1.33 + promises.push(waitForManagerEvent("voicechange")); 1.34 + promises.push(setEmulatorGsmLocation(aLac, aCid)); 1.35 + return Promise.all(promises) 1.36 + .then(() => verifyVoiceCellLocationInfo(aLac, aCid)); 1.37 +} 1.38 + 1.39 +startTestCommon(function() { 1.40 + return getEmulatorGsmLocation() 1.41 + .then(function(aResult) { 1.42 + log("Test initial voice location info"); 1.43 + verifyVoiceCellLocationInfo(aResult.lac, aResult.cid); 1.44 + 1.45 + return Promise.resolve() 1.46 + .then(() => testVoiceCellLocationUpdate(100, 100)) 1.47 + .then(() => testVoiceCellLocationUpdate(2000, 2000)) 1.48 + 1.49 + // Reset back to initial values. 1.50 + .then(() => testVoiceCellLocationUpdate(aResult.lac, aResult.cid)); 1.51 + }); 1.52 +});