Index: LayoutTests/geofencing/geofencing-not-implemented.html |
diff --git a/LayoutTests/geofencing/geofencing-not-implemented.html b/LayoutTests/geofencing/geofencing-not-implemented.html |
index dc44262e096235ffde2c226e0528894523ecea02..bb4f421b914d7bee2f6616653282d2cf8c7931e9 100644 |
--- a/LayoutTests/geofencing/geofencing-not-implemented.html |
+++ b/LayoutTests/geofencing/geofencing-not-implemented.html |
@@ -7,16 +7,41 @@ |
<script> |
description("Tests that all geofencing methods always reject."); |
-function shouldReject(promise) |
-{ |
- promise.then( |
- function() { testFailed("Promise unexpectedly resolved."); }, |
- function() { testPassed("Promise rejected as expected."); }); |
-} |
+var jsTestIsAsync = true; |
+ |
+var tests = [ |
+ function() { |
+ return navigator.geofencing.registerRegion(new CircularGeofencingRegion({latitude: 37.421999, longitude: -122.084015})); |
+ }, |
+ function() { |
+ return navigator.geofencing.unregisterRegion(""); |
+ }, |
+ function() { |
+ return navigator.geofencing.getRegisteredRegions(); |
+ } |
+]; |
-shouldReject(navigator.geofencing.registerRegion(new CircularRegion({latitude: 37.421999, longitude: -122.084015}))); |
-shouldReject(navigator.geofencing.unregisterRegion("")); |
-shouldReject(navigator.geofencing.getRegisteredRegions()); |
+function nextTest() { |
Peter Beverloo
2014/09/11 16:32:21
The nextTest() function (lines 24-43) sounds reall
Marijn Kruisselbrink
2014/09/11 19:11:06
I'm now using testharness (and in fact the exact s
|
+ if (tests.length == 0) { |
+ finishJSTest(); |
+ return; |
+ } |
+ var test = tests.shift(); |
+ try { |
+ test() |
+ .then(function() { |
+ testFailed("Promise unexpectedly resolved."); |
+ nextTest(); |
+ }).catch(function(e) { |
+ testPassed("Promise rejected as expected."); |
+ nextTest(); |
+ }); |
+ } catch (e) { |
+ testFailed("Unexpected exception."); |
+ nextTest(); |
+ } |
+} |
+nextTest(); |
</script> |
</body> |
</html> |