blob: d69ba36114335e2a98e649c6a26e602fb226c676 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="resources/util.js"></script>
</head>
<body onload="setTimeout('runTest()', 0)">
<div id="output"></div>
<script>
if (window.testRunner) {
testRunner.setUseITPDatabase(true);
testRunner.waitUntilDone();
testRunner.dumpAsText();
}
function navigateCrossOrigin() {
document.location.href = destinationOrigin + "/resourceLoadStatistics/remove-website-data-for-origin-deletes-link-decoration-database.html?link=decoration";
}
const host = "localhost";
const destinationOrigin = "http://localhost:8000";
const prevalentResourceOrigin = "http://127.0.0.1:8000";
const testOrigin = "http://127.0.0.2:8000";
function runTest() {
if (document.location.origin === prevalentResourceOrigin) {
setEnableFeature(true, function () {
testRunner.setStatisticsPrevalentResource(prevalentResourceOrigin, true, function() {
if (!testRunner.isStatisticsPrevalentResource(prevalentResourceOrigin))
testFailed("Host did not get set as prevalent resource.");
testRunner.setStatisticsCrossSiteLoadWithLinkDecoration(testOrigin, destinationOrigin);
testRunner.statisticsUpdateCookieBlocking(navigateCrossOrigin);
});
});
} else {
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(2))
testFailed("Domain ID was not deleted from the database.");
else
testPassed("Domain ID was successfully deleted from the database.")
setEnableFeature(false, function () {
testRunner.notifyDone();
});
}
}
</script>
</body>
</html>