dom/mobileconnection/tests/marionette/test_mobile_operator_names_roaming.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 MARIONETTE_TIMEOUT = 60000;
michael@0 5 MARIONETTE_HEAD_JS = "head.js";
michael@0 6
michael@0 7 function check(aLongName, aShortName, aRoaming) {
michael@0 8 let voice = mobileConnection.voice;
michael@0 9 let network = voice.network;
michael@0 10
michael@0 11 is(network.longName, aLongName, "network.longName");
michael@0 12 is(network.shortName, aShortName, "network.shortName");
michael@0 13 is(voice.roaming, aRoaming, "voice.roaming");
michael@0 14 }
michael@0 15
michael@0 16 function setEmulatorOperatorNamesAndWait(aWhich, aLongName, aShortName) {
michael@0 17 let promises = [];
michael@0 18 promises.push(waitForManagerEvent("voicechange"));
michael@0 19 promises.push(setEmulatorOperatorNames(aWhich, aLongName, aShortName));
michael@0 20 return Promise.all(promises);
michael@0 21 }
michael@0 22
michael@0 23 // See bug 797972 - B2G RIL: False roaming situation
michael@0 24 //
michael@0 25 // Steps to test:
michael@0 26 // 1. set roaming operator names
michael@0 27 // 2. set emulator roaming
michael@0 28 // 3. wait for onvoicechange event and test passing conditions
michael@0 29 // 4. set emulator roaming back to false
michael@0 30 // 5. wait for onvoicechange event again and callback
michael@0 31 function test(aLongName, aShortName, aRoaming) {
michael@0 32 log("Testing roaming check '" + aLongName + "', '" + aShortName + "':");
michael@0 33
michael@0 34 return Promise.resolve()
michael@0 35
michael@0 36 // We should not have voicechange here, but, yes, we do.
michael@0 37 .then(() => setEmulatorOperatorNamesAndWait("roaming", aLongName, aShortName))
michael@0 38
michael@0 39 .then(() => setEmulatorVoiceDataStateAndWait("voice", "roaming"))
michael@0 40 .then(() => check(aLongName, aShortName, aRoaming))
michael@0 41 .then(() => setEmulatorVoiceDataStateAndWait("voice", "home"));
michael@0 42 }
michael@0 43
michael@0 44 startTestCommon(function() {
michael@0 45 return getEmulatorOperatorNames()
michael@0 46 .then(function(aOperators) {
michael@0 47 let {longName: longName, shortName: shortName} = aOperators[0];
michael@0 48
michael@0 49 return Promise.resolve()
michael@0 50
michael@0 51 // If Either long name or short name of current registered operator
michael@0 52 // matches SPN("Android"), then the `roaming` attribute should be set
michael@0 53 // to false.
michael@0 54 .then(() => test(longName, shortName, false))
michael@0 55 .then(() => test(longName, shortName.toLowerCase(), false))
michael@0 56 .then(() => test(longName, "Bar", false))
michael@0 57 .then(() => test(longName.toLowerCase(), shortName, false))
michael@0 58 .then(() => test(longName.toLowerCase(), shortName.toLowerCase(), false))
michael@0 59 .then(() => test(longName.toLowerCase(), "Bar", false))
michael@0 60 .then(() => test("Foo", shortName, false))
michael@0 61 .then(() => test("Foo", shortName.toLowerCase(), false))
michael@0 62 .then(() => test("Foo", "Bar", true))
michael@0 63
michael@0 64 // Reset roaming operator.
michael@0 65 .then(() => setEmulatorOperatorNamesAndWait("roaming",
michael@0 66 aOperators[1].longName,
michael@0 67 aOperators[1].shortName));
michael@0 68 });
michael@0 69 });

mercurial