blob: 99ae0efa07599be165d682f77bb3ae37c03f4fde [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../../resources/js-test.js"></script>
<script src="../../../../resources/ui-helper.js"></script>
</head>
<body>
<input type="file" onchange="changed(event)" multiple webkitdirectory></input>
<script>
description("Tests dragging a folder onto a file input with webkitdirectory set and querying input.webkitEntries.");
jsTestIsAsync = true;
function runTest()
{
inputElement = document.getElementsByTagName('input')[0];
shouldBeTrue("inputElement.webkitdirectory");
dragFilesOntoInput(inputElement, ['../../resources/test.txt', 'resources/testFiles']);
}
function moveMouseToCenterOfElement(element) {
var centerX = element.offsetLeft + element.offsetWidth / 2;
var centerY = element.offsetTop + element.offsetHeight / 2;
eventSender.mouseMoveTo(centerX, centerY);
}
function dragFilesOntoInput(input, files) {
eventSender.beginDragWithFiles(files);
moveMouseToCenterOfElement(input);
eventSender.mouseUp();
}
function changed(event)
{
files = event.target.files;
entries = event.target.webkitEntries;
// webkitEntries array is empty in Firefox and Chrome when webkitdirectory is set.
shouldBe("entries.length", "0");
shouldBe("files.length", "6");
finishJSTest();
}
runTest();
</script>
</body>
</html>