summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/files/file-reader-readystate.html
blob: 931af653cafed21cbb6e6de8d9e823353fac0102 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<title>FileReader readyState</title>
<link rel="help" href="http://www.w3.org/TR/FileAPI/#events">
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<script>

var reader = new FileReader();

setup({explicit_done: true});

test(function() {
  assert_equals(reader.readyState, reader.EMPTY, "The readyState");
}, "Check if the readyState is EMPTY initially");

on_event(reader, "loadstart", function() {
  test(function() {
    assert_equals(reader.readyState, reader.LOADING, "The readyState");
  }, "Check if the readyState is LOADING in loadstart");
});

on_event(reader, "progress", function() {
  test(function() {
    assert_equals(reader.readyState, reader.LOADING, "The readyState");
  }, "Check if the readyState is LOADING in progress");
});

on_event(reader, "load", function() {
  test(function() {
    assert_equals(reader.readyState, reader.DONE, "The readyState");
  }, "Check if the readyState is DONE in load");
});

on_event(reader, "loadend", function() {
  test(function() {
    assert_equals(reader.readyState, reader.DONE, "The readyState");
  }, "Check if the readyState is DONE in loadend");

  done();
});

reader.readAsText(new Blob(["foo"]));

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