From deb029e8d07db4babe7fa1595dc0691187bd6f64 Mon Sep 17 00:00:00 2001 From: Edgar Chen Date: Thu, 19 Jun 2014 18:38:47 +0800 Subject: [PATCH] Bug 979134 (follow-up): convert test_mobile_last_known_network.js to Promise. r=vicamo --- .../test_mobile_last_known_network.js | 48 +++---------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/dom/mobileconnection/tests/marionette/test_mobile_last_known_network.js b/dom/mobileconnection/tests/marionette/test_mobile_last_known_network.js index 3adb50694f4..0fc9efa3624 100644 --- a/dom/mobileconnection/tests/marionette/test_mobile_last_known_network.js +++ b/dom/mobileconnection/tests/marionette/test_mobile_last_known_network.js @@ -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"); +});