diff -r 000000000000 -r 6474c204b198 dom/mobileconnection/tests/marionette/test_mobile_operator_names.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dom/mobileconnection/tests/marionette/test_mobile_operator_names.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,39 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 60000; +MARIONETTE_HEAD_JS = "head.js"; + +function check(aLongName, aShortName) { + let network = mobileConnection.voice.network; + + is(network.longName, aLongName, "network.longName"); + is(network.shortName, aShortName, "network.shortName"); + is(network.mcc, "310", "network.mcc"); + is(network.mnc, "260", "network.mnc"); +} + +function test(aLongName, aShortName) { + log("Testing '" + aLongName + "', '" + aShortName + "':"); + + let promises = []; + promises.push(waitForManagerEvent("voicechange")); + promises.push(setEmulatorOperatorNames("home", aLongName, aShortName)); + return Promise.all(promises) + .then(() => check(aLongName, aShortName)); +} + +startTestCommon(function() { + return getEmulatorOperatorNames() + .then(function(aOperators) { + return Promise.resolve() + + .then(() => test("Mozilla", "B2G")) + .then(() => test("Mozilla", "")) + .then(() => test("", "B2G")) + .then(() => test("", "")) + + // Reset back to initial values. + .then(() => test(aOperators[0].longName, aOperators[0].shortName)); + }); +});