Bug 952371 - Part 4: tests - [DSDS] mozMobileconnection.lastKnownNetwork and .lastKnownHomeNetwork aren't working. r=hsinyi
authorJessica Jong <jjong@mozilla.com>
Wed, 08 Jan 2014 18:54:34 +0800
changeset 162528 3b867c474f453f66c036ad87d3bcb88333918434
parent 162527 50101ad17ae757a8e2387de9b90b466f5cc14428
child 162529 10fab3d00e8a61ae0b95e463c28dea3cc4addb7d
push id25958
push userryanvm@gmail.com
push dateWed, 08 Jan 2014 20:22:21 +0000
treeherdermozilla-central@8988416e489d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsinyi
bugs952371
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 952371 - Part 4: tests - [DSDS] mozMobileconnection.lastKnownNetwork and .lastKnownHomeNetwork aren't working. r=hsinyi
dom/network/tests/marionette/manifest.ini
dom/network/tests/marionette/test_mobile_last_known_network.js
--- a/dom/network/tests/marionette/manifest.ini
+++ b/dom/network/tests/marionette/manifest.ini
@@ -14,8 +14,9 @@ disabled = Bug 808783
 [test_mobile_data_location.js]
 [test_mobile_data_state.js]
 [test_mobile_mmi.js]
 [test_mobile_roaming_preference.js]
 [test_call_barring_get_option.js]
 [test_call_barring_set_error.js]
 [test_call_barring_change_password.js]
 [test_mobile_set_radio.js]
+[test_mobile_last_known_network.js]
new file mode 100644
--- /dev/null
+++ b/dom/network/tests/marionette/test_mobile_last_known_network.js
@@ -0,0 +1,47 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 30000;
+
+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);
+  // The emulator's hard coded operatoer's mcc and mnc codes.
+  is(connection.lastKnownNetwork, "310-260");
+  runNextTest();
+}
+
+function testLastKnownHomeNetwork() {
+  log("testLastKnownHomeNetwork: " + connection.lastKnownHomeNetwork);
+  // 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();