<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../editing.js"></script>
</head>
<body>
<div id="dropzone" style="width: 200px; height: 200px; background-color: grey;"></div>
<script>
description("Error case coverage for fileSystemDirectoryReader.readEntries()");
jsTestIsAsync = true;

var dropzone = document.getElementById('dropzone');
dropzone.ondrop = function(e) {
    e.preventDefault();
    dataTransfer = e.dataTransfer;

    shouldBe("dataTransfer.items.length", "1");

    dirEntry = dataTransfer.items[0].webkitGetAsEntry();
    let reader = dirEntry.createReader();
    reader.readEntries(function() {});
    reader.readEntries(function(entries) {
        testFailed("Calling readEntries on a reader with the reading flag set did not throw an exception");
        finishJSTest();
    }, function(e) {
        ex = e;
        shouldBeEqualToString("ex.name", "InvalidStateError");
        finishJSTest()
    });
};

dropzone.ondragover = function(ev) {
    ev.preventDefault();
}

onload = function() {
    dragFilesOntoElement(dropzone, ['../../../fast/forms/file/entries-api/resources/testFiles']);
}
</script>
</body>
</html>
