[email protected] | 344a13d | 2010-08-16 12:30:05 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 | <html> |
| 3 | <head> |
tkent | c5e88f0 | 2017-02-06 22:47:31 | [diff] [blame] | 4 | <script src="../resources/js-test.js"></script> |
Reilly Grant | be310ab | 2017-07-11 01:51:26 | [diff] [blame] | 5 | <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> |
| 6 | <script src="file:///gen/device/geolocation/public/interfaces/geolocation.mojom.js"></script> |
| 7 | <script src="file:///gen/third_party/WebKit/public/platform/modules/permissions/permission.mojom.js"></script> |
sammc | e668780 | 2016-05-13 04:06:57 | [diff] [blame] | 8 | <script src="resources/geolocation-mock.js"></script> |
[email protected] | 344a13d | 2010-08-16 12:30:05 | [diff] [blame] | 9 | </head> |
| 10 | <body> |
tkent | 98122ee | 2017-02-02 07:38:51 | [diff] [blame] | 11 | <script> |
| 12 | description("Tests that when a request is made on a Geolocation object and its Frame is disconnected before a callback is made, no callbacks are made."); |
| 13 | |
| 14 | var error; |
| 15 | var iframe = document.createElement('iframe'); |
| 16 | |
| 17 | function onIframeLoaded() { |
| 18 | iframeGeolocation = iframe.contentWindow.navigator.geolocation; |
| 19 | iframe.src = 'data:text/html,This frame should be visible when the test completes'; |
| 20 | } |
| 21 | |
| 22 | function onIframeUnloaded() { |
| 23 | iframeGeolocation.getCurrentPosition(function () { |
| 24 | testFailed('Success callback invoked unexpectedly'); |
| 25 | finishJSTest(); |
| 26 | }, function(e) { |
| 27 | testFailed('Error callback invoked unexpectedly'); |
| 28 | finishJSTest(); |
| 29 | }); |
| 30 | setTimeout(function() { |
| 31 | testPassed('No callbacks invoked'); |
| 32 | finishJSTest(); |
| 33 | }, 100); |
| 34 | } |
| 35 | |
tkent | 98122ee | 2017-02-02 07:38:51 | [diff] [blame] | 36 | |
Reilly Grant | be310ab | 2017-07-11 01:51:26 | [diff] [blame] | 37 | let mock = geolocationMock; |
| 38 | mock.setGeolocationPermission(true); |
| 39 | mock.setGeolocationPosition(51.478, -0.166, 100); |
| 40 | |
| 41 | iframe.src = 'resources/disconnected-frame-inner.html'; |
| 42 | document.body.appendChild(iframe); |
tkent | 98122ee | 2017-02-02 07:38:51 | [diff] [blame] | 43 | |
| 44 | window.jsTestIsAsync = true; |
| 45 | </script> |
[email protected] | 344a13d | 2010-08-16 12:30:05 | [diff] [blame] | 46 | </body> |
| 47 | </html> |