OLD | NEW |
1 description("Tests that when a request is made on a Geolocation object after its
frame has been disconnected, no callbacks are made and no crash occurs."); | 1 description("Tests that when a request is made on a Geolocation object after its
frame has been disconnected, no callbacks are made and no crash occurs."); |
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 var iframe = document.createElement('iframe'); |
7 internals.setGeolocationPermission(document, true); | 7 |
8 internals.setGeolocationPosition(document, 51.478, -0.166, 100); | 8 geolocationServiceMock.then(mock => { |
| 9 mock.setGeolocationPermission(true); |
| 10 mock.setGeolocationPosition(51.478, -0.166, 100); |
| 11 |
| 12 iframe.src = 'resources/disconnected-frame-already-inner1.html'; |
| 13 document.body.appendChild(iframe); |
| 14 }); |
9 | 15 |
10 function onFirstIframeLoaded() { | 16 function onFirstIframeLoaded() { |
11 iframeGeolocation = iframe.contentWindow.navigator.geolocation; | 17 iframeGeolocation = iframe.contentWindow.navigator.geolocation; |
12 iframe.src = 'resources/disconnected-frame-already-inner2.html'; | 18 iframe.src = 'resources/disconnected-frame-already-inner2.html'; |
13 } | 19 } |
14 | 20 |
15 var error; | |
16 function onSecondIframeLoaded() { | 21 function onSecondIframeLoaded() { |
17 iframeGeolocation.getCurrentPosition(function () { | 22 iframeGeolocation.getCurrentPosition(function () { |
18 testFailed('Success callback invoked unexpectedly'); | 23 testFailed('Success callback invoked unexpectedly'); |
19 finishJSTest(); | 24 finishJSTest(); |
20 }, function(e) { | 25 }, function(e) { |
21 testFailed('Error callback invoked unexpectedly'); | 26 testFailed('Error callback invoked unexpectedly'); |
22 finishJSTest(); | 27 finishJSTest(); |
23 }); | 28 }); |
24 setTimeout(finishTest, 1000); | 29 setTimeout(finishTest, 1000); |
25 } | 30 } |
26 | 31 |
27 function finishTest() { | 32 function finishTest() { |
28 debug('Method called on Geolocation object with disconnected Frame.'); | 33 debug('Method called on Geolocation object with disconnected Frame.'); |
29 finishJSTest(); | 34 finishJSTest(); |
30 } | 35 } |
31 | 36 |
32 var iframe = document.createElement('iframe'); | |
33 iframe.src = 'resources/disconnected-frame-already-inner1.html'; | |
34 document.body.appendChild(iframe); | |
35 | |
36 window.jsTestIsAsync = true; | 37 window.jsTestIsAsync = true; |
OLD | NEW |