blob: 237caf1d5b43d9a1d3d55d98eba1c0430dda9ad9 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tests for Classification Based on Subresource Under Top Frame Origins</title>
<script src="/js-test-resources/js-test.js"></script>
</head>
<body>
<script>
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";
function completeTest() {
if (testRunner.isStatisticsPrevalentResource(statisticsUrl))
testFailed("Host classified as prevalent resource.");
else
testPassed("Host did not get classified as prevalent resource.");
testRunner.statisticsResetToConsistentState(function() {
testRunner.notifyDone();
});
}
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.setStatisticsSubresourceUnderTopFrameOrigin(statisticsUrl, topFrameOrigin1);
testRunner.setStatisticsSubresourceUnderTopFrameOrigin(statisticsUrl, topFrameOrigin2);
testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
testRunner.statisticsProcessStatisticsAndDataRecords();
});
}
if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
testRunner.waitUntilDone();
internals.setResourceLoadStatisticsEnabled(true);
runTestRunnerTest();
}
</script>
</body>
</html>