blob: 2d8fb0f7539fd42abea522dc53e5ae06e7cf2b13 [file] [log] [blame]
<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<head>
<meta name="viewport" content="width=device-width">
<script src="../../../resources/ui-helper.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setShouldLogDownloadCallbacks(true);
testRunner.waitUntilDownloadFinished();
}
</script>
</head>
<body>
<p>Test that user triggered synthetic clicks on an anchor with a download attribute are not ignored.</p>
<p> This test passes if you see a 'Download started' message above.</p>
<a style="display:none" id="blob-url" download>Blob URL</a>
<input type="button" id="testButton" value="Download">
<script>
function userClick(element)
{
if (!window.eventSender) {
alert('Click the button to run the test.');
return;
}
UIHelper.activateAt(element.offsetLeft + 5, element.offsetTop + 5);
}
function runTest()
{
var string = "test";
var blob = new Blob([string], {type: "text/html"});
var link = document.getElementById("blob-url");
link.href = window.URL.createObjectURL(blob);
var button = document.getElementById("testButton");
button.onclick = function() {
link.click();
}
userClick(button);
}
runTest();
</script>
</body>
</html>