OLD | NEW |
1 description("Tests that no timers will trigger for navigator.geolocation object
after onunload."); | 1 description("Tests that no timers will trigger for navigator.geolocation object
after onunload."); |
2 | 2 |
3 if (!window.testRunner || !window.internals) | 3 if (!window.testRunner || !window.mojo) |
4 debug('This test can not run without testRunner or internals'); | 4 debug('This test can not run without testRunner or mojo'); |
5 | 5 |
6 internals.setGeolocationClientMock(document); | 6 geolocationServiceMock.then(mock => { |
7 internals.setGeolocationPermission(document, true); | 7 mock.setGeolocationPermission(true); |
8 | 8 |
9 document.body.onload = function() { | |
10 location = "data:text/html,You should have seen one unload alert appear.<scr
ipt>window.setTimeout('if (window.testRunner) testRunner.notifyDone();', 100);</
script>"; | 9 location = "data:text/html,You should have seen one unload alert appear.<scr
ipt>window.setTimeout('if (window.testRunner) testRunner.notifyDone();', 100);</
script>"; |
11 } | 10 }); |
12 | 11 |
13 document.body.onunload = function() { | 12 document.body.onunload = function() { |
14 navigator.geolocation.getCurrentPosition( | 13 navigator.geolocation.getCurrentPosition( |
15 function(p) {alert('FAIL: Unexpected Geolocation success callback.');}, | 14 function(p) {alert('FAIL: Unexpected Geolocation success callback.');}, |
16 function(e) {alert('FAIL: Unexpected Geolocation error callback.' + e.co
de + e.message);}, | 15 function(e) {alert('FAIL: Unexpected Geolocation error callback.' + e.co
de + e.message);}, |
17 {timeout: 0, maximumAge:0} | 16 {timeout: 0, maximumAge:0} |
18 ); | 17 ); |
19 alert("unload-called"); | 18 alert("unload-called"); |
20 } | 19 } |
21 | 20 |
22 window.jsTestIsAsync = true; | 21 window.jsTestIsAsync = true; |
OLD | NEW |