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 = 550 * 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 let b2 = new Blob([new ArrayBuffer(500 * 1024 * 1024)], {type: 'application/oc
tet-string'}); |
| 17 blobs.push(b2); |
| 18 blobs.push(b2.slice(1, 10)); |
| 19 b2 = null; |
| 20 var blobsRead = 0; |
| 21 blobs.forEach(function(blob) { |
| 22 var reader = new FileReader(); |
| 23 reader.onloadend = function(event) { |
| 24 var error = event.target.error; |
| 25 if (error) { |
| 26 testFailed("File read error " + error); |
| 27 finishJSTest(); |
| 28 return; |
| 29 } |
| 30 blobsRead++; |
| 31 if (blobsRead == blobs.length) { |
| 32 finishJSTest(); |
| 33 } |
| 34 }; |
| 35 reader.readAsText(blob); |
| 36 }); |
| 37 } |
| 38 |
| 39 window.jsTestIsAsync = true; |
| 40 </script> |
| 41 </head> |
| 42 <body onload="runTests()"> |
| 43 <pre id='console'></pre> |
| 44 </body> |
| 45 </html> |
OLD | NEW |