Bug 979134 (follow-up): convert test_mobile_last_known_network.js to Promise. r=vicamo

This commit is contained in:
Edgar Chen 2014-06-19 18:38:47 +08:00
parent 7b0506551d
commit deb029e8d0

View File

@ -1,47 +1,13 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 30000;
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
SpecialPowers.addPermission("mobilenetwork", true, document);
let connection = navigator.mozMobileConnections[0];
ok(connection instanceof MozMobileConnection,
"connection is instanceof " + connection.constructor);
function testLastKnownNetwork() {
log("testLastKnownNetwork: " + connection.lastKnownNetwork);
// Start tests
startTestCommon(function() {
// The emulator's hard coded operatoer's mcc and mnc codes.
is(connection.lastKnownNetwork, "310-260");
runNextTest();
}
function testLastKnownHomeNetwork() {
log("testLastKnownHomeNetwork: " + connection.lastKnownHomeNetwork);
is(mobileConnection.lastKnownNetwork, "310-260");
// The emulator's hard coded icc's mcc and mnc codes.
is(connection.lastKnownHomeNetwork, "310-260");
runNextTest();
}
let tests = [
testLastKnownNetwork,
testLastKnownHomeNetwork
];
function runNextTest() {
let test = tests.shift();
if (!test) {
cleanUp();
return;
}
test();
}
function cleanUp() {
SpecialPowers.removePermission("mobilenetwork", document);
finish();
}
runNextTest();
is(mobileConnection.lastKnownHomeNetwork, "310-260");
});