blob: f9f547478957980bff768daa1ae9ea09b39f01e6 [file] [log] [blame]
<script>
var bytesRead = 0;
function recursiveRead(reader) {
reader.read().then(function({ done, value }) {
for (var i = 0; i < value.length; i++) {
alert("RECEIVED BYTE '" + String.fromCharCode(value[i]) + "'");
bytesRead = bytesRead + 1;
}
if (bytesRead == 4) {
if (window.testRunner) {
testRunner.notifyDone();
}
} else {
recursiveRead(reader);
}
});
}
function runTest() {
let fileBits = [
'a',
new File([], 'x'),
'b',
new File([], 'x'),
'c',
new File([], 'x'),
'd'
];
let file = new File(fileBits, 'y');
recursiveRead(file.stream().getReader());
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
</script>
<body onload="runTest()">
</body>