| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="/js-test-resources/js-test.js"></script> |
| <script src="/js-test-resources/ui-helper.js"></script> |
| <script src="/resourceLoadStatistics/resources/util.js"></script> |
| <script> |
| description("Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if there is no way to request access (feature off)."); |
| jsTestIsAsync = true; |
| |
| if (window.testRunner) |
| testRunner.setPrivateBrowsingEnabled(true); |
| |
| window.addEventListener("message", receiveMessage, false); |
| |
| function receiveMessage(event) { |
| if (event.origin === "http://localhost:8000") { |
| if (event.data.indexOf("PASS") !== -1) |
| testPassed(event.data.replace("PASS ", "")); |
| else |
| testFailed(event.data.replace("FAIL ", "")); |
| } else |
| testFailed("Received a message from an unexpected origin: " + event.origin); |
| setEnableFeature(false, finishJSTest); |
| } |
| |
| const hostUnderTest = "localhost:8000"; |
| const statisticsUrl = "http://" + hostUnderTest + "/temp"; |
| function runTest() { |
| setEnableFeature(false, function() { |
| let iframeElement = document.createElement("iframe"); |
| iframeElement.id = "TheIframeThatRequestsStorageAccess"; |
| iframeElement.src = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldGrantAccess"; |
| document.body.appendChild(iframeElement); |
| }); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| </body> |
| </html> |