| 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) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 navigator.permissions.query({name:'geolocation'}).then(function(result) { | 28 navigator.permissions.query({name:'geolocation'}).then(function(result) { |
| 29 assert_true(result instanceof PermissionStatus); | 29 assert_true(result instanceof PermissionStatus); |
| 30 assert_equals(result.state, 'denied'); | 30 assert_equals(result.state, 'denied'); |
| 31 test.done(); | 31 test.done(); |
| 32 }).catch(function() { | 32 }).catch(function() { |
| 33 assert_unreached('querying geolocation permission should not fail.') | 33 assert_unreached('querying geolocation permission should not fail.') |
| 34 }); | 34 }); |
| 35 }, 'Test geolocation permission in ' + get_current_scope() + ' scope.'); | 35 }, 'Test geolocation permission in ' + get_current_scope() + ' scope.'); |
| 36 | 36 |
| 37 async_test(function(test) { | 37 async_test(function(test) { |
| 38 navigator.permissions.query({name:'midi'}).then(function(result) { | 38 navigator.permissions.query({name: 'sensors'}) |
| 39 .then(function(result) { |
| 40 assert_true(result instanceof PermissionStatus); |
| 41 assert_equals(result.state, 'denied'); |
| 42 test.done(); |
| 43 }) |
| 44 .catch(function() { |
| 45 assert_unreached('querying sensors permission should not fail.') |
| 46 }); |
| 47 }, 'Test sensors permission in ' + get_current_scope() + ' scope.'); |
| 48 |
| 49 async_test(function(test) { |
| 50 navigator.permissions.query({name: 'midi'}) |
| 51 .then(function(result) { |
| 39 assert_true(result instanceof PermissionStatus); | 52 assert_true(result instanceof PermissionStatus); |
| 40 assert_equals(result.state, 'denied'); | 53 assert_equals(result.state, 'denied'); |
| 41 | 54 |
| 42 // Test for sysex=false. | 55 // Test for sysex=false. |
| 43 return navigator.permissions.query({name:'midi', sysex: false}); | 56 return navigator.permissions.query({name:'midi', sysex: false}); |
| 44 }).then(function(result) { | 57 }) |
| 58 .then(function(result) { |
| 45 assert_true(result instanceof PermissionStatus); | 59 assert_true(result instanceof PermissionStatus); |
| 46 assert_equals(result.state, 'denied'); | 60 assert_equals(result.state, 'denied'); |
| 47 | 61 |
| 48 // Test for sysex=true. | 62 // Test for sysex=true. |
| 49 return navigator.permissions.query({name:'midi', sysex: true}); | 63 return navigator.permissions.query({name:'midi', sysex: true}); |
| 50 }).then(function(result) { | 64 }) |
| 65 .then(function(result) { |
| 51 assert_true(result instanceof PermissionStatus); | 66 assert_true(result instanceof PermissionStatus); |
| 52 assert_equals(result.state, 'denied'); | 67 assert_equals(result.state, 'denied'); |
| 53 test.done(); | 68 test.done(); |
| 54 }).catch(function() { | 69 }) |
| 70 .catch(function() { |
| 55 assert_unreached('querying midi permission should not fail.') | 71 assert_unreached('querying midi permission should not fail.') |
| 56 }); | 72 }); |
| 57 }, 'Test midi permission in ' + get_current_scope() + ' scope.'); | 73 }, 'Test midi permission in ' + get_current_scope() + ' scope.'); |
| 58 | 74 |
| 59 async_test(function(test) { | 75 async_test(function(test) { |
| 60 navigator.permissions.query({name:'notifications'}).then(function(result) { | 76 navigator.permissions.query({name:'notifications'}).then(function(result) { |
| 61 assert_true(result instanceof PermissionStatus); | 77 assert_true(result instanceof PermissionStatus); |
| 62 assert_equals(result.state, 'denied'); | 78 assert_equals(result.state, 'denied'); |
| 63 test.done(); | 79 test.done(); |
| 64 }).catch(function() { | 80 }).catch(function() { |
| 65 assert_unreached('querying notifications permission should not fail.') | 81 assert_unreached('querying notifications permission should not fail.') |
| 66 }); | 82 }); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 84 }).then(function(result) { | 100 }).then(function(result) { |
| 85 assert_true(result instanceof PermissionStatus); | 101 assert_true(result instanceof PermissionStatus); |
| 86 assert_equals(result.state, 'denied'); | 102 assert_equals(result.state, 'denied'); |
| 87 test.done(); | 103 test.done(); |
| 88 }).catch(function() { | 104 }).catch(function() { |
| 89 assert_unreached('querying push permission should not fail.') | 105 assert_unreached('querying push permission should not fail.') |
| 90 }); | 106 }); |
| 91 }, 'Test push permission in ' + get_current_scope() + ' scope.'); | 107 }, 'Test push permission in ' + get_current_scope() + ' scope.'); |
| 92 | 108 |
| 93 done(); | 109 done(); |
| OLD | NEW |