4 <script src="/js-test-resources/js-test.js"></script>
5 <script src="/js-test-resources/ui-helper.js"></script>
7 description("Tests that a cross-origin iframe from a prevalent domain with recent user interaction does have storage access.");
10 window.addEventListener("message", receiveMessage, false);
12 function receiveMessage(event) {
13 if (event.origin === "http://localhost:8000") {
14 if (event.data.indexOf("PASS") !== -1)
15 testPassed(event.data.replace("PASS ", ""));
17 testFailed(event.data);
19 testFailed("Received a message from an unexpected origin: " + event.origin);
23 const hostUnderTest = "localhost:8000";
24 const statisticsUrl = "http://" + hostUnderTest + "/temp";
25 testRunner.setStatisticsPrevalentResource(statisticsUrl, true);
26 if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
27 testFailed("Host did not get set as prevalent resource.");
28 testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true);
29 if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
30 testFailed("Host did not get logged for user interaction.");
34 <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>