Bug 1058319 - Add a geolocation-noprompt permission part 2: tests r=fabrice

This commit is contained in:
Sam Penrose 2014-08-28 15:21:16 -07:00
Родитель 4df0ccbe35
Коммит 24dab05837
1 изменённых файлов: 16 добавлений и 0 удалений

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

@ -50,6 +50,21 @@ function do_check_set_eq(a1, a2) {
}
}
function test_substitute_does_not_break_substituted(scope) {
const Ci = Components.interfaces;
// geolocation-noprompt substitutes for geolocation ...
do_check_eq(scope.PermissionsTable["geolocation-noprompt"].substitute[0],
"geolocation");
// ... and sets silent allow ...
do_check_eq(scope.PermissionsTable["geolocation-noprompt"].certified,
Ci.nsIPermissionManager.ALLOW_ACTION)
// ... which works ...
do_check_false(scope.isExplicitInPermissionsTable("geolocation-noprompt", Ci.nsIPrincipal.APP_STATUS_CERTIFIED));
// ... but does not interfere with geolocation's PROMPT value
do_check_true(scope.isExplicitInPermissionsTable("geolocation", Ci.nsIPrincipal.APP_STATUS_CERTIFIED));
}
function run_test() {
var scope = {};
Cu.import("resource://gre/modules/PermissionsTable.jsm", scope);
@ -59,4 +74,5 @@ function run_test() {
gData[i].access);
do_check_set_eq(perms, gData[i].expected);
}
test_substitute_does_not_break_substituted(scope);
}