summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/FileAPI/reading-data-section/filereader_readAsArrayBuffer.any.js
blob: d06e3170782b7ca70fc25b734a4c2080003a6720 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// META: title=FileAPI Test: filereader_readAsArrayBuffer

    async_test(function() {
      var blob = new Blob(["TEST"]);
      var reader = new FileReader();

      reader.onload = this.step_func(function(evt) {
        assert_equals(reader.result.byteLength, 4, "The byteLength is 4");
        assert_true(reader.result instanceof ArrayBuffer, "The result is instanceof ArrayBuffer");
        assert_equals(reader.readyState, reader.DONE);
        this.done();
      });

      reader.onloadstart = this.step_func(function(evt) {
        assert_equals(reader.readyState, reader.LOADING);
      });

      reader.onprogress = this.step_func(function(evt) {
        assert_equals(reader.readyState, reader.LOADING);
      });

      reader.readAsArrayBuffer(blob);
    });