Bug 895775 - Handle bogus network settings in testNetworkManager. r=fix-test
authorMark Finkle <mfinkle@mozilla.com>
Sun, 26 Oct 2014 21:12:32 -0400
changeset 212440 5d04d8f6e8565850db2448724585f14a768e28fe
parent 212439 d7460d5fee44d94e4873b10a4953b4bb97259181
child 212441 1c7ed7ed67abf275ecbd28d755d03d91ea6dc412
push id27711
push usercbook@mozilla.com
push dateMon, 27 Oct 2014 14:56:47 +0000
treeherdermozilla-central@20408ad61ce5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfix-test
bugs895775
milestone36.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 895775 - Handle bogus network settings in testNetworkManager. r=fix-test
mobile/android/base/tests/testNetworkManager.js
--- a/mobile/android/base/tests/testNetworkManager.js
+++ b/mobile/android/base/tests/testNetworkManager.js
@@ -9,18 +9,20 @@ const { classes: Cc, interfaces: Ci, uti
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 function ok(passed, text) {
   do_report_result(passed, text, Components.stack.caller, false);
 }
 
 add_test(function check_linktype() {
+  // Let's exercise the interface. Even if the network is not up, we can make sure nothing blows up.
   let network = Cc["@mozilla.org/network/network-link-service;1"].getService(Ci.nsINetworkLinkService);
-  do_print("LinkUp = " + network.isLinkUp);
-  do_print("LinkStatus = " + network.linkStatusKnown);
-  do_print("Linktype = " + network.linkType);
-  ok(network.linkType != Ci.nsINetworkLinkService.LINK_TYPE_UNKNOWN, "LinkType is not UNKNOWN");
+  if (network.isLinkUp) {
+    ok(network.linkType != Ci.nsINetworkLinkService.LINK_TYPE_UNKNOWN, "LinkType is not UNKNOWN");
+  } else {
+    ok(network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_UNKNOWN, "LinkType is UNKNOWN");
+  }
 
   run_next_test();
 });
 
 run_next_test();