| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Tests that all geofencing methods exposed on a service worker registratio
n always reject if no geofencing service is available.</title> | 2 <title>Tests that all geofencing methods exposed on a service worker registratio
n always reject if no geofencing service is available.</title> |
| 3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="../resources/testharness-helpers.js"></script> | |
| 6 <script src="../serviceworker/resources/test-helpers.js"></script> | 5 <script src="../serviceworker/resources/test-helpers.js"></script> |
| 7 <script> | 6 <script> |
| 8 var sw_url = 'resources/emptyworker.js'; | 7 var sw_url = 'resources/emptyworker.js'; |
| 9 var sw_scope = 'resources/service-worker-scope' + window.location.pathname; | 8 var sw_scope = 'resources/service-worker-scope' + window.location.pathname; |
| 10 | 9 |
| 11 testRunner.setGeofencingMockProvider(false); | 10 testRunner.setGeofencingMockProvider(false); |
| 12 | 11 |
| 13 promise_test(function(test) { | 12 promise_test(function(test) { |
| 14 return assert_promise_rejects( | 13 return promise_rejects( |
| 14 test, |
| 15 'AbortError', |
| 15 service_worker_unregister_and_register(test, sw_url, sw_scope + '/register
') | 16 service_worker_unregister_and_register(test, sw_url, sw_scope + '/register
') |
| 16 .then(function(r) { | 17 .then(function(r) { |
| 17 return r.geofencing.registerRegion( | 18 return r.geofencing.registerRegion( |
| 18 new CircularGeofencingRegion({latitude: 37.421999, | 19 new CircularGeofencingRegion({latitude: 37.421999, |
| 19 longitude: -122.084015})); | 20 longitude: -122.084015})); |
| 20 }), | 21 }), |
| 21 'AbortError', | |
| 22 'registerRegion should fail with an AbortError'); | 22 'registerRegion should fail with an AbortError'); |
| 23 }, 'registerRegion should fail'); | 23 }, 'registerRegion should fail'); |
| 24 | 24 |
| 25 promise_test(function(test) { | 25 promise_test(function(test) { |
| 26 return assert_promise_rejects( | 26 return promise_rejects( |
| 27 test, |
| 28 'AbortError', |
| 27 service_worker_unregister_and_register(test, sw_url, sw_scope + '/unregist
er') | 29 service_worker_unregister_and_register(test, sw_url, sw_scope + '/unregist
er') |
| 28 .then(function(r) { | 30 .then(function(r) { |
| 29 return r.geofencing.unregisterRegion(''); | 31 return r.geofencing.unregisterRegion(''); |
| 30 }), | 32 }), |
| 31 'AbortError', | |
| 32 'unregisterRegion should fail with an AbortError'); | 33 'unregisterRegion should fail with an AbortError'); |
| 33 }, 'unregisterRegion should fail'); | 34 }, 'unregisterRegion should fail'); |
| 34 | 35 |
| 35 promise_test(function(test) { | 36 promise_test(function(test) { |
| 36 return assert_promise_rejects( | 37 return promise_rejects( |
| 38 test, |
| 39 'AbortError', |
| 37 service_worker_unregister_and_register(test, sw_url, sw_scope + '/getregio
ns') | 40 service_worker_unregister_and_register(test, sw_url, sw_scope + '/getregio
ns') |
| 38 .then(function(r) { | 41 .then(function(r) { |
| 39 return r.geofencing.getRegisteredRegions(); | 42 return r.geofencing.getRegisteredRegions(); |
| 40 }), | 43 }), |
| 41 'AbortError', | |
| 42 'getRegisteredRegions should fail with an AbortError'); | 44 'getRegisteredRegions should fail with an AbortError'); |
| 43 }, 'getRegisteredRegions should fail'); | 45 }, 'getRegisteredRegions should fail'); |
| 44 | 46 |
| 45 </script> | 47 </script> |
| OLD | NEW |