summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/files/file-reader-methods-illegal-arguments.html
blob: 0ab900b1dc007f2e926bb4b7cb4f1a3b95228cea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!doctype html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<pre id='console'></pre>
<script>
description("Test FileReader methods and their argument type checking.");

if (window.testRunner)
    testRunner.dumpAsText();

var blob = new Blob(["aa"]);
var fileReader;
var method;
function testReadMethod(name)
{
    fileReader = new FileReader();
    shouldThrow("fileReader." + name + "();");
    shouldThrow("fileReader." + name + "(2);");
    shouldThrow("fileReader." + name + "(null)");
    shouldThrow("fileReader." + name + "(fileReader)");
    shouldThrow("fileReader." + name + "([])");
    shouldNotThrow("fileReader." + name + "(blob, 'utf-8')");
    shouldThrow("fileReader." + name + "(blob)");
}

var methods = [ "readAsArrayBuffer", "readAsBinaryString", "readAsText", "readAsDataURL" ];

methods.forEach(function (m) { testReadMethod(m); });

</script>
</body>
</html>