4 <script src=
"../../resources/js-test.js"></script>
7 <pre id='console'
></pre>
9 description("Test FileReader methods and their argument type checking.");
11 if (window
.testRunner
)
12 testRunner
.dumpAsText();
14 var blob
= new Blob(["aa"]);
17 function testReadMethod(name
)
19 fileReader
= new FileReader();
20 shouldThrow("fileReader." + name
+ "();");
21 shouldThrow("fileReader." + name
+ "(2);");
22 shouldThrow("fileReader." + name
+ "(null)");
23 shouldThrow("fileReader." + name
+ "(fileReader)");
24 shouldThrow("fileReader." + name
+ "([])");
25 shouldNotThrow("fileReader." + name
+ "(blob, 'utf-8')");
26 shouldThrow("fileReader." + name
+ "(blob)");
29 var methods
= [ "readAsArrayBuffer", "readAsBinaryString", "readAsText", "readAsDataURL" ];
31 methods
.forEach(function (m
) { testReadMethod(m
); });