https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 260166c7aa434d6367910af87f67fdaf51146068 authored by Lukasz Anforowicz on 02 April 2018, 20:04:17 UTC
Tests and docs for the current CORB vs <link rel="preload"> behavior.
Tip revision: 260166c
FileReaderSync.worker.js
importScripts("/resources/testharness.js");

var blob, readerSync;
setup(function() {
  readerSync = new FileReaderSync();
  blob = new Blob(["test"]);
});

test(function() {
  assert_true(readerSync instanceof FileReaderSync);
}, "Interface");

test(function() {
  var text = readerSync.readAsText(blob);
  assert_equals(text, "test");
}, "readAsText");

test(function() {
  var data = readerSync.readAsDataURL(blob);
  assert_equals(data.indexOf("data:"), 0);
}, "readAsDataURL");

test(function() {
  var data = readerSync.readAsArrayBuffer(blob);
  assert_true(data instanceof ArrayBuffer);
}, "readAsArrayBuffer");

done();
back to top