Bug 999458 - 2.c/2: 0 <= gsmLocationAreaCode <= 65535. r=echen
authorVicamo Yang <vyang@mozilla.com>
Fri, 02 May 2014 00:24:12 +0800
changeset 181691 3e8b96116e13295b54ca57f02fa43d767f9c92ab
parent 181690 f8468bd898d6f32cb5dcc12ddecf2815051fcd39
child 181692 faa7c2b09118aa92f8bfe92f6470721830e8392f
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersechen
bugs999458, 65535
milestone32.0a1
Bug 999458 - 2.c/2: 0 <= gsmLocationAreaCode <= 65535. r=echen
dom/mobileconnection/tests/marionette/head.js
dom/mobileconnection/tests/marionette/test_mobile_data_location.js
dom/mobileconnection/tests/marionette/test_mobile_data_state.js
dom/mobileconnection/tests/marionette/test_mobile_voice_location.js
dom/mobileconnection/tests/marionette/test_mobile_voice_state.js
dom/system/gonk/ril_worker.js
--- a/dom/mobileconnection/tests/marionette/head.js
+++ b/dom/mobileconnection/tests/marionette/head.js
@@ -518,20 +518,17 @@ function getEmulatorGsmLocation() {
     .then(function(aResults) {
       // lac: <lac>
       // ci: <cid>
       // OK
       is(aResults[0].substring(0,3), "lac", "lac output");
       is(aResults[1].substring(0,2), "ci", "ci output");
 
       let lac = parseInt(aResults[0].substring(5));
-      lac = (lac < 0 ? 65535 : lac);
       let cid = parseInt(aResults[1].substring(4));
-      cid = (cid < 0 ? 268435455 : cid);
-
       return { lac: lac, cid: cid };
     });
 }
 
 /**
  * Set GSM location emulation.
  *
  * Fulfill params: (none)
--- a/dom/mobileconnection/tests/marionette/test_mobile_data_location.js
+++ b/dom/mobileconnection/tests/marionette/test_mobile_data_location.js
@@ -3,18 +3,16 @@
 
 MARIONETTE_TIMEOUT = 60000;
 MARIONETTE_HEAD_JS = "head.js";
 
 function verifyDataCellLocationInfo(aLac, aCid) {
   let cell = mobileConnection.data.cell;
   ok(cell, "location available");
 
-  // Initial LAC/CID. Android emulator initializes both value to
-  // 0xffff/0xffffffff.
   is(cell.gsmLocationAreaCode, aLac, "data.cell.gsmLocationAreaCode");
   is(cell.gsmCellId, aCid, "data.cell.gsmCellId");
   is(cell.cdmaBaseStationId, -1, "data.cell.cdmaBaseStationId");
   is(cell.cdmaBaseStationLatitude, -2147483648,
      "data.cell.cdmaBaseStationLatitude");
   is(cell.cdmaBaseStationLongitude, -2147483648,
      "data.cell.cdmaBaseStationLongitude");
   is(cell.cdmaSystemId, -1, "data.cell.cdmaSystemId");
--- a/dom/mobileconnection/tests/marionette/test_mobile_data_state.js
+++ b/dom/mobileconnection/tests/marionette/test_mobile_data_state.js
@@ -8,18 +8,18 @@ const INITIAL_STATES = {
   state: "registered",
   connected: false,
   emergencyCallsOnly: false,
   roaming: false,
   signalStrength: -99,
   relSignalStrength: 44,
 
   cell: {
-    gsmLocationAreaCode: 65535,
-    gsmCellId: 268435455,
+    gsmLocationAreaCode: 0,
+    gsmCellId: 0,
     cdmaBaseStationId: -1,
     cdmaBaseStationLatitude: -2147483648,
     cdmaBaseStationLongitude: -2147483648,
     cdmaSystemId: -1,
     cdmaNetworkId: -1,
   }
 };
 
@@ -68,33 +68,33 @@ const TEST_DATA = [{
     expected: {
       state: "registered",
       connected: false,
       emergencyCallsOnly: false,
       roaming: false,
       signalStrength: -99,
       relSignalStrength: 44,
       cell: {
-        gsmLocationAreaCode: 65535,
-        gsmCellId: 268435455
+        gsmLocationAreaCode: 0,
+        gsmCellId: 0
       }
     }
   }, {
     // Reset state to default value.
     state: "home",
     expected: {
       state: "registered",
       connected: false,
       emergencyCallsOnly: false,
       roaming: false,
       signalStrength: -99,
       relSignalStrength: 44,
       cell: {
-        gsmLocationAreaCode: 65535,
-        gsmCellId: 268435455
+        gsmLocationAreaCode: 0,
+        gsmCellId: 0
       }
     }
   }
 ];
 
 function compareTo(aPrefix, aFrom, aTo) {
   for (let field in aTo) {
     let fullName = aPrefix + field;
--- a/dom/mobileconnection/tests/marionette/test_mobile_voice_location.js
+++ b/dom/mobileconnection/tests/marionette/test_mobile_voice_location.js
@@ -3,18 +3,16 @@
 
 MARIONETTE_TIMEOUT = 60000;
 MARIONETTE_HEAD_JS = "head.js";
 
 function verifyVoiceCellLocationInfo(aLac, aCid) {
   let cell = mobileConnection.voice.cell;
   ok(cell, "location available");
 
-  // Initial LAC/CID. Android emulator initializes both value to
-  // 0xffff/0xffffffff.
   is(cell.gsmLocationAreaCode, aLac, "check voice.cell.gsmLocationAreaCode");
   is(cell.gsmCellId, aCid, "check voice.cell.gsmCellId");
   is(cell.cdmaBaseStationId, -1, "check voice.cell.cdmaBaseStationId");
   is(cell.cdmaBaseStationLatitude, -2147483648,
      "check voice.cell.cdmaBaseStationLatitude");
   is(cell.cdmaBaseStationLongitude, -2147483648,
      "check voice.cell.cdmaBaseStationLongitude");
   is(cell.cdmaSystemId, -1, "check voice.cell.cdmaSystemId");
--- a/dom/mobileconnection/tests/marionette/test_mobile_voice_state.js
+++ b/dom/mobileconnection/tests/marionette/test_mobile_voice_state.js
@@ -8,18 +8,18 @@ const INITIAL_STATES = {
   state: "registered",
   connected: true,
   emergencyCallsOnly: false,
   roaming: false,
   signalStrength: -99,
   relSignalStrength: 44,
 
   cell: {
-    gsmLocationAreaCode: 65535,
-    gsmCellId: 268435455,
+    gsmLocationAreaCode: 0,
+    gsmCellId: 0,
     cdmaBaseStationId: -1,
     cdmaBaseStationLatitude: -2147483648,
     cdmaBaseStationLongitude: -2147483648,
     cdmaSystemId: -1,
     cdmaNetworkId: -1,
   }
 };
 
@@ -65,33 +65,33 @@ const TEST_DATA = [{
     expected: {
       state: "registered",
       connected: true,
       emergencyCallsOnly: false,
       roaming: true,
       signalStrength: -99,
       relSignalStrength: 44,
       cell: {
-        gsmLocationAreaCode: 65535,
-        gsmCellId: 268435455
+        gsmLocationAreaCode: 0,
+        gsmCellId: 0
       }
     }
   }, {
     // Reset state to default value.
     state: "home",
     expected: {
       state: "registered",
       connected: true,
       emergencyCallsOnly: false,
       roaming: false,
       signalStrength: -99,
       relSignalStrength: 44,
       cell: {
-        gsmLocationAreaCode: 65535,
-        gsmCellId: 268435455
+        gsmLocationAreaCode: 0,
+        gsmCellId: 0
       }
     }
   }
 ];
 
 function compareTo(aPrefix, aFrom, aTo) {
   for (let field in aTo) {
     let fullName = aPrefix + field;
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -13617,17 +13617,17 @@ ICCUtilsHelperObject.prototype = {
    * @param lac   The location area code of the network.
    */
   getNetworkNameFromICC: function(mcc, mnc, lac) {
     let RIL = this.context.RIL;
     let iccInfoPriv = RIL.iccInfoPrivate;
     let iccInfo = RIL.iccInfo;
     let pnnEntry;
 
-    if (!mcc || !mnc || !lac) {
+    if (!mcc || !mnc || lac == null || lac < 0) {
       return null;
     }
 
     // We won't get network name if there is no PNN file.
     if (!iccInfoPriv.PNN) {
       return null;
     }