Index: LayoutTests/http/tests/geofencing/apis_not_implemented.html |
diff --git a/LayoutTests/http/tests/geofencing/apis_not_implemented.html b/LayoutTests/http/tests/geofencing/apis_not_implemented.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..767a75e74da1c1e7ceb9ea31e8c4c3e4833fe876 |
--- /dev/null |
+++ b/LayoutTests/http/tests/geofencing/apis_not_implemented.html |
@@ -0,0 +1,65 @@ |
+<!DOCTYPE html> |
+<title>Tests that all geofencing methods exposed on a service worker registration always reject.</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="../serviceworker/resources/test-helpers.js"></script> |
+<script> |
+// Copied from http/tests/serviceworker/resources/worker-test-harness.js, can be |
+// removed once this makes it into testharness.js itself. |
+function promise_test(func, name, properties) { |
+ properties = properties || {}; |
+ var test = async_test(name, properties); |
+ Promise.resolve(test.step(func, test, test)) |
+ .then(function() { test.done(); }) |
+ .catch(test.step_func(function(value) { |
+ throw value; |
+ })); |
+} |
+function assert_promise_rejects(promise, code, description) { |
+ return promise.then( |
+ function() { |
+ throw 'assert_promise_rejects: ' + description + ' Promise did not throw.'; |
+ }, |
+ function(e) { |
+ if (code !== undefined) { |
+ assert_throws(code, function() { throw e; }, description); |
+ } |
+ }); |
+} |
+ |
+var sw_url = 'resources/emptyworker.js'; |
+var sw_scope = '/service-worker-scope' + window.location.pathname; |
+ |
+promise_test(function(test) { |
+ return assert_promise_rejects( |
+ service_worker_unregister_and_register(test, sw_url, sw_scope + '/register') |
+ .then(function(r) { |
+ return r.geofencing.registerRegion( |
+ new CircularGeofencingRegion({latitude: 37.421999, |
+ longitude: -122.084015})); |
+ }), |
+ 'AbortError', |
+ 'registerRegion should fail with an AbortError'); |
+ }, 'registerRegion should fail'); |
+ |
+promise_test(function(test) { |
+ return assert_promise_rejects( |
+ service_worker_unregister_and_register(test, sw_url, sw_scope + '/unregister') |
+ .then(function(r) { |
+ return r.geofencing.unregisterRegion(''); |
+ }), |
+ 'AbortError', |
+ 'unregisterRegion should fail with an AbortError'); |
+ }, 'unregisterRegion should fail'); |
+ |
+promise_test(function(test) { |
+ return assert_promise_rejects( |
+ service_worker_unregister_and_register(test, sw_url, sw_scope + '/getregions') |
+ .then(function(r) { |
+ return r.geofencing.getRegisteredRegions(); |
+ }), |
+ 'AbortError', |
+ 'getRegisteredRegions should fail with an AbortError'); |
+ }, 'getRegisteredRegions should fail'); |
+ |
+</script> |