<!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 a iframe gets reported as a loaded third party domain.");
        jsTestIsAsync = true;

        function askForLoadedSubresourceDomains() {
            testRunner.loadedSubresourceDomains(function (arrayOfDomains) {
                if (arrayOfDomains.length == 0) {
                    askForLoadedSubresourceDomains();
                    return;
                }
                if (arrayOfDomains.includes("localhost"))
                    testPassed("Loaded domain was successfully captured.");
                else
                    testFailed("Loaded domain was not successfully captured.");
                setEnableFeature(false, finishJSTest);
            });
        }
    </script>
</head>
<body>
<iframe onload="setTimeout('askForLoadedSubresourceDomains()', 0)" src="http://localhost:8000/resourceLoadStatistics/resources/basic-iframe.html">
</iframe>
</body>
</html>
