OLD | NEW |
1 if (self.importScripts) { | 1 if (self.importScripts) { |
2 importScripts('../../resources/helpers.js'); | 2 importScripts('../../resources/helpers.js'); |
3 importScripts('testrunner-helpers.js'); | 3 importScripts('testrunner-helpers.js'); |
4 | 4 |
5 if (get_current_scope() == 'ServiceWorker') | 5 if (get_current_scope() == 'ServiceWorker') |
6 importScripts('../../../serviceworker/resources/worker-testharness.js'); | 6 importScripts('../../../serviceworker/resources/worker-testharness.js'); |
7 else | 7 else |
8 importScripts('../../../resources/testharness.js'); | 8 importScripts('../../../resources/testharness.js'); |
9 } | 9 } |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 assert_true(result instanceof PermissionStatus); | 63 assert_true(result instanceof PermissionStatus); |
64 assert_equals(result.state, DEFAULT_PERMISSION_STATE); | 64 assert_equals(result.state, DEFAULT_PERMISSION_STATE); |
65 callback(); | 65 callback(); |
66 }).catch(function() { | 66 }).catch(function() { |
67 assert_unreached('revoking midi permission should not fail.') | 67 assert_unreached('revoking midi permission should not fail.') |
68 callback(); | 68 callback(); |
69 }); | 69 }); |
70 } | 70 } |
71 }, | 71 }, |
72 { | 72 { |
| 73 test: async_test('Test sensors permission in ' + get_current_scope() + ' sco
pe.'), |
| 74 fn: function(callback) { |
| 75 setPermission('sensors', 'granted', location.origin, location.origin).then
(function() { |
| 76 return navigator.permissions.revoke({name:'sensors'}); |
| 77 }).then(function(result) { |
| 78 assert_true(result instanceof PermissionStatus); |
| 79 assert_equals(result.state, DEFAULT_PERMISSION_STATE); |
| 80 callback(); |
| 81 }).catch(function() { |
| 82 assert_unreached('revoking sensors permission should not fail.'); |
| 83 callback(); |
| 84 }); |
| 85 } |
| 86 }, |
| 87 { |
73 test: async_test('Test push permission in ' + get_current_scope() + ' scope.
'), | 88 test: async_test('Test push permission in ' + get_current_scope() + ' scope.
'), |
74 fn: function(callback) { | 89 fn: function(callback) { |
75 setPermission('push-messaging', 'granted', location.origin, location.ori
gin).then(function() { | 90 setPermission('push-messaging', 'granted', location.origin, location.ori
gin).then(function() { |
76 return navigator.permissions.revoke({name:'push'}); | 91 return navigator.permissions.revoke({name:'push'}); |
77 }).catch(function(e) { | 92 }).catch(function(e) { |
78 // By default, the permission revocation is rejected if "userVisible
Only" option | 93 // By default, the permission revocation is rejected if "userVisible
Only" option |
79 // isn't set or set to true. | 94 // isn't set or set to true. |
80 assert_equals(e.name, "NotSupportedError"); | 95 assert_equals(e.name, "NotSupportedError"); |
81 | 96 |
82 // Test for userVisibleOnly=false. | 97 // Test for userVisibleOnly=false. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 tests[i].test.done(); | 135 tests[i].test.done(); |
121 if (i + 1 < tests.length) { | 136 if (i + 1 < tests.length) { |
122 runTest(i + 1); | 137 runTest(i + 1); |
123 } else { | 138 } else { |
124 done(); | 139 done(); |
125 } | 140 } |
126 }); | 141 }); |
127 }); | 142 }); |
128 } | 143 } |
129 runTest(0); | 144 runTest(0); |
OLD | NEW |