Bug 849642 - Intermittent test_networkstats_enabled_perm.html. r=ettseng, a=test-only
authorAlbert Crespell <alberto.crespellperez@telefonica.com>
Fri, 15 May 2015 20:05:02 +0200
changeset 274674 c9da8fe2636d567ae25ed76a5f91a55e42465b81
parent 274673 a67f40d67777ea4ded4821c3e9b87ab8e9b10725
child 274675 01b5519575a4d08b20277a6259a148ea7291fd45
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersettseng, test-only
bugs849642
milestone40.0a2
Bug 849642 - Intermittent test_networkstats_enabled_perm.html. r=ettseng, a=test-only
dom/network/tests/test_networkstats_enabled_perm.html
--- a/dom/network/tests/test_networkstats_enabled_perm.html
+++ b/dom/network/tests/test_networkstats_enabled_perm.html
@@ -11,31 +11,33 @@
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 
-// Test to ensure NetworkStats is not accessible when it is disabled
-SpecialPowers.addPermission("networkstats-manage", true, document);
+// Test to ensure NetworkStats is not accessible when it is disabled.
 SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]},
-                          function(){
-  ok(SpecialPowers.hasPermission("networkstats-manage", document),
-     "Has permission 'networkstats-manage'.");
+                          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(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
+       "Preference 'dom.mozNetworkStats.enabled' is true.");
 
-  ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
+    ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
 
-  ok(navigator.mozNetworkStats instanceof SpecialPowers.Ci.nsIDOMMozNetworkStatsManager,
-     "navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object");
+    ok(navigator.mozNetworkStats instanceof SpecialPowers.Ci.nsIDOMMozNetworkStatsManager,
+       "navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object");
 
-  SpecialPowers.removePermission("networkstats-manage", document);
-  SimpleTest.finish();
+    SimpleTest.finish();
+  });
 });
 
 </script>
 </pre>
 </body>
 </html>