Update web-platform-tests to revision d73b07b850fa51f23e846518bb6e8c59c58eef19

This commit is contained in:
WPT Sync Bot 2019-04-29 21:53:13 -04:00
parent 62031e3cb0
commit 7776ed79d7
107 changed files with 3306 additions and 538 deletions

View file

@ -0,0 +1,19 @@
promise_test(async t => {
var reader = new FileReader();
var eventWatcher = new EventWatcher(t, reader, ['loadstart', 'progress', 'abort', 'error', 'load', 'loadend']);
reader.readAsText(new Blob([]));
await eventWatcher.wait_for('loadstart');
// No progress event for an empty blob, as no data is loaded.
await eventWatcher.wait_for('load');
await eventWatcher.wait_for('loadend');
}, 'events are dispatched in the correct order for an empty blob');
promise_test(async t => {
var reader = new FileReader();
var eventWatcher = new EventWatcher(t, reader, ['loadstart', 'progress', 'abort', 'error', 'load', 'loadend']);
reader.readAsText(new Blob(['a']));
await eventWatcher.wait_for('loadstart');
await eventWatcher.wait_for('progress');
await eventWatcher.wait_for('load');
await eventWatcher.wait_for('loadend');
}, 'events are dispatched in the correct order for a non-empty blob');

View file

@ -12,9 +12,10 @@
<div id="log"></div>
<script>
var blob;
var blob, blob2;
setup(function() {
blob = new Blob(["This test the result attribute"]);
blob2 = new Blob(["This is a second blob"]);
});
async_test(function() {
@ -54,6 +55,43 @@
readArrayBuffer.readAsArrayBuffer(blob);
}, "readAsArrayBuffer");
async_test(function() {
var readBinaryString = new FileReader();
assert_equals(readBinaryString.result, null);
readBinaryString.onloadend = this.step_func(function(evt) {
assert_equals(typeof readBinaryString.result, "string", "The result type is string");
assert_equals(readBinaryString.result, "This test the result attribute", "The result is correct");
this.done();
});
readBinaryString.readAsBinaryString(blob);
}, "readAsBinaryString");
for (let event of ['loadstart', 'progress']) {
for (let method of ['readAsText', 'readAsDataURL', 'readAsArrayBuffer', 'readAsBinaryString']) {
promise_test(async function(t) {
var reader = new FileReader();
assert_equals(reader.result, null, 'result is null before read');
var eventWatcher = new EventWatcher(t, reader,
[event, 'loadend']);
reader[method](blob);
assert_equals(reader.result, null, 'result is null after first read call');
await eventWatcher.wait_for(event);
assert_equals(reader.result, null, 'result is null during event');
await eventWatcher.wait_for('loadend');
assert_not_equals(reader.result, null);
reader[method](blob);
assert_equals(reader.result, null, 'result is null after second read call');
await eventWatcher.wait_for(event);
assert_equals(reader.result, null, 'result is null during second read event');
}, 'result is null during "' + event + '" event for ' + method);
}
}
</script>
</body>
</html>