Bug 780558 - B2G RIL: expose cell LAC/CID - Part 3: marionette test, r=philikon

This commit is contained in:
Vicamo Yang 2012-08-16 09:37:05 +08:00
parent 55faef4dd3
commit c3d60933c3

View File

@ -17,6 +17,12 @@ function setEmulatorVoiceState(state) {
});
}
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);
@ -24,7 +30,31 @@ function testConnectionInfo() {
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() {