| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="/js-test-resources/js-test.js"></script> |
| <script src="/js-test-resources/ui-helper.js"></script> |
| <script> |
| description("Tests that a cross-origin iframe from a prevalent domain with recent user interaction does have storage access."); |
| jsTestIsAsync = 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); |
| } else |
| testFailed("Received a message from an unexpected origin: " + event.origin); |
| finishJSTest(); |
| } |
| |
| const hostUnderTest = "localhost:8000"; |
| const statisticsUrl = "http://" + hostUnderTest + "/temp"; |
| testRunner.setStatisticsPrevalentResource(statisticsUrl, true); |
| if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) |
| testFailed("Host did not get set as prevalent resource."); |
| testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true); |
| if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) |
| testFailed("Host did not get logged for user interaction."); |
| </script> |
| </head> |
| <body> |
| <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" id="theIframe" src="http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldGrantAccess"></iframe> |
| </body> |
| </html> |