blob: f73682ec6fa597894e588538df4daf2c67c82e34 [file] [log] [blame]
<!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>
<script>
const hostUnderTest = "127.0.0.1";
const statisticsUrl = "http://" + hostUnderTest + "/temp";
const topFrameOrigin1 = "http://127.0.0.2:8000/temp";
const topFrameOrigin2 = "http://127.0.0.3:8000/temp";
const topFrameOrigin3 = "http://127.0.0.4:8000/temp";
const topFrameOrigin4 = "http://127.0.0.5:8000/temp";
function completeTest() {
testRunner.clearStatisticsDataForDomain(hostUnderTest);
// 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 runTestRunnerTest() {
// Create entries in multiple database tables with the hostUnderTest.
testRunner.setStatisticsSubframeUnderTopFrameOrigin(statisticsUrl, topFrameOrigin1);
testRunner.setStatisticsSubresourceUnderTopFrameOrigin(topFrameOrigin2, statisticsUrl);
testRunner.setStatisticsSubresourceUnderTopFrameOrigin(statisticsUrl, topFrameOrigin3);
testRunner.setStatisticsSubresourceUniqueRedirectTo(statisticsUrl, topFrameOrigin4);
if (!testRunner.isStatisticsRegisteredAsSubFrameUnder(statisticsUrl, topFrameOrigin1)
|| !testRunner.isStatisticsRegisteredAsSubresourceUnder(topFrameOrigin2, statisticsUrl)
|| !testRunner.isStatisticsRegisteredAsSubresourceUnder(statisticsUrl, topFrameOrigin3)
|| !testRunner.isStatisticsRegisteredAsRedirectingTo(statisticsUrl, topFrameOrigin4))
testFailed("Failed to register subStatistics.");
completeTest();
}
if (window.testRunner && window.internals) {
testRunner.setUseITPDatabase(true);
testRunner.waitUntilDone();
setEnableFeature(true, runTestRunnerTest);
}
</script>
</body>
</html>