<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Tests that removal of website data deletes ITP data</title>
    <script src="/js-test-resources/js-test.js"></script>
    <script src="resources/util.js"></script>
</head>
<body onload="runTest()">
<script>
    const host = "localhost";
    const thirdPartyOrigin = "http://localhost:8000";
    const thirdPartyBaseUrl = thirdPartyOrigin + "/resourceLoadStatistics/resources";

    function finishTest() {
        testRunner.clearStatisticsDataForDomain(host);
        // Must use domainID to ensure this was properly
        // deleted, otherwise the lack of registrable domain --> domainID mapping
        // could create a false-positive test result even when the domainID persists.
        if (testRunner.doesStatisticsDomainIDExistInDatabase(1))
            testFailed("Domain ID was not deleted from the database.");
        else
            testPassed("Domain ID was successfully deleted from the database.")
        setEnableFeature(false, function() {
            testRunner.notifyDone();
        });
    }

    function runTest() {
        switch (document.location.hash) {
            case "":
                if (window.testRunner && window.internals) {
                    testRunner.waitUntilDone();
                    testRunner.setUseITPDatabase(true);
                    setEnableFeature(true, function() {
                        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
                        testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
                        document.location.hash = "step1";
                        runTest();
                    });
                }
                break;
            case "#step1":
                document.location.hash = "step2";
                let scriptElement = document.createElement("script");
                scriptElement.onload = runTest;
                scriptElement.src = thirdPartyBaseUrl + "/dummy.js?dummyParam=" + Math.random();
                document.body.appendChild(scriptElement);
                break;
            case "#step2":
                testRunner.statisticsNotifyObserver();
                break;
        }
    }
</script>
</body>
</html>
