michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: MARIONETTE_TIMEOUT = 60000; michael@0: MARIONETTE_HEAD_JS = "head.js"; michael@0: michael@0: function check(aLongName, aShortName, aRoaming) { michael@0: let voice = mobileConnection.voice; michael@0: let network = voice.network; michael@0: michael@0: is(network.longName, aLongName, "network.longName"); michael@0: is(network.shortName, aShortName, "network.shortName"); michael@0: is(voice.roaming, aRoaming, "voice.roaming"); michael@0: } michael@0: michael@0: function setEmulatorOperatorNamesAndWait(aWhich, aLongName, aShortName) { michael@0: let promises = []; michael@0: promises.push(waitForManagerEvent("voicechange")); michael@0: promises.push(setEmulatorOperatorNames(aWhich, aLongName, aShortName)); michael@0: return Promise.all(promises); michael@0: } michael@0: michael@0: // See bug 797972 - B2G RIL: False roaming situation michael@0: // michael@0: // Steps to test: michael@0: // 1. set roaming operator names michael@0: // 2. set emulator roaming michael@0: // 3. wait for onvoicechange event and test passing conditions michael@0: // 4. set emulator roaming back to false michael@0: // 5. wait for onvoicechange event again and callback michael@0: function test(aLongName, aShortName, aRoaming) { michael@0: log("Testing roaming check '" + aLongName + "', '" + aShortName + "':"); michael@0: michael@0: return Promise.resolve() michael@0: michael@0: // We should not have voicechange here, but, yes, we do. michael@0: .then(() => setEmulatorOperatorNamesAndWait("roaming", aLongName, aShortName)) michael@0: michael@0: .then(() => setEmulatorVoiceDataStateAndWait("voice", "roaming")) michael@0: .then(() => check(aLongName, aShortName, aRoaming)) michael@0: .then(() => setEmulatorVoiceDataStateAndWait("voice", "home")); michael@0: } michael@0: michael@0: startTestCommon(function() { michael@0: return getEmulatorOperatorNames() michael@0: .then(function(aOperators) { michael@0: let {longName: longName, shortName: shortName} = aOperators[0]; michael@0: michael@0: return Promise.resolve() michael@0: michael@0: // If Either long name or short name of current registered operator michael@0: // matches SPN("Android"), then the `roaming` attribute should be set michael@0: // to false. michael@0: .then(() => test(longName, shortName, false)) michael@0: .then(() => test(longName, shortName.toLowerCase(), false)) michael@0: .then(() => test(longName, "Bar", false)) michael@0: .then(() => test(longName.toLowerCase(), shortName, false)) michael@0: .then(() => test(longName.toLowerCase(), shortName.toLowerCase(), false)) michael@0: .then(() => test(longName.toLowerCase(), "Bar", false)) michael@0: .then(() => test("Foo", shortName, false)) michael@0: .then(() => test("Foo", shortName.toLowerCase(), false)) michael@0: .then(() => test("Foo", "Bar", true)) michael@0: michael@0: // Reset roaming operator. michael@0: .then(() => setEmulatorOperatorNamesAndWait("roaming", michael@0: aOperators[1].longName, michael@0: aOperators[1].shortName)); michael@0: }); michael@0: });