Index: LayoutTests/geofencing/geofencing-not-implemented.html |
diff --git a/LayoutTests/geofencing/geofencing-not-implemented.html b/LayoutTests/geofencing/geofencing-not-implemented.html |
index ddfb6f21c5c4d6449eb006d3ae315dc734e171af..4a4ab36d6330b1c8f1bbb0db98a4167b4b6c2ea3 100644 |
--- a/LayoutTests/geofencing/geofencing-not-implemented.html |
+++ b/LayoutTests/geofencing/geofencing-not-implemented.html |
@@ -1,22 +1,35 @@ |
<!DOCTYPE html> |
jsbell
2014/09/11 21:13:35
Nit: add a <title> describing the file
Marijn Kruisselbrink
2014/09/11 21:54:26
Done.
|
-<html> |
-<head> |
-<script src="../resources/js-test.js"></script> |
-</head> |
-<body> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
<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."); }); |
+// 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; |
+ })); |
} |
-shouldReject(navigator.geofencing.registerRegion(new CircularGeofencingRegion({latitude: 37.421999, longitude: -122.084015}))); |
-shouldReject(navigator.geofencing.unregisterRegion("")); |
-shouldReject(navigator.geofencing.getRegisteredRegions()); |
+promise_test(function(test) { |
jsbell
2014/09/11 21:13:35
Factor out a rejecting_promise_test() helper?
...
Marijn Kruisselbrink
2014/09/11 21:54:26
Yeah, something like assert_promise_throws would b
|
+ return navigator.geofencing.registerRegion(new CircularGeofencingRegion({latitude: 37.421999, longitude: -122.084015})) |
+ .then(test.unreached_func('Promise should not have resolved')) |
+ .catch(function() {}); |
+}, 'registerRegion should fail'); |
+ |
+promise_test(function(test) { |
+ return navigator.geofencing.unregisterRegion("") |
+ .then(test.unreached_func('Promise should not have resolved')) |
+ .catch(function() {}); |
+}, 'unregisterRegion should fail'); |
+ |
+promise_test(function(test) { |
+ return navigator.geofencing.getRegisteredRegions() |
+ .then(test.unreached_func('Promise should not have resolved')) |
+ .catch(function() {}); |
+}, 'getRegisteredRegions should fail'); |
+ |
</script> |
-</body> |
-</html> |