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

Side by Side Diff: LayoutTests/geofencing/geofencing-not-implemented.html

Issue 543203003: Fix the geofencing test to not break if the promises resolve asynchronously. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/geofencing/geofencing-not-implemented-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <title>Tests that all geofencing methods always reject.</title>
3 <head> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/js-test.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 </head>
6 <body>
7 <script> 5 <script>
8 description("Tests that all geofencing methods always reject."); 6 // Copied from http/tests/serviceworker/resources/worker-test-harness.js, can be
9 7 // removed once this makes it into testharness.js itself.
10 function shouldReject(promise) 8 function promise_test(func, name, properties) {
11 { 9 properties = properties || {};
12 promise.then( 10 var test = async_test(name, properties);
13 function() { testFailed("Promise unexpectedly resolved."); }, 11 Promise.resolve(test.step(func, test, test))
14 function() { testPassed("Promise rejected as expected."); }); 12 .then(function() { test.done(); })
13 .catch(test.step_func(function(value) {
14 throw value;
15 }));
15 } 16 }
16 17
17 shouldReject(navigator.geofencing.registerRegion(new CircularGeofencingRegion({l atitude: 37.421999, longitude: -122.084015}))); 18 promise_test(function(test) {
18 shouldReject(navigator.geofencing.unregisterRegion("")); 19 return navigator.geofencing.registerRegion(
19 shouldReject(navigator.geofencing.getRegisteredRegions()); 20 new CircularGeofencingRegion({latitude: 37.421999,
21 longitude: -122.084015}))
22 .then(test.unreached_func('Promise should not have resolved'))
23 .catch(function() { });
24 }, 'registerRegion should fail');
25
26 promise_test(function(test) {
27 return navigator.geofencing.unregisterRegion("")
28 .then(test.unreached_func('Promise should not have resolved'))
29 .catch(function() { });
30 }, 'unregisterRegion should fail');
31
32 promise_test(function(test) {
33 return navigator.geofencing.getRegisteredRegions()
34 .then(test.unreached_func('Promise should not have resolved'))
35 .catch(function() { });
36 }, 'getRegisteredRegions should fail');
37
20 </script> 38 </script>
21 </body>
22 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/geofencing/geofencing-not-implemented-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698