Index: LayoutTests/http/tests/permissions/resources/test-query.js |
diff --git a/LayoutTests/http/tests/permissions/resources/test-query.js b/LayoutTests/http/tests/permissions/resources/test-query.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..427ca8b2d5cb9144494593f174b29b5c60be3b03 |
--- /dev/null |
+++ b/LayoutTests/http/tests/permissions/resources/test-query.js |
@@ -0,0 +1,35 @@ |
+// Any copyright is dedicated to the Public Domain. |
+// http://creativecommons.org/publicdomain/zero/1.0/ |
+ |
+if (self.importScripts) { |
+ importScripts('helpers.js'); |
+ |
+ if (get_current_scope() == 'ServiceWorker') |
+ importScripts('../../serviceworker/resources/worker-testharness.js'); |
+ else |
+ importScripts('../../resources/testharness.js'); |
+} |
+ |
+async_test(function(test) { |
+ Permissions.query('geolocation').then(function() { |
+ assert_unreached('Permissions.query() should not succeed (for now).') |
+ }, function(e) { |
+ assert_true(e instanceof DOMException); |
+ assert_equals('NotSupportedError', e.name); |
+ }).then(function() { |
+ test.done(); |
+ }); |
+}, 'Check the Permissions.query() normal behavior in ' + get_current_scope() + ' scope.'); |
+ |
+async_test(function(test) { |
+ Permissions.query('unknown-keyword').then(function() { |
+ assert_unreached('Permissions.query() should not succeed (for now).') |
+ }, function(e) { |
+ assert_true(e instanceof TypeError); |
+ assert_equals('TypeError', e.name); |
+ }).then(function() { |
+ test.done(); |
+ }); |
+}, 'Check the Permissions.query() with wrong keyword in ' + get_current_scope() + ' scope.'); |
+ |
+done(); |