blob: 7359a7e19800dad4f5b8d8b498510f95fe64f050 [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script src="/js-test-resources/ui-helper.js"></script>
<script src="resources/util.js"></script>
</head>
<body onload="setTimeout(runTest, 0)">
<div id="description">Tests triggering of private click measurement attributions with priority.</div>
<a id="targetLink" href="http://localhost:8000/privateClickMeasurement/attribution-conversion-through-image-redirect-with-priority.html?stepTwo" attributionsourceid=3 attributiondestination="http://localhost:8000">Link</a><br>
<div id="output"></div>
<script>
prepareTest();
function activateElement(elementID) {
var element = document.getElementById(elementID);
var centerX = element.offsetLeft + element.offsetWidth / 2;
var centerY = element.offsetTop + element.offsetHeight / 2;
UIHelper.activateAt(centerX, centerY).then(
function () {
},
function () {
document.getElementById("output").innerText = "FAIL Promise rejected.";
tearDownAndFinish();
}
);
}
function runTest() {
if (window.testRunner) {
if (window.location.search === "?stepTwo") {
let imageElement = document.createElement("img");
imageElement.src = "https://127.0.0.1:8443/privateClickMeasurement/resources/redirectToConversion.py?conversionData=12&priority=03";
imageElement.id = "pixel";
imageElement.onerror = function(e) {
testRunner.dumpPrivateClickMeasurement();
document.body.removeChild(document.getElementById("targetLink"));
document.body.removeChild(document.getElementById("pixel"));
tearDownAndFinish();
};
document.body.appendChild(imageElement);
} else {
activateElement("targetLink");
}
} else {
document.getElementById("output").innerText = "FAIL No testRunner.";
}
}
</script>
</body>
</html>