| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
| 5 <script src="../../../resources/mojo-helpers.js"></script> | 5 <script src="../../../resources/mojo-helpers.js"></script> |
| 6 <script src="resources/geolocation-mock.js"></script> | 6 <script src="resources/geolocation-mock.js"></script> |
| 7 </head> | 7 </head> |
| 8 <body> | 8 <body> |
| 9 <script src="script-tests/reentrant-permission-denied.js"></script> | 9 <script> |
| 10 description("Tests that reentrant calls to Geolocation methods from the error ca
llback due to a PERMISSION_DENIED error are OK."); |
| 11 |
| 12 var error; |
| 13 |
| 14 geolocationServiceMock.then(mock => { |
| 15 mock.setGeolocationPermission(false); |
| 16 mock.setGeolocationPosition(51.478, -0.166, 100.0); |
| 17 |
| 18 function checkPermissionError(e) { |
| 19 error = e; |
| 20 shouldBe('error.code', 'error.PERMISSION_DENIED'); |
| 21 shouldBe('error.message', '"User denied Geolocation"'); |
| 22 } |
| 23 |
| 24 var errorCallbackInvoked = false; |
| 25 navigator.geolocation.getCurrentPosition(function(p) { |
| 26 testFailed('Success callback invoked unexpectedly'); |
| 27 finishJSTest(); |
| 28 }, function(e) { |
| 29 if (errorCallbackInvoked) { |
| 30 testFailed('Error callback invoked unexpectedly'); |
| 31 finishJSTest(); |
| 32 } |
| 33 errorCallbackInvoked = true; |
| 34 checkPermissionError(e); |
| 35 continueTest(); |
| 36 }); |
| 37 |
| 38 function continueTest() { |
| 39 navigator.geolocation.getCurrentPosition(function(p) { |
| 40 testFailed('Success callback invoked unexpectedly'); |
| 41 finishJSTest(); |
| 42 }, function(e) { |
| 43 checkPermissionError(e); |
| 44 finishJSTest(); |
| 45 }); |
| 46 } |
| 47 }); |
| 48 |
| 49 window.jsTestIsAsync = true; |
| 50 </script> |
| 10 </body> | 51 </body> |
| 11 </html> | 52 </html> |
| OLD | NEW |