| OLD | NEW |
| 1 <script src = "../../resources/js-test.js"></script> | 1 <script src="../../resources/testharness.js"></script> |
| 2 <script src = "../../fast/canvas/script-tests/canvas-toBlob-toDataURL-race.js"><
/script> | 2 <script src="../../resources/testharnessreport.js"></script> |
| 3 <script type = 'text/javascript'> | 3 <script src = "./script-tests/canvas-toBlob-toDataURL-race.js"></script> |
| 4 description("Verifies if synchronous PNG image encoding (toDataURL) conflicts wi
th asynchronous image encoding (toBlob)"); | |
| 5 | 4 |
| 6 //Fire a bunch of toBlob operations of canvas to keep the async thread busy | 5 <script> |
| 7 var j = 0; // due to async nature of toBlob we need a separate counter | 6 async_test(function(t) { |
| 8 for (var i = 0; i < numToBlobCalls; i++) | |
| 9 { | |
| 10 canvas.toBlob(function(blob) { | |
| 11 url = URL.createObjectURL(blob); | |
| 12 testImages[j++].src = url; | |
| 13 }); | |
| 14 } | |
| 15 | 7 |
| 16 //Then file a bunch of toDataURL operation on main thread, so both threads now c
ompete for image encoding | 8 createAllTestCases(t); |
| 17 for (var i = numToBlobCalls; i < (numToDataURLCalls + numToBlobCalls); i++) | 9 |
| 18 { | 10 //Fire a bunch of toBlob operations of canvas to keep the async thread busy |
| 19 testImages[i].src = canvas.toDataURL(); | 11 var j = 0; // due to async nature of toBlob we need a separate counter |
| 20 } | 12 for (var i = 0; i < numToBlobCalls; i++) |
| 13 { |
| 14 canvas.toBlob(function(blob) { |
| 15 url = URL.createObjectURL(blob); |
| 16 testImages[j++].src = url; |
| 17 }); |
| 18 } |
| 19 |
| 20 //Then file a bunch of toDataURL operation on main thread, so both threads n
ow compete for image encoding |
| 21 for (var i = numToBlobCalls; i < (numToDataURLCalls + numToBlobCalls); i++) |
| 22 { |
| 23 testImages[i].src = canvas.toDataURL(); |
| 24 } |
| 25 |
| 26 }, "Verifies if synchronous PNG image encoding (toDataURL) conflicts with asynch
ronous image encoding (toBlob)"); |
| 21 </script> | 27 </script> |
| OLD | NEW |