blob: 05f4f11e636daa2a0ef509f4cbc1cb0fcebb0445 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="/js-test-resources/js-test.js"></script>
<script src="resources/util.js"></script>
</head>
<body>
<script>
description("Tests for classification based on top frame redirect to other prevalent.");
jsTestIsAsync = true;
const hostUnderTest = "127.0.0.1:8000";
const statisticsUrl = "http://" + hostUnderTest + "/temp";
const topFrameOrigin1 = "http://127.0.0.2:8000/temp";
function completeTest() {
if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
testFailed("Host did not get classified as prevalent resource.");
else if (testRunner.isStatisticsVeryPrevalentResource(statisticsUrl))
testFailed("Host got classified as very prevalent resource.");
else
testPassed("Host classified as prevalent resource.");
setEnableFeature(false, finishJSTest);
}
function runTest() {
testRunner.setStatisticsPrevalentResource(topFrameOrigin1, true, function() {
testRunner.setStatisticsTopFrameUniqueRedirectTo(statisticsUrl, topFrameOrigin1);
testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
testRunner.statisticsProcessStatisticsAndDataRecords();
});
}
if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
setEnableFeature(true, function() {
testRunner.setStatisticsPrevalentResource(statisticsUrl, false, function() {
if (testRunner.isStatisticsPrevalentResource(statisticsUrl))
testFailed("Host did not get set as non-prevalent resource.");
runTest();
});
});
}
</script>
</body>
</html>