summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/virtual/threaded/fast/canvas-toBlob/canvas-toBlob-toDataURL-race-imageEncoder-png.html
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/WebKit/LayoutTests/virtual/threaded/fast/canvas-toBlob/canvas-toBlob-toDataURL-race-imageEncoder-png.html')
-rw-r--r--third_party/WebKit/LayoutTests/virtual/threaded/fast/canvas-toBlob/canvas-toBlob-toDataURL-race-imageEncoder-png.html21
1 files changed, 21 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/virtual/threaded/fast/canvas-toBlob/canvas-toBlob-toDataURL-race-imageEncoder-png.html b/third_party/WebKit/LayoutTests/virtual/threaded/fast/canvas-toBlob/canvas-toBlob-toDataURL-race-imageEncoder-png.html
new file mode 100644
index 0000000..8940ce5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/threaded/fast/canvas-toBlob/canvas-toBlob-toDataURL-race-imageEncoder-png.html
@@ -0,0 +1,21 @@
+<script src = "../../../../resources/js-test.js"></script>
+<script src = "../../../../fast/canvas/script-tests/canvas-toBlob-toDataURL-race.js"></script>
+<script type = 'text/javascript'>
+description("Verifies if synchronous PNG image encoding (toDataURL) conflicts with asynchronous image encoding (toBlob)");
+
+//Fire a bunch of toBlob operations of canvas to keep the async thread busy
+var j = 0; // due to async nature of toBlob we need a separate counter
+for (var i = 0; i < numToBlobCalls; i++)
+{
+ canvas.toBlob(function(blob) {
+ url = URL.createObjectURL(blob);
+ testImages[j++].src = url;
+ });
+}
+
+//Then file a bunch of toDataURL operation on main thread, so both threads now compete for image encoding
+for (var i = numToBlobCalls; i < (numToDataURLCalls + numToBlobCalls); i++)
+{
+ testImages[i].src = canvas.toDataURL();
+}
+</script>