blob: 4270adbcb68ec588489272ef217f3f82429ab76a [file] [log] [blame]
<!DOCTYPE html>
<html>
<script src="../../resources/ui-helper.js"></script>
<body>
<input type="file" name="file" id="file" onchange="onInputFileChange()">
<img id='imgToReplace' src=''>
<pre id='console'></pre>
<script>
function log(message)
{
document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
}
function onInputFileChange()
{
var file = document.getElementById("file").files[0];
var img = document.getElementById('imgToReplace');
log("Old image: " + img.width + " x " + img.height);
img.onload = onImgLoad;
img.src = window.URL.createObjectURL(file);
}
function onImgLoad()
{
var img = document.getElementById('imgToReplace');
log("New image: " + img.width + " x " + img.height);
log("DONE");
if (testRunner.notifyDone)
testRunner.notifyDone();
}
function runTests()
{
testRunner.setOpenPanelFiles(['resources/abe.png']);
var element = document.getElementById('file');
var x = element.offsetLeft + element.offsetWidth / 2;
var y = element.offsetTop + element.offsetHeight / 2;
UIHelper.activateAt(x, y);
}
if (window.eventSender) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
window.onload = runTests;
}
</script>
</body>
</html>