| Index: LayoutTests/http/tests/geofencing/resources/worker.js
|
| diff --git a/LayoutTests/http/tests/geofencing/resources/worker.js b/LayoutTests/http/tests/geofencing/resources/worker.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7be2471d6b6cebf0e4036011c28220ffcbb6c246
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/geofencing/resources/worker.js
|
| @@ -0,0 +1,41 @@
|
| +self.onmessage = function(e) {
|
| + var message = e.data;
|
| + if ('port' in message) {
|
| + port = message.port;
|
| + nextTest(port);
|
| + }
|
| +};
|
| +
|
| +var tests = [
|
| + function() {
|
| + return navigator.geofencing.registerRegion(new CircularRegion({latitude: 37.421999, longitude: -122.084015}));
|
| + },
|
| + function() {
|
| + return navigator.geofencing.unregisterRegion("");
|
| + },
|
| + function() {
|
| + return navigator.geofencing.getRegisteredRegions();
|
| + }
|
| +];
|
| +
|
| +function nextTest(port) {
|
| + if (tests.length == 0) {
|
| + port.postMessage('quit');
|
| + self.close();
|
| + return;
|
| + }
|
| + var test = tests.shift();
|
| + try {
|
| + test()
|
| + .then(function() {
|
| + port.postMessage('Resolved');
|
| + nextTest(port);
|
| + }).catch(function(e) {
|
| + port.postMessage('Rejected: ' + e.message);
|
| + nextTest(port);
|
| + });
|
| + } catch (e) {
|
| + port.postMessage('Exception: ' + e);
|
| + nextTest(port);
|
| + }
|
| +}
|
|
|