From 24dab05837c0c5456e85efd778960d04c9118ad8 Mon Sep 17 00:00:00 2001 From: Sam Penrose Date: Thu, 28 Aug 2014 15:21:16 -0700 Subject: [PATCH] Bug 1058319 - Add a geolocation-noprompt permission part 2: tests r=fabrice --- dom/permission/tests/unit/test_bug808734.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dom/permission/tests/unit/test_bug808734.js b/dom/permission/tests/unit/test_bug808734.js index 4d8446ffc89c..231b2d9ed742 100644 --- a/dom/permission/tests/unit/test_bug808734.js +++ b/dom/permission/tests/unit/test_bug808734.js @@ -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); }