Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Unified Diff: LayoutTests/http/tests/geofencing/resources/worker.js

Issue 401713005: Move all geofencing code into its own module separate from geolocation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698