Bug 780558 - B2G RIL: expose cell LAC/CID - Part 3: marionette test, r=philikon
authorVicamo Yang <vyang@mozilla.com>
Thu, 16 Aug 2012 09:37:05 +0800
changeset 102500 011c3d6769d0944e9c35978c53fc733ed2b5ad7e
parent 102499 90c19283f1b275efb1445d92d35bdc923c1e9b11
child 102501 7440244d723767ca7f7facf759f155d113619ec6
push id23288
push useremorley@mozilla.com
push dateThu, 16 Aug 2012 13:14:48 +0000
treeherdermozilla-central@3940df6f9356 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilikon
bugs780558
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 780558 - B2G RIL: expose cell LAC/CID - Part 3: marionette test, r=philikon
dom/network/tests/marionette/test_mobile_voice_state.js
--- a/dom/network/tests/marionette/test_mobile_voice_state.js
+++ b/dom/network/tests/marionette/test_mobile_voice_state.js
@@ -12,24 +12,54 @@ ok(connection instanceof MozMobileConnec
    "connection is instanceof " + connection.constructor);
 
 function setEmulatorVoiceState(state) {
   runEmulatorCmd("gsm voice " + state, function (result) {
     is(result[0], "OK");
   });
 }
 
+function setEmulatorGsmLocation(lac, cid) {
+  runEmulatorCmd("gsm location " + lac + " " + cid, function (result) {
+    is(result[0], "OK");
+  });
+}
+
 function testConnectionInfo() {
   let voice = connection.voice;
   is(voice.connected, true);
   is(voice.state, "registered");
   is(voice.emergencyCallsOnly, false);
   is(voice.roaming, false);
 
-  testUnregistered();
+  testCellLocation();
+}
+
+function testCellLocation() {
+  let voice = connection.voice;
+
+  // Emulator always reports valid lac/cid value because its AT command parser
+  // insists valid value for every complete response. See source file
+  // hardare/ril/reference-ril/at_tok.c, function at_tok_nexthexint().
+  ok(voice.cell, "location available");
+
+  // Initial LAC/CID. Android emulator initializes both value to -1.
+  is(voice.cell.gsmLocationAreaCode, 65535);
+  is(voice.cell.gsmCellId, 268435455);
+
+  connection.addEventListener("voicechange", function onvoicechange() {
+    connection.removeEventListener("voicechange", onvoicechange);
+
+    is(voice.cell.gsmLocationAreaCode, 100);
+    is(voice.cell.gsmCellId, 100);
+
+    testUnregistered();
+  });
+
+  setEmulatorGsmLocation(100, 100);
 }
 
 function testUnregistered() {
   setEmulatorVoiceState("unregistered");
 
   connection.addEventListener("voicechange", function onvoicechange() {
     connection.removeEventListener("voicechange", onvoicechange);