1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/mobileconnection/tests/marionette/test_mobile_operator_names.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +MARIONETTE_TIMEOUT = 60000; 1.8 +MARIONETTE_HEAD_JS = "head.js"; 1.9 + 1.10 +function check(aLongName, aShortName) { 1.11 + let network = mobileConnection.voice.network; 1.12 + 1.13 + is(network.longName, aLongName, "network.longName"); 1.14 + is(network.shortName, aShortName, "network.shortName"); 1.15 + is(network.mcc, "310", "network.mcc"); 1.16 + is(network.mnc, "260", "network.mnc"); 1.17 +} 1.18 + 1.19 +function test(aLongName, aShortName) { 1.20 + log("Testing '" + aLongName + "', '" + aShortName + "':"); 1.21 + 1.22 + let promises = []; 1.23 + promises.push(waitForManagerEvent("voicechange")); 1.24 + promises.push(setEmulatorOperatorNames("home", aLongName, aShortName)); 1.25 + return Promise.all(promises) 1.26 + .then(() => check(aLongName, aShortName)); 1.27 +} 1.28 + 1.29 +startTestCommon(function() { 1.30 + return getEmulatorOperatorNames() 1.31 + .then(function(aOperators) { 1.32 + return Promise.resolve() 1.33 + 1.34 + .then(() => test("Mozilla", "B2G")) 1.35 + .then(() => test("Mozilla", "")) 1.36 + .then(() => test("", "B2G")) 1.37 + .then(() => test("", "")) 1.38 + 1.39 + // Reset back to initial values. 1.40 + .then(() => test(aOperators[0].longName, aOperators[0].shortName)); 1.41 + }); 1.42 +});