blob: 443af871e09ee17c2cb2177db4ca9d96771d871e [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true internal:AdClickAttributionEnabled=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 that triggering of ad click attribution conversions through cross-site redirects do not work.</div>
<a id="targetLink" href="http://localhost:8000/adClickAttribution/attribution-conversion-through-cross-site-image-redirect.html?stepTwo" adcampaignid="3" addestination="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://localhost:8443/adClickAttribution/resources/redirectToConversionOnIPAddress.php?conversionData=12";
imageElement.id = "pixel";
imageElement.onerror = function(e) {
testRunner.dumpAdClickAttribution();
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>