Bug 958689 - Fix intermittent errors in networkstats tests. r=ettseng

This commit is contained in:
Albert Crespell 2015-05-16 09:47:54 +02:00
Родитель 35b97dec87
Коммит a35cd2c970
4 изменённых файлов: 30 добавлений и 26 удалений

Просмотреть файл

@ -14,13 +14,13 @@ skip-if = toolkit == "gonk"
[test_tcpsocket_enabled_with_perm.html] [test_tcpsocket_enabled_with_perm.html]
skip-if = toolkit == "gonk" || e10s skip-if = toolkit == "gonk" || e10s
[test_networkstats_alarms.html] [test_networkstats_alarms.html]
skip-if = true # Bug 958689 skip-if = toolkit != "gonk"
[test_networkstats_basics.html] [test_networkstats_basics.html]
skip-if = true # Bug 958689, bug 858005 skip-if = toolkit != "gonk"
[test_networkstats_disabled.html] [test_networkstats_disabled.html]
skip-if = toolkit != "gonk" skip-if = toolkit != "gonk"
[test_networkstats_enabled_no_perm.html] [test_networkstats_enabled_no_perm.html]
skip-if = true # Bug 958689 skip-if = toolkit != "gonk"
[test_networkstats_enabled_perm.html] [test_networkstats_enabled_perm.html]
skip-if = toolkit != "gonk" skip-if = toolkit != "gonk"
[test_udpsocket.html] [test_udpsocket.html]

Просмотреть файл

@ -149,7 +149,6 @@ var steps = [
}, },
function () { function () {
ok(true, "all done!\n"); ok(true, "all done!\n");
SpecialPowers.removePermission("networkstats-manage", document);
SimpleTest.finish(); SimpleTest.finish();
return; return;
} }
@ -170,21 +169,23 @@ function next() {
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
SpecialPowers.addPermission("networkstats-manage", true, document);
SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]}, SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]},
function() { function() {
ok(SpecialPowers.hasPermission("networkstats-manage", document), SpecialPowers.pushPermissions([{ 'type': 'networkstats-manage', 'allow': 1, 'context': window.document }],
"Has permission 'networkstats-manage'."); function() {
ok(SpecialPowers.hasPermission("networkstats-manage", document),
"Has permission 'networkstats-manage'.");
ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"), ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
"Preference 'dom.mozNetworkStats.enabled' is true."); "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, ok(navigator.mozNetworkStats instanceof SpecialPowers.Ci.nsIDOMMozNetworkStatsManager,
"navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object"); "navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object");
test(); test();
});
}); });
</script> </script>

Просмотреть файл

@ -301,7 +301,6 @@ var steps = [
}, },
function () { function () {
ok(true, "all done!\n"); ok(true, "all done!\n");
SpecialPowers.removePermission("networkstats-manage", document);
SimpleTest.finish(); SimpleTest.finish();
return; return;
} }
@ -322,21 +321,23 @@ function next() {
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
SpecialPowers.addPermission("networkstats-manage", true, document);
SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]}, SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]},
function() { function() {
ok(SpecialPowers.hasPermission("networkstats-manage", document), SpecialPowers.pushPermissions([{ 'type': 'networkstats-manage', 'allow': 1, 'context': window.document }],
"Has permission 'networkstats-manage'."); function() {
ok(SpecialPowers.hasPermission("networkstats-manage", document),
"Has permission 'networkstats-manage'.");
ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"), ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
"Preference 'dom.mozNetworkStats.enabled' is true."); "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, ok(navigator.mozNetworkStats instanceof SpecialPowers.Ci.nsIDOMMozNetworkStatsManager,
"navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object"); "navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object");
test(); test();
});
}); });
</script> </script>

Просмотреть файл

@ -15,10 +15,12 @@
// Test to ensure NetworkStats is enabled but mozNetworkStats.getAvailableNetworks // Test to ensure NetworkStats is enabled but mozNetworkStats.getAvailableNetworks
// does not work in content because mozNetworkStats is null when no permission. // does not work in content because mozNetworkStats is null when no permission.
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [['dom.mozNetworkStats.enabled', true]]}, runTest); SpecialPowers.pushPrefEnv({"set": [['dom.mozNetworkStats.enabled', true]]},
function runTest() { function() {
SpecialPowers.removePermission("networkstats-manage", document); SpecialPowers.pushPermissions([{ 'type': 'networkstats-manage', 'allow': 0, 'context': window.document }], runTest);
});
function runTest() {
ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"), ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
"Preference 'dom.mozNetworkStats.enabled' is true."); "Preference 'dom.mozNetworkStats.enabled' is true.");