diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 46e75774f11..e9b682e1aca 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,13 +19,13 @@ - + - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 1355f49c832..04556758b5c 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,10 +17,10 @@ - + - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 1d100ec4677..a265e04b537 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,14 +15,14 @@ - + - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 46e75774f11..e9b682e1aca 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,13 +19,13 @@ - + - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index d9d6f2378d0..1a809ccb390 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -18,10 +18,10 @@ - + - + diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index f0e73d5e9bf..5b353d84f6f 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "89e8095a1515d9ff7671400baa0a6a50161394ba", + "revision": "689e41080c6c21f0d2b51363304776c70967c9c5", "repo_path": "/integration/gaia-central" } diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index a796d6582f7..79719fdab81 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,12 +17,12 @@ - + - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index b1cd2ab00d2..846269b92e4 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 1acbbc8f2c2..22b114744c0 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,12 +19,12 @@ - + - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 9756514d4fc..804ad8e4845 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,12 +17,12 @@ - + - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index eebf2e6be3a..77c8ca6e939 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,10 +17,10 @@ - + - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index a68ab83cd5e..4c640c557b3 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,12 +17,12 @@ - + - + diff --git a/b2g/installer/Makefile.in b/b2g/installer/Makefile.in index 77c330fab29..5dc7f496150 100644 --- a/b2g/installer/Makefile.in +++ b/b2g/installer/Makefile.in @@ -86,7 +86,7 @@ simulator: make-package @echo 'Building simulator addon...' $(PYTHON) $(topsrcdir)/b2g/simulator/build_xpi.py $(MOZ_PKG_PLATFORM) -default:: simulator +libs:: simulator # Ensure copying Simulator xpi to ftp UPLOAD_EXTRA_FILES += fxos-simulator-*-*.xpi diff --git a/dom/mobileconnection/tests/marionette/head.js b/dom/mobileconnection/tests/marionette/head.js index 5e88664afaa..5c017f3c15b 100644 --- a/dom/mobileconnection/tests/marionette/head.js +++ b/dom/mobileconnection/tests/marionette/head.js @@ -523,10 +523,7 @@ function getEmulatorGsmLocation() { 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 }; }); } @@ -547,6 +544,33 @@ function setEmulatorGsmLocation(aLac, aCid) { return runEmulatorCmdSafe(cmd); } +/** + * Set GSM location and wait for voice and/or data state change. + * + * Fulfill params: (none) + * + * @param aLac + * @param aCid + * @param aWaitVoice [optional] + * A boolean value. Default true. + * @param aWaitData [optional] + * A boolean value. Default false. + * + * @return A deferred promise. + */ +function setEmulatorGsmLocationAndWait(aLac, aCid, + aWaitVoice = true, aWaitData = false) { + let promises = []; + if (aWaitVoice) { + promises.push(waitForManagerEvent("voicechange")); + } + if (aWaitData) { + promises.push(waitForManagerEvent("datachange")); + } + promises.push(setEmulatorGsmLocation(aLac, aCid)); + return Promise.all(promises); +} + /** * Get emulator operators info. * @@ -622,6 +646,43 @@ function setEmulatorOperatorNames(aOperator, aLongName, aShortName, aMcc, aMnc) }); } +/** + * Set emulator operators info and wait for voice and/or data state change. + * + * Fulfill params: (none) + * + * @param aOperator + * "home" or "roaming". + * @param aLongName + * A string. + * @param aShortName + * A string. + * @param aMcc [optional] + * A string. + * @param aMnc [optional] + * A string. + * @param aWaitVoice [optional] + * A boolean value. Default true. + * @param aWaitData [optional] + * A boolean value. Default false. + * + * @return A deferred promise. + */ +function setEmulatorOperatorNamesAndWait(aOperator, aLongName, aShortName, + aMcc, aMnc, + aWaitVoice = true, aWaitData = false) { + let promises = []; + if (aWaitVoice) { + promises.push(waitForManagerEvent("voicechange")); + } + if (aWaitData) { + promises.push(waitForManagerEvent("datachange")); + } + promises.push(setEmulatorOperatorNames(aOperator, aLongName, aShortName, + aMcc, aMnc)); + return Promise.all(promises); +} + let _networkManager; /** diff --git a/dom/mobileconnection/tests/marionette/manifest.ini b/dom/mobileconnection/tests/marionette/manifest.ini index 8c7a5d06706..d91146c3605 100644 --- a/dom/mobileconnection/tests/marionette/manifest.ini +++ b/dom/mobileconnection/tests/marionette/manifest.ini @@ -5,17 +5,14 @@ qemu = true [test_mobile_networks.js] [test_mobile_voice_state.js] -disabled = Bug 999458 [test_mobile_voice_location.js] [test_mobile_operator_names.js] [test_mobile_operator_names_plmnlist.js] -disabled = Bug 999458 [test_mobile_operator_names_roaming.js] [test_mobile_preferred_network_type.js] [test_mobile_data_connection.js] [test_mobile_data_location.js] [test_mobile_data_state.js] -disabled = Bug 999458 [test_mobile_mmi.js] [test_mobile_mmi_change_pin.js] [test_mobile_roaming_preference.js] diff --git a/dom/mobileconnection/tests/marionette/test_mobile_data_location.js b/dom/mobileconnection/tests/marionette/test_mobile_data_location.js index 06e4d4d3bd0..5f8ad218eb6 100644 --- a/dom/mobileconnection/tests/marionette/test_mobile_data_location.js +++ b/dom/mobileconnection/tests/marionette/test_mobile_data_location.js @@ -8,8 +8,6 @@ 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"); @@ -26,10 +24,7 @@ function testDataCellLocationUpdate(aLac, aCid) { // Set emulator's lac/cid and wait for 'ondatachange' event. log("Test cell location with lac=" + aLac + " and cid=" + aCid); - let promises = []; - promises.push(waitForManagerEvent("datachange")); - promises.push(setEmulatorGsmLocation(aLac, aCid)); - return Promise.all(promises) + return setEmulatorGsmLocationAndWait(aLac, aCid, false, true) .then(() => verifyDataCellLocationInfo(aLac, aCid)); } diff --git a/dom/mobileconnection/tests/marionette/test_mobile_data_state.js b/dom/mobileconnection/tests/marionette/test_mobile_data_state.js index 17eb6a43896..e7df08ebdcd 100644 --- a/dom/mobileconnection/tests/marionette/test_mobile_data_state.js +++ b/dom/mobileconnection/tests/marionette/test_mobile_data_state.js @@ -13,8 +13,8 @@ const INITIAL_STATES = { relSignalStrength: 44, cell: { - gsmLocationAreaCode: 65535, - gsmCellId: 268435455, + gsmLocationAreaCode: 0, + gsmCellId: 0, cdmaBaseStationId: -1, cdmaBaseStationLatitude: -2147483648, cdmaBaseStationLongitude: -2147483648, @@ -73,8 +73,8 @@ const TEST_DATA = [{ signalStrength: -99, relSignalStrength: 44, cell: { - gsmLocationAreaCode: 65535, - gsmCellId: 268435455 + gsmLocationAreaCode: 0, + gsmCellId: 0 } } }, { @@ -88,8 +88,8 @@ const TEST_DATA = [{ signalStrength: -99, relSignalStrength: 44, cell: { - gsmLocationAreaCode: 65535, - gsmCellId: 268435455 + gsmLocationAreaCode: 0, + gsmCellId: 0 } } } diff --git a/dom/mobileconnection/tests/marionette/test_mobile_operator_names.js b/dom/mobileconnection/tests/marionette/test_mobile_operator_names.js index 5b5a5eec82f..2f1b460ac33 100644 --- a/dom/mobileconnection/tests/marionette/test_mobile_operator_names.js +++ b/dom/mobileconnection/tests/marionette/test_mobile_operator_names.js @@ -16,10 +16,8 @@ function check(aLongName, aShortName) { function test(aLongName, aShortName) { log("Testing '" + aLongName + "', '" + aShortName + "':"); - let promises = []; - promises.push(waitForManagerEvent("voicechange")); - promises.push(setEmulatorOperatorNames("home", aLongName, aShortName)); - return Promise.all(promises) + return setEmulatorOperatorNamesAndWait("home", aLongName, aShortName, + null, null, true, false) .then(() => check(aLongName, aShortName)); } diff --git a/dom/mobileconnection/tests/marionette/test_mobile_operator_names_plmnlist.js b/dom/mobileconnection/tests/marionette/test_mobile_operator_names_plmnlist.js index 6f6df68e818..4bc12a1eacc 100644 --- a/dom/mobileconnection/tests/marionette/test_mobile_operator_names_plmnlist.js +++ b/dom/mobileconnection/tests/marionette/test_mobile_operator_names_plmnlist.js @@ -4,37 +4,110 @@ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = "head.js"; -function check(aLongName, aShortName, aMcc, aMnc) { +const TEST_CELL_ID = 268435399; // The largest prime number that is smaller than + // 0xFFFFFFF (DEC 268435455). The next one is + // 268435459. This doesn't mean anything. ;) + // See http://primes.utm.edu/lists/small/millions/ + +function check(aLongName, aShortName, aMcc, aMnc, aLac, aCid) { let network = mobileConnection.voice.network; + log(" Got longName '" + network.longName + "', shortName '" + + network.shortName + "'"); is(network.longName, aLongName, "network.longName"); is(network.shortName, aShortName, "network.shortName"); is(network.mcc, aMcc, "network.mcc"); is(network.mnc, aMnc, "network.mnc"); + + let cell = mobileConnection.voice.cell; + + is(cell.gsmLocationAreaCode, aLac, "cell.gsmLocationAreaCode"); + is(cell.gsmCellId, aCid, "cell.gsmCellId"); } -function test(aLongName, aShortName, aMcc, aMnc, aExpectedLongName, - aExpectedShortName) { - log("Testing mcc = " + aMcc + ", mnc = " + aMnc + ":"); +function test(aLongName, aShortName, aMcc, aMnc, aLac, aCid, + aExpectedLongName, aExpectedShortName) { + log("Testing mcc = " + aMcc + ", mnc = " + aMnc + ", lac = " + aLac + ":"); - let promises = []; - promises.push(waitForManagerEvent("voicechange")); - promises.push(setEmulatorOperatorNames("home", aLongName, aShortName, aMcc, aMnc)); - return Promise.all(promises) - .then(() => check(aExpectedLongName, aExpectedShortName, aMcc, aMnc)); + return setEmulatorGsmLocationAndWait(aLac, aCid) + .then(() => setEmulatorOperatorNamesAndWait("home", aLongName, aShortName, + aMcc, aMnc, true, false)) + // aExpectedLongName, aExpectedShortName could be empty string. + .then(() => check(aExpectedLongName == null ? aLongName : aExpectedLongName, + aExpectedShortName == null ? aShortName : aExpectedShortName, + aMcc, aMnc, aLac, aCid)); } startTestCommon(function() { + /** + * In emulator we have pre-defined 4 PNN sets: + * + * PNN 1: Full name: "Test1", Short name: "Test1" + * PNN 2: Full name: "Test2", Short name: (none) + * PNN 2: Full name: "Test3", Short name: (none) + * PNN 2: Full name: "Test4", Short name: (none) + * + * Also 4 OPL sets: + * + * MCC = 001, MNC = 01, START=0000, END=FFFE, PNN = 01, + * MCC = 001, MNC = 02, START=0001, END=0010, PNN = 02, + * MCC = 001, MNC = 03, START=0011, END=0011, PNN = 03, + * MCC = 001, MNC = 001, START=0012, END=0012, PNN = 04, + * + * See https://github.com/mozilla-b2g/platform_external_qemu/blob/master/telephony/sim_card.c#L725 + */ return getEmulatorOperatorNames() .then(function(aOperators) { let {longName: longName, shortName: shortName} = aOperators[0]; let {mcc: mcc, mnc: mnc} = mobileConnection.voice.network; + let {gsmLocationAreaCode: lac, gsmCellId: cid} = mobileConnection.voice.cell; + + // Use a cell ID that differs from current cid to ensure voicechange event + // will be triggered. + isnot(TEST_CELL_ID, cid, "A different test cell id than used currently."); + + // In following tests, we use different longName/shortName to ensure + // network name is always re-calculated in RIL worker. return Promise.resolve() - .then(() => test(longName, shortName, "123", "456", longName, shortName)) - .then(() => test(longName, shortName, "310", "070", "AT&T", "")) + // If MCC/MNC doesn't match any, report given home network name. + .then(() => test("Foo1", "Bar1", "123", "456", 0x0000, TEST_CELL_ID)) + .then(() => test("Foo2", "Bar2", "123", "456", 0x0001, TEST_CELL_ID)) + .then(() => test("Foo3", "Bar3", "123", "456", 0x0002, TEST_CELL_ID)) + .then(() => test("Foo4", "Bar4", "123", "456", 0x0010, TEST_CELL_ID)) + .then(() => test("Foo5", "Bar5", "123", "456", 0x0011, TEST_CELL_ID)) + .then(() => test("Foo6", "Bar6", "123", "456", 0xFFFE, TEST_CELL_ID)) + + // Full ranged network. Report network name from PNN. + .then(() => test("Foo1", "Bar1", "001", "01", 0x0000, TEST_CELL_ID, + "Test1", "Test1")) + .then(() => test("Foo2", "Bar2", "001", "01", 0x0001, TEST_CELL_ID, + "Test1", "Test1")) + .then(() => test("Foo3", "Bar3", "001", "01", 0xFFFE, TEST_CELL_ID, + "Test1", "Test1")) + + // Ranged network. Report network name from PNN if lac is inside the + // inclusive range 0x01..0x10. + .then(() => test("Foo1", "Bar1", "001", "02", 0x0000, TEST_CELL_ID)) + .then(() => test("Foo2", "Bar2", "001", "02", 0x0001, TEST_CELL_ID, + "Test2", "")) + .then(() => test("Foo3", "Bar3", "001", "02", 0x0002, TEST_CELL_ID, + "Test2", "")) + .then(() => test("Foo4", "Bar4", "001", "02", 0x0010, TEST_CELL_ID, + "Test2", "")) + .then(() => test("Foo5", "Bar5", "001", "02", 0xFFFE, TEST_CELL_ID)) + + // Single entry network. Report network name from PNN if lac matches. + .then(() => test("Foo1", "Bar1", "001", "03", 0x0000, TEST_CELL_ID)) + .then(() => test("Foo2", "Bar2", "001", "03", 0x0011, TEST_CELL_ID, + "Test3", "")) + .then(() => test("Foo3", "Bar3", "001", "03", 0xFFFE, TEST_CELL_ID)) + + // Test if we match MNC "01" and "001" correctly. + .then(() => test("Foo1", "Bar1", "001", "001", 0x0012, TEST_CELL_ID, + "Test4", "")) // Reset back to initial values. - .then(() => test(longName, shortName, mcc, mnc, longName, shortName)); + .then(() => test(longName, shortName, mcc, mnc, lac, cid)); }); }); diff --git a/dom/mobileconnection/tests/marionette/test_mobile_operator_names_roaming.js b/dom/mobileconnection/tests/marionette/test_mobile_operator_names_roaming.js index e38ec2937d0..9912d415b8a 100644 --- a/dom/mobileconnection/tests/marionette/test_mobile_operator_names_roaming.js +++ b/dom/mobileconnection/tests/marionette/test_mobile_operator_names_roaming.js @@ -13,13 +13,6 @@ function check(aLongName, aShortName, aRoaming) { is(voice.roaming, aRoaming, "voice.roaming"); } -function setEmulatorOperatorNamesAndWait(aWhich, aLongName, aShortName) { - let promises = []; - promises.push(waitForManagerEvent("voicechange")); - promises.push(setEmulatorOperatorNames(aWhich, aLongName, aShortName)); - return Promise.all(promises); -} - // See bug 797972 - B2G RIL: False roaming situation // // Steps to test: @@ -34,7 +27,8 @@ function test(aLongName, aShortName, aRoaming) { return Promise.resolve() // We should not have voicechange here, but, yes, we do. - .then(() => setEmulatorOperatorNamesAndWait("roaming", aLongName, aShortName)) + .then(() => setEmulatorOperatorNamesAndWait("roaming", aLongName, aShortName, + null, null, true, false)) .then(() => setEmulatorVoiceDataStateAndWait("voice", "roaming")) .then(() => check(aLongName, aShortName, aRoaming)) diff --git a/dom/mobileconnection/tests/marionette/test_mobile_voice_location.js b/dom/mobileconnection/tests/marionette/test_mobile_voice_location.js index eb977b5afc6..9501bf1378a 100644 --- a/dom/mobileconnection/tests/marionette/test_mobile_voice_location.js +++ b/dom/mobileconnection/tests/marionette/test_mobile_voice_location.js @@ -8,8 +8,6 @@ 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"); @@ -26,10 +24,7 @@ function testVoiceCellLocationUpdate(aLac, aCid) { // Set emulator's lac/cid and wait for 'onvoicechange' event. log("Test cell location with lac=" + aLac + " and cid=" + aCid); - let promises = []; - promises.push(waitForManagerEvent("voicechange")); - promises.push(setEmulatorGsmLocation(aLac, aCid)); - return Promise.all(promises) + return setEmulatorGsmLocationAndWait(aLac, aCid, true, false) .then(() => verifyVoiceCellLocationInfo(aLac, aCid)); } diff --git a/dom/mobileconnection/tests/marionette/test_mobile_voice_state.js b/dom/mobileconnection/tests/marionette/test_mobile_voice_state.js index 59f33b1e2c1..b3aa3103d63 100644 --- a/dom/mobileconnection/tests/marionette/test_mobile_voice_state.js +++ b/dom/mobileconnection/tests/marionette/test_mobile_voice_state.js @@ -13,8 +13,8 @@ const INITIAL_STATES = { relSignalStrength: 44, cell: { - gsmLocationAreaCode: 65535, - gsmCellId: 268435455, + gsmLocationAreaCode: 0, + gsmCellId: 0, cdmaBaseStationId: -1, cdmaBaseStationLatitude: -2147483648, cdmaBaseStationLongitude: -2147483648, @@ -70,8 +70,8 @@ const TEST_DATA = [{ signalStrength: -99, relSignalStrength: 44, cell: { - gsmLocationAreaCode: 65535, - gsmCellId: 268435455 + gsmLocationAreaCode: 0, + gsmCellId: 0 } } }, { @@ -85,8 +85,8 @@ const TEST_DATA = [{ signalStrength: -99, relSignalStrength: 44, cell: { - gsmLocationAreaCode: 65535, - gsmCellId: 268435455 + gsmLocationAreaCode: 0, + gsmCellId: 0 } } } diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 4cc634fc265..25557c32a75 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -13622,7 +13622,7 @@ ICCUtilsHelperObject.prototype = { let iccInfo = RIL.iccInfo; let pnnEntry; - if (!mcc || !mnc || !lac) { + if (!mcc || !mnc || lac == null || lac < 0) { return null; }