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 212386 5d04d8f6e8565850db2448724585f14a768e28fe
parent 212385 d7460d5fee44d94e4873b10a4953b4bb97259181
child 212387 1c7ed7ed67abf275ecbd28d755d03d91ea6dc412
push id9570
push usermfinkle@mozilla.com
push dateMon, 27 Oct 2014 01:12:58 +0000
treeherderfx-team@5d04d8f6e856 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfix-test
bugs895775
milestone36.0a1
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();