Bug 1310297 - Remove test annotations using b2g, mulet or gonk: dom/network. r?RyanVM draft
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sat, 05 Nov 2016 11:29:17 +0100
changeset 434269 c40539f17dbd50cc53dc893f4580e75c61c1b833
parent 434268 f4262cfc3dc5eeeb30323fe8045eba91ecb607c5
child 434270 3a5e5cfcdab2e952c528c6a630f03f2888ffcfb7
push id34753
push userarchaeopteryx@coole-files.de
push dateSat, 05 Nov 2016 10:33:00 +0000
reviewersRyanVM
bugs1310297
milestone52.0a1
Bug 1310297 - Remove test annotations using b2g, mulet or gonk: dom/network. r?RyanVM MozReview-Commit-ID: 9abA3P3P6SL
dom/network/tests/chrome.ini
dom/network/tests/mochitest.ini
dom/network/tests/test_networkstats_alarms.html
dom/network/tests/test_networkstats_basics.html
dom/network/tests/test_networkstats_disabled.html
dom/network/tests/test_networkstats_enabled_no_perm.html
dom/network/tests/test_networkstats_enabled_perm.html
--- a/dom/network/tests/chrome.ini
+++ b/dom/network/tests/chrome.ini
@@ -3,11 +3,10 @@ support-files =
   tcpsocket_test.jsm
   test_tcpsocket_client_and_server_basics.js
   add_task.js
   file_udpsocket_iframe.html
 
 [test_tcpsocket_jsm.html]
 [test_tcpsocket_client_and_server_basics.html]
 [test_tcpsocket_enabled_with_perm.html]
-skip-if = toolkit == "gonk"
 [test_tcpsocket_legacy.html]
 [test_udpsocket.html]
--- a/dom/network/tests/mochitest.ini
+++ b/dom/network/tests/mochitest.ini
@@ -1,20 +1,8 @@
 [DEFAULT]
 support-files =
   add_task.js
 
 [test_network_basics.html]
-skip-if = toolkit == "gonk" || toolkit == 'android'
+skip-if = toolkit == 'android'
 [test_tcpsocket_default_permissions.html]
-skip-if = toolkit == "gonk"
 [test_tcpsocket_enabled_no_perm.html]
-skip-if = toolkit == "gonk"
-[test_networkstats_alarms.html]
-skip-if = toolkit != "gonk"
-[test_networkstats_basics.html]
-skip-if = toolkit != "gonk"
-[test_networkstats_disabled.html]
-skip-if = toolkit != "gonk"
-[test_networkstats_enabled_no_perm.html]
-skip-if = toolkit != "gonk"
-[test_networkstats_enabled_perm.html]
-skip-if = toolkit != "gonk"
deleted file mode 100644
--- a/dom/network/tests/test_networkstats_alarms.html
+++ /dev/null
@@ -1,237 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test for NetworkStats alarms</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<p id="display"></p>
-<div id="content">
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-function test() {
-  ok(true, "Checking if no alarms are set.");
-
-  req = navigator.mozNetworkStats.getAllAlarms();
-
-  req.onsuccess = function () {
-    ok(true, "Succeeded to get alarms.");
-    ok(Array.isArray(req.result) && req.result.length == 0,
-       "There are no alarms set.");
-    next();
-  };
-
-  req.onerror = function () {
-    ok(false, "getAllAlarms() shouldn't fail!");
-  }
-}
-
-var req;
-var index = -1;
-
-var wifi = {'type': 0, 'id': '0'};
-var mobile = {'type': 1, 'id': '1'};
-
-var steps = [
-  function () {
-    ok(true, "Calling getAllAlarms() with invalid network.");
-
-    req = navigator.mozNetworkStats
-                   .getAllAlarms(new window.MozNetworkStatsInterface(mobile));
-
-    req.onsuccess = function () {
-      ok(false, "getAllAlarms() shouldn't succeed!");
-    };
-
-    req.onerror = function () {
-      is(req.error.name, "InvalidInterface", "Get InvalidInterface error");
-      next();
-    }
-  },
-  function () {
-    ok(true, "Calling addAlarm() with invalid network or parameters.");
-    var msg = "TypeError: Not enough arguments to MozNetworkStatsManager.addAlarm.";
-
-    try {
-      navigator.mozNetworkStats.addAlarm();
-    } catch(ex) {
-      is(ex.toString(), msg, "addAlarm() throws \"" + msg + "\" when no parameters");
-    }
-
-    try {
-      navigator.mozNetworkStats.addAlarm(100000);
-    } catch(ex) {
-      is(ex.toString(), msg, "addAlarm() throws " + msg + " when no network");
-    }
-
-    try {
-      navigator.mozNetworkStats.addAlarm(new window.MozNetworkStatsInterface(wifi));
-    } catch(ex) {
-      is(ex.toString(), msg, "addAlarm() throws " + msg + " when no threshold");
-    }
-
-    req = navigator.mozNetworkStats
-                   .addAlarm(new window.MozNetworkStatsInterface(mobile), -100000);
-
-    req.onsuccess = function () {
-      ok(false, "addAlarm() shouldn't succeed with negative threshold.");
-    };
-
-    req.onerror = function () {
-      is(req.error.name, "InvalidThresholdValue", "Get InvalidThresholdValue error");
-      next();
-    }
-  },
-  function () {
-    ok(true, "Calling addAlarm()");
-
-    req = navigator.mozNetworkStats
-                   .addAlarm(new window.MozNetworkStatsInterface(wifi), 100000000);
-
-    req.onsuccess = function () {
-      ok(true, "Succeeded to add alarm. AlarmId: " + req.result);
-      next();
-    };
-    req.onerror = function () {
-      ok(false, "addAlarm() shouldn't fail.");
-    };
-  },
-  function () {
-    ok(true, "Calling getAllAlarms()");
-
-    req = navigator.mozNetworkStats
-                   .getAllAlarms(new window.MozNetworkStatsInterface(wifi));
-
-    req.onsuccess = function () {
-      is(req.result.length, 1, "Only one alarm");
-      is(req.result[0].alarmId, 1, "Get correct alarmId");
-      next();
-    };
-
-    req.onerror = function () {
-      ok(false, "getAllAlarms() shouldn't fail.");
-    }
-  },
-  function () {
-    ok(true, "Calling removeAlarms() to remove alarms.");
-
-    req = navigator.mozNetworkStats.removeAlarms();
-
-    req.onsuccess = function () {
-      ok(req.result, "Succeeded to remove alarms.");
-      next();
-    };
-
-    req.onerror = function () {
-      ok(false, "removeAlarms() shouldn't fail.");
-    }
-  },
-  function () {
-    ok(true, "Checking if all alarms are removed.");
-
-    req = navigator.mozNetworkStats.getAllAlarms();
-
-    req.onsuccess = function () {
-      ok(Array.isArray(req.result) && req.result.length == 0,
-         "Succeeded to remove all alarms.");
-      next();
-    };
-
-    req.onerror = function () {
-      ok(false, "getAllAlarms() shouldn't fail.");
-    }
-  },
-  // Bug 1209654 - Test threshold value will overflow or not for 2^32.
-  function () {
-    ok(true, "Calling addAlarm() with threshold greater than 4GiB");
-
-    req = navigator.mozNetworkStats
-                   .addAlarm(new window.MozNetworkStatsInterface(wifi), 5000000000);
-
-    req.onsuccess = function () {
-      ok(true, "Succeeded to add alarm. AlarmId: " + req.result);
-      next();
-    };
-    req.onerror = function () {
-      ok(false, "addAlarm() shouldn't fail.");
-    };
-  },
-  function () {
-    ok(true, "Calling getAllAlarms() and check threshold.");
-
-    req = navigator.mozNetworkStats.getAllAlarms();
-
-    req.onsuccess = function () {
-      ok(Array.isArray(req.result) && req.result[0].threshold == 5000000000,
-         "Succeeded to check threshold.");
-      next();
-    };
-
-    req.onerror = function () {
-      ok(false, "getAllAlarms() shouldn't fail.");
-    }
-  },
-  // Bug 1209654 - Test threshold value will overflow or not for signed long.
-  function () {
-    ok(true, "Calling addAlarm() with threshold 3 Gib");
-
-    req = navigator.mozNetworkStats
-                   .addAlarm(new window.MozNetworkStatsInterface(wifi), 3000000000);
-
-    req.onsuccess = function () {
-      ok(true, "Succeeded to add alarm. AlarmId: " + req.result);
-      next();
-    };
-    req.onerror = function () {
-      ok(false, "addAlarm() shouldn't fail.");
-    };
-  },
-  function () {
-    ok(true, "all done!\n");
-    SimpleTest.finish();
-    return;
-  }
-];
-
-function next() {
-  index += 1;
-  if (index >= steps.length) {
-    ok(false, "Shouldn't get here!");
-    return;
-  }
-  try {
-    steps[index]();
-  } catch(ex) {
-    ok(false, "Caught exception", ex);
-  }
-}
-
-SimpleTest.waitForExplicitFinish();
-
-SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]},
-                          function() {
-  SpecialPowers.pushPermissions([{ 'type': 'networkstats-manage', 'allow': 1, 'context': window.document }],
-                                function() {
-    ok(SpecialPowers.hasPermission("networkstats-manage", document),
-       "Has permission 'networkstats-manage'.");
-
-    ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
-       "Preference 'dom.mozNetworkStats.enabled' is true.");
-
-    ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
-
-    ok(navigator.mozNetworkStats instanceof MozNetworkStatsManager,
-       "navigator.mozNetworkStats should be a MozNetworkStatsManager object");
-
-    test();
-  });
-});
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/network/tests/test_networkstats_basics.html
+++ /dev/null
@@ -1,346 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test for NetworkStats</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-function test() {
-  netStats = window.navigator.mozNetworkStats;
-  ok(netStats, "mozNetworkStats exists");
-
-  // Test IDL attributes
-  ok('sampleRate' in netStats,
-   "sampleRate should be a NetworkStats attribute");
-  ok(netStats.sampleRate > 0,
-   "sampleRate is greater than 0.");
-
-  ok('maxStorageAge' in netStats,
-   "maxStorageAge should be a NetworkStats attribute");
-  ok(netStats.maxStorageAge > 0,
-   "maxStorageAge is greater than 0.");
-
-  // Test IDL methods
-  next();
-  return;
-}
-
-function checkDataDates(data, start, end, sampleRate) {
-  var offset = (new Date()).getTimezoneOffset() * 60 * 1000;
-  start = Math.floor((start.getTime() - offset) / sampleRate) * sampleRate + offset;
-  end = Math.floor((end.getTime() - offset) / sampleRate) * sampleRate + offset;
-
-  var counter = 0;
-  var date = start;
-  var success = true;
-
-  do {
-    if(data[counter].date.getTime() !=  date) {
-      success = false;
-      break;
-    }
-    date += sampleRate;
-    counter++;
-  } while (date <= end);
-
-  ok(success, "data result has correct dates");
-}
-
-function compareNetworks(networkA, networkB) {
-  return (networkA.id == networkB.id &&
-          networkA.type == networkB.type);
-}
-
-var req;
-var index = -1;
-var netStats = null;
-
-var steps = [
-  function () {
-    // Test getAvailableNetworks
-    req = netStats.getAvailableNetworks();
-    req.onsuccess = function () {
-      ok(true, "getAvailableNetworks request ok");
-      ok(Array.isArray(req.result) && req.result.length > 0,
-         "getAvailableNetworks returns an array not empty");
-      next();
-    };
-    req.onerror = function () {
-      ok(false, "getAvailableNetworks failure!");
-    }
-  },
-  function () {
-    // Test clearAllStats
-    req = netStats.clearAllStats();
-    req.onsuccess = function () {
-      ok(true, "clearAllStats deleted the database");
-      next();
-    };
-    req.onerror = function () {
-      ok(false, "clearAllStats deleted the database");
-    }
-  },
-  function () {
-    // Check if getSamples throws exception when start is greather than end
-
-    // Prepare get params
-    req = netStats.getAvailableNetworks();
-    req.onsuccess = function () {
-      var network = req.result[0];
-
-      // Get dates
-      var endDate = new Date();
-      var startDate = new Date(endDate.getTime() + 1000);
-
-      try {
-        netStats.getSamples(network, startDate, endDate);
-      } catch(ex) {
-        ok(true, "getSamples throws exception when start is greater than end");
-        next();
-        return;
-      }
-
-      ok(false, "getSamples throws exception when start is greater than end");
-      next();
-      return;
-    };
-    req.onerror = function () {
-      ok(false, "Error getting networks!");
-    }
-  },
-  function () {
-    // Test if call getSamples with network of type different than
-    // MozNetworkStatsInterface throws an exception
-
-    // Prepare get params
-    var network = "wifi";
-    var endDate = new Date();
-    var startDate = new Date(endDate.getTime() - 1000);
-
-    try {
-      netStats.getSamples(network, new Date(), new Date());
-    } catch(ex) {
-      ok(true, "getSamples throws exception if network is not " +
-               "a MozNetworkStatsInterface");
-      next();
-      return;
-    }
-
-    ok(false, "getSamples throws exception if network is not " +
-              "a MozNetworkStatsInterface");
-  },
-  function () {
-    // Test if call getSamples with start parameter type different than Date throws an exception
-
-    // Prepare get params
-    req = netStats.getAvailableNetworks();
-    req.onsuccess = function () {
-      var network = req.result[0];
-
-      var endDate = new Date();
-      var startDate = new Date(endDate.getTime() - 1000);
-      startDate = startDate.toString();
-
-      try {
-        netStats.getSamples(network, startDate, endDate);
-      } catch(ex) {
-        ok(true, "getSamples throws exception when start param is not a Date");
-        next();
-        return;
-      }
-
-      ok(false, "getSamples throws exception when start param is not a Date");
-    };
-    req.onerror = function () {
-      ok(false, "Error getting networks!");
-    };
-  },
-  function () {
-    // Test if call getSamples with end parameter type different than Date throws an exception
-
-    // Prepare get params
-    req = netStats.getAvailableNetworks();
-    req.onsuccess = function () {
-      var network = req.result[0];
-
-      var endDate = new Date();
-      var startDate = new Date(endDate.getTime() - 1000);
-      endDate = startDate.toString();
-
-      try {
-        netStats.getSamples(network, startDate, endDate);
-      } catch(ex) {
-        ok(true, "getSamples throws exception when end param is not a Date");
-        next();
-        return;
-      }
-
-      ok(false, "getSamples throws exception when end param is not a Date");
-    };
-    req.onerror = function () {
-      ok(false, "Error getting networks!");
-    };
-  },
-  function () {
-    ok(true, "Get stats for a network and dates adapted to samplerate");
-    // Prepare get params
-    req = netStats.getAvailableNetworks();
-    req.onsuccess = function () {
-      var network = req.result[0];
-      var diff = 2;
-      // Get samplerate in millis
-      var sampleRate = netStats.sampleRate;
-      // Get date with samplerate's precision
-      var offset = new Date().getTimezoneOffset() * 60 * 1000;
-      var endDate = new Date(Math.floor((new Date().getTime() - offset) / sampleRate)
-                             * sampleRate + offset);
-      var startDate = new Date(endDate.getTime() - (sampleRate * diff));
-      // Calculate the number of samples that should be returned based on the
-      // the samplerate and including final and initial samples.
-      var samples = (endDate.getTime() - startDate.getTime()) / sampleRate + 1;
-
-      // Launch request
-      req = netStats.getSamples(network, startDate, endDate);
-      req.onsuccess = function () {
-        ok(true, "Get system stats request ok");
-        ok(req.result.manifestURL == null, "manifestURL should be null");
-        ok(compareNetworks(req.result.network, network), "networks should be equals");
-        ok(req.result.start.getTime() == startDate.getTime(), "starts should be equals");
-        ok(req.result.end.getTime() == endDate.getTime(), "ends should be equals");
-        var data = req.result.data;
-        ok(Array.isArray(data) && data.length == samples,
-           "data is an array of length " + samples);
-        checkDataDates(data, startDate, endDate, sampleRate);
-        next();
-      };
-      req.onerror = function () {
-        ok(false, "Get stats failure!");
-      }
-    };
-    req.onerror = function () {
-      ok(false, "Error getting networks!");
-    };
-  },
-  function () {
-    ok(true, "Get system stats for a network and dates not adapted to samplerate");
-    // Prepare get params
-    req = netStats.getAvailableNetworks();
-    req.onsuccess = function () {
-      var network = req.result[0];
-      var diff = 2;
-      // Get samplerate in millis
-      var sampleRate = netStats.sampleRate;
-      var endDate = new Date();
-      var startDate = new Date(endDate.getTime() - (sampleRate * diff));
-      // Calculate the number of samples that should be returned based on the
-      // the samplerate, including final and initial samples and taking into
-      // account that these will be filtered according to precision.
-      var samples = (Math.floor(endDate.getTime() / (sampleRate)) * sampleRate -
-                     Math.floor(startDate.getTime() / (sampleRate)) * sampleRate) / sampleRate + 1;
-
-      // Launch request
-      req = netStats.getSamples(network, startDate, endDate);
-      req.onsuccess = function () {
-        ok(true, "Get stats request ok");
-        ok(req.result.manifestURL == null, "manifestURL should be null");
-        ok(compareNetworks(req.result.network, network), "networks should be equals");
-        ok(req.result.start.getTime() == startDate.getTime(), "starts should be equals");
-        ok(req.result.end.getTime() == endDate.getTime(), "ends should be equals");
-        var data = req.result.data;
-        ok(Array.isArray(data) && data.length == samples,
-           "data is an array of length " + samples);
-        checkDataDates(data, startDate, endDate, sampleRate);
-        next();
-      };
-      req.onerror = function () {
-        ok(false, "Get stats failure!");
-      }
-    };
-    req.onerror = function () {
-      ok(false, "Error getting networks!");
-    };
-  },
-  function () {
-    // Test clearStats
-    req = netStats.getAvailableNetworks();
-    req.onsuccess = function () {
-      var network = req.result[0];
-
-      req = netStats.clearStats(network);
-      req.onsuccess = function () {
-        ok(true, "clearStats deleted the database");
-        next();
-      };
-      req.onerror = function () {
-        ok(false, "clearStats deleted the database");
-      }
-    };
-    req.onerror = function () {
-      ok(false, "Error getting networks!");
-    };
-  },
-  function () {
-    // Test getAvailableServiceTypes
-    req = netStats.getAvailableServiceTypes();
-    req.onsuccess = function () {
-      ok(true, "getAvailableServiceTypes request ok");
-      ok(Array.isArray(req.result) && req.result.length == 0,
-         "getAvailableServiceTypes returns an empty array");
-      next();
-    };
-    req.onerror = function () {
-      ok(false, "getAvailableServiceTypes failure!");
-    }
-  },
-  function () {
-    ok(true, "all done!\n");
-    SimpleTest.finish();
-    return;
-  }
-];
-
-function next() {
-  index += 1;
-  if (index >= steps.length) {
-    ok(false, "Shouldn't get here!");
-    return;
-  }
-  try {
-    steps[index]();
-  } catch(ex) {
-    ok(false, "Caught exception", ex);
-  }
-}
-
-SimpleTest.waitForExplicitFinish();
-
-SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]},
-                          function() {
-  SpecialPowers.pushPermissions([{ 'type': 'networkstats-manage', 'allow': 1, 'context': window.document }],
-                                function() {
-    ok(SpecialPowers.hasPermission("networkstats-manage", document),
-       "Has permission 'networkstats-manage'.");
-
-    ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
-       "Preference 'dom.mozNetworkStats.enabled' is true.");
-
-    ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
-
-    ok(navigator.mozNetworkStats instanceof MozNetworkStatsManager,
-       "navigator.mozNetworkStats should be a MozNetworkStatsManager object");
-
-    test();
-  });
-});
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/network/tests/test_networkstats_disabled.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test to ensure NetworkStats is not accessible when it is disabled</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-"use strict";
-
-SimpleTest.waitForExplicitFinish();
-
-// Test to ensure NetworkStats is not accessible when it is disabled
-SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", false]]},
-                          function() {
-  ok(!SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
-     "Preference 'dom.mozNetworkStats.enabled' is false.");
-
-  ok(!('mozNetworkStats' in navigator),
-     "navigator.mozNetworkStats should not exist when pref not set");
-
-  SimpleTest.finish();
-});
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/network/tests/test_networkstats_enabled_no_perm.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test to ensure NetworkStats enabled and no networkstats-manage perm does not allow open</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-// Test to ensure NetworkStats is enabled but mozNetworkStats.getAvailableNetworks
-// does not work in content because mozNetworkStats is null when no permission.
-  SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [['dom.mozNetworkStats.enabled', true]]},
-                            function() {
-    SpecialPowers.pushPermissions([{ 'type': 'networkstats-manage', 'allow': 0, 'context': window.document }], runTest);
-  });
-
-  function runTest() {
-    ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
-      "Preference 'dom.mozNetworkStats.enabled' is true.");
-
-    ok(!SpecialPowers.hasPermission("networkstats-manage", document),
-      "Has no permission 'networkstats-manage'.");
-
-    ok(!('mozNetworkStats' in navigator),
-       "navigator.mozNetworkStats should not exist when permission not set");
-
-    SimpleTest.finish();
-  }
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/network/tests/test_networkstats_enabled_perm.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test to ensure NetworkStats is not accessible when it is disabled</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-"use strict";
-
-SimpleTest.waitForExplicitFinish();
-
-// Test to ensure NetworkStats is not accessible when it is disabled.
-SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]},
-                          function() {
-  SpecialPowers.pushPermissions([{ 'type': 'networkstats-manage', 'allow': 1, 'context': window.document }],
-                                function() {
-
-    ok(SpecialPowers.hasPermission("networkstats-manage", document),
-       "Has permission 'networkstats-manage'.");
-
-    ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
-       "Preference 'dom.mozNetworkStats.enabled' is true.");
-
-    ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
-
-    ok(navigator.mozNetworkStats instanceof MozNetworkStatsManager,
-       "navigator.mozNetworkStats should be a MozNetworkStatsManager object");
-
-    SimpleTest.finish();
-  });
-});
-
-</script>
-</pre>
-</body>
-</html>