Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Geolocation / script-tests / page-reload-cancel-permission-requests.js
blobf7e29edfbfcd072ea766fce88ed8641448fa55ea
1 description("Tests that when a page is reloaded, the frame is properly detached from the Geolocation object " +
2 "to ensure that no permission requests are in progress.");
4 window.jsTestIsAsync = true;
6 var numPendingRequests;
7 var isReload = false;
9 if ("#reload" == location.hash)
10 isReload = true;
12 if (!window.testRunner || !window.internals)
13 debug('This test can not run without testRunner or internals');
15 internals.setGeolocationClientMock(document);
16 numPendingRequests = internals.numberOfPendingGeolocationPermissionRequests(document);
17 shouldBe('numPendingRequests', '0');
19 if (isReload)
20 finishJSTest();
22 if (!isReload) {
23 // Kick off a position request and then reload the page, this should set up
24 // a permission request. Permission should be undecided at this point, so the
25 // permission request should still be outstanding by page reload.
27 function onIframeReady()
29 // Make request on remote frame's Geolocation object.
30 iframe.contentWindow.navigator.geolocation.getCurrentPosition(
31 function(p) {
32 testFailed('Permission should not be determined for this page: ' + p);
33 finishJSTest();
34 });
36 location.hash = '#reload';
37 location.reload();
40 debug("Create IFrame");
41 var iframe = document.createElement('iframe');
42 iframe.src = 'resources/page-reload-cancel-permission-requests-inner.html';
43 document.body.appendChild(iframe);