1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/mobileconnection/tests/marionette/test_mobile_last_known_network.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,47 @@ 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 = 30000; 1.8 + 1.9 +SpecialPowers.addPermission("mobilenetwork", true, document); 1.10 + 1.11 +let connection = navigator.mozMobileConnections[0]; 1.12 +ok(connection instanceof MozMobileConnection, 1.13 + "connection is instanceof " + connection.constructor); 1.14 + 1.15 + 1.16 +function testLastKnownNetwork() { 1.17 + log("testLastKnownNetwork: " + connection.lastKnownNetwork); 1.18 + // The emulator's hard coded operatoer's mcc and mnc codes. 1.19 + is(connection.lastKnownNetwork, "310-260"); 1.20 + runNextTest(); 1.21 +} 1.22 + 1.23 +function testLastKnownHomeNetwork() { 1.24 + log("testLastKnownHomeNetwork: " + connection.lastKnownHomeNetwork); 1.25 + // The emulator's hard coded icc's mcc and mnc codes. 1.26 + is(connection.lastKnownHomeNetwork, "310-260"); 1.27 + runNextTest(); 1.28 +} 1.29 + 1.30 +let tests = [ 1.31 + testLastKnownNetwork, 1.32 + testLastKnownHomeNetwork 1.33 +]; 1.34 + 1.35 +function runNextTest() { 1.36 + let test = tests.shift(); 1.37 + if (!test) { 1.38 + cleanUp(); 1.39 + return; 1.40 + } 1.41 + 1.42 + test(); 1.43 +} 1.44 + 1.45 +function cleanUp() { 1.46 + SpecialPowers.removePermission("mobilenetwork", document); 1.47 + finish(); 1.48 +} 1.49 + 1.50 +runNextTest();