Chromium Code Reviews| 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..20f5d5e3299ca40552ec6539d0e960506c5a3cc2 |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/geofencing/apis_not_implemented.html |
| @@ -0,0 +1,55 @@ |
| +<!DOCTYPE html> |
| +<title>Basic test for some stuff</title> |
|
jsbell
2014/10/08 18:51:57
Real title
Marijn Kruisselbrink
2014/10/08 23:00:31
Done.
|
| +<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; |
| + })); |
| +} |
| + |
| +var sw_url = 'resources/emptyworker.js'; |
| +var sw_scope = window.location.origin + '/service-worker-scope' + |
|
jsbell
2014/10/08 18:51:57
Don't need window.location.origin here - the scope
Marijn Kruisselbrink
2014/10/08 23:00:32
Okay, I just copied this from some of the existing
|
| + window.location.pathname; |
| + |
| +promise_test(function(test) { |
| + return 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})) |
| + .then(test.unreached_func('Promise should not have resolved')) |
| + .catch(function() { }); |
|
jsbell
2014/10/08 18:51:56
Assert something about the rejection here, so you
Marijn Kruisselbrink
2014/10/08 23:00:32
I now did that by copying even more code from work
jsbell
2014/10/08 23:13:54
Yeah, sorry about that. We'd been hoping to upstre
|
| + }); |
| + }, 'registerRegion should fail'); |
| + |
| +promise_test(function(test) { |
| + return service_worker_unregister_and_register(test, sw_url, |
| + sw_scope + '/unregister') |
| + .then(function(r) { |
| + return r.geofencing.unregisterRegion("") |
|
jsbell
2014/10/08 18:51:57
Prefer single quotes: ''
Marijn Kruisselbrink
2014/10/08 23:00:32
Done.
|
| + .then(test.unreached_func('Promise should not have resolved')) |
| + .catch(function() { }); |
|
jsbell
2014/10/08 18:51:56
Assert something about the rejection here.
Marijn Kruisselbrink
2014/10/08 23:00:32
Done.
|
| + }); |
| + }, 'unregisterRegion should fail'); |
| + |
| +promise_test(function(test) { |
| + return service_worker_unregister_and_register(test, sw_url, |
| + sw_scope + '/getregions') |
| + .then(function(r) { |
| + return r.geofencing.getRegisteredRegions() |
| + .then(test.unreached_func('Promise should not have resolved')) |
| + .catch(function() { }); |
|
jsbell
2014/10/08 18:51:57
Assert something about the rejection here.
Marijn Kruisselbrink
2014/10/08 23:00:32
Done.
|
| + }); |
| + }, 'getRegisteredRegions should fail'); |
| + |
| +</script> |