blob: 8c0f10202d936edbeddd3ff4adff56015a8655b0 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="/js-test-resources/js-test.js"></script>
<script src="resources/util.js"></script>
<script>
description("Tests that we do not grant User Interaction credit for unhandled keypress.");
jsTestIsAsync = true;
const statisticsUrl = "http://127.0.0.1:8000/temp";
onload = function() {
const testFrame = document.getElementById("testFrame");
if (window.testRunner && window.internals) {
setEnableFeature(true, function() {
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
});
}
testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
testFailed("Host did not get set as prevalent resource.");
testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, false, function() {
if (testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
testFailed("Host did not get cleared of user interaction.");
testRunner.installStatisticsDidModifyDataRecordsCallback(function() {
if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
testPassed("Origin did not get user interaction credit.");
setTimeout(function() {
testFrame.src = "about:blank";
setTimeout(function() {
setEnableFeature(false, finishJSTest);
}, 0);
}, 0);
});
testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
testRunner.statisticsProcessStatisticsAndDataRecords();
debug("Simulate an unhandled user key press.");
if (window.eventSender)
eventSender.keyDown("a", ["metaKey"]);
});
});
}
</script>
<iframe id="testFrame" src="resources/onclick.html"></iframe>
</body>
</html>