OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <script src="../../resources/js-test.js"></script> |
| 3 <script> |
| 4 description("Test the Blob.close() method, basic functionality."); |
| 5 |
| 6 function runTests() { |
| 7 var blobs = new Array(); |
| 8 var totalMemory = 500 * 1024 * 1024; |
| 9 var totalBlobs = 1001; |
| 10 var size = totalMemory / totalBlobs; |
| 11 var memory = new ArrayBuffer(size); |
| 12 for (let i = 0; i < totalBlobs; i++) { |
| 13 let blob = new Blob([memory], {type: 'application/octet-string'}); |
| 14 blobs.push(blob); |
| 15 } |
| 16 blobs.push(new Blob([new ArrayBuffer(totalMemory)], {type: 'application/octet-
string'})); |
| 17 |
| 18 var blobsRead = 0; |
| 19 blobs.forEach(function(blob) { |
| 20 var reader = new FileReader(); |
| 21 reader.onloadend = function(event) { |
| 22 var error = event.target.error; |
| 23 if (error) { |
| 24 testFailed("File read error " + error); |
| 25 finishJSTest(); |
| 26 return; |
| 27 } |
| 28 blobsRead++; |
| 29 if (blobsRead == blobs.length) { |
| 30 finishJSTest(); |
| 31 } |
| 32 }; |
| 33 reader.readAsText(blob); |
| 34 }); |
| 35 } |
| 36 |
| 37 window.jsTestIsAsync = true; |
| 38 </script> |
| 39 </head> |
| 40 <body onload="runTests()"> |
| 41 <pre id='console'></pre> |
| 42 </body> |
| 43 </html> |
OLD | NEW |