OLD | NEW |
1 if (self.importScripts) { | 1 if (self.importScripts) { |
2 importScripts('helpers.js'); | 2 importScripts('helpers.js'); |
3 | 3 |
4 if (get_current_scope() == 'ServiceWorker') | 4 if (get_current_scope() == 'ServiceWorker') |
5 importScripts('../../serviceworker/resources/worker-testharness.js'); | 5 importScripts('../../serviceworker/resources/worker-testharness.js'); |
6 else | 6 else |
7 importScripts('../../resources/testharness.js'); | 7 importScripts('../../resources/testharness.js'); |
8 } | 8 } |
9 | 9 |
10 async_test(function(test) { | 10 async_test(function(test) { |
| 11 // Querying a random permission name should fail. |
| 12 navigator.permissions.query({name:'foobar'}).then(function(result) { |
| 13 assert_unreached('querying a random permission should fail'); |
| 14 }, function(error) { |
| 15 assert_equals(error.name, 'TypeError'); |
| 16 |
| 17 // Querying a permission without a name should fail. |
| 18 return navigator.permissions.query({}); |
| 19 }).then(function(result) { |
| 20 assert_unreached('querying a permission without a name should fail'); |
| 21 }, function(error) { |
| 22 assert_equals(error.name, 'TypeError'); |
| 23 test.done(); |
| 24 }); |
| 25 }, 'Test PermissionDescription WebIDL rules in ' + get_current_scope() + ' scope
.'); |
| 26 |
| 27 async_test(function(test) { |
11 navigator.permissions.query({name:'geolocation'}).then(function(result) { | 28 navigator.permissions.query({name:'geolocation'}).then(function(result) { |
12 // TODO(mlamouri): test values when some instrumentation are available. | 29 // TODO(mlamouri): test values when some instrumentation are available. |
13 assert_true(result instanceof PermissionStatus); | 30 assert_true(result instanceof PermissionStatus); |
14 test.done(); | 31 test.done(); |
15 }).catch(function() { | 32 }).catch(function() { |
16 assert_unreached('querying geolocation permission should not fail.') | 33 assert_unreached('querying geolocation permission should not fail.') |
17 }); | 34 }); |
18 }, 'Test geolocation permission in ' + get_current_scope() + ' scope.'); | 35 }, 'Test geolocation permission in ' + get_current_scope() + ' scope.'); |
19 | 36 |
20 async_test(function(test) { | 37 async_test(function(test) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 }).then(function(result) { | 86 }).then(function(result) { |
70 // TODO(mlamouri): test values when some instrumentation are available. | 87 // TODO(mlamouri): test values when some instrumentation are available. |
71 assert_true(result instanceof PermissionStatus); | 88 assert_true(result instanceof PermissionStatus); |
72 test.done(); | 89 test.done(); |
73 }).catch(function() { | 90 }).catch(function() { |
74 assert_unreached('querying push permission should not fail.') | 91 assert_unreached('querying push permission should not fail.') |
75 }); | 92 }); |
76 }, 'Test push permission in ' + get_current_scope() + ' scope.'); | 93 }, 'Test push permission in ' + get_current_scope() + ' scope.'); |
77 | 94 |
78 done(); | 95 done(); |
OLD | NEW |