blob: 9f16717e817c343be9f34f1f62f08a4aca6f6e06 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="/js-test-resources/js-test.js"></script>
<script src="resources/util.js"></script>
</head>
<body>
<script>
description("Tests clearing of website data store (one hour).");
jsTestIsAsync = true;
const hostUnderTest = "127.0.0.1:8000";
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";
function completeTest() {
if (testRunner.isStatisticsPrevalentResource(statisticsUrl))
testFailed("Host is still a prevalent resource after the store was cleared.");
else
testPassed("Host is no longer a prevalent resource after the store was cleared.");
setEnableFeature(false, finishJSTest);
}
function testStep2() {
if (testRunner.isStatisticsPrevalentResource(statisticsUrl))
testPassed("Host classified as prevalent resource.");
else
testFailed("Host did not get classified as prevalent resource.");
testRunner.statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(1, completeTest);
}
function runTestRunnerTest() {
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.setStatisticsPrevalentResource(statisticsUrl, false, function() {});
if (testRunner.isStatisticsPrevalentResource(statisticsUrl))
testFailed("Host did not get set as non-prevalent resource.");
testRunner.setStatisticsSubframeUnderTopFrameOrigin(statisticsUrl, topFrameOrigin1);
testRunner.setStatisticsSubresourceUniqueRedirectTo(statisticsUrl, topFrameOrigin1);
testRunner.setStatisticsSubresourceUnderTopFrameOrigin(statisticsUrl, topFrameOrigin1);
testRunner.setStatisticsSubresourceUnderTopFrameOrigin(statisticsUrl, topFrameOrigin2);
testRunner.setStatisticsSubframeUnderTopFrameOrigin(statisticsUrl, topFrameOrigin2);
testRunner.setStatisticsSubresourceUniqueRedirectTo(statisticsUrl, topFrameOrigin3);
testRunner.setStatisticsSubresourceUnderTopFrameOrigin(statisticsUrl, topFrameOrigin3);
testRunner.installStatisticsDidScanDataRecordsCallback(testStep2);
testRunner.statisticsProcessStatisticsAndDataRecords();
}
if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
setEnableFeature(true, function () {
runTestRunnerTest();
});
}
</script>
</body>
</html>