Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2147)

Unified Diff: third_party/WebKit/LayoutTests/virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-worker.html

Issue 2420203002: Implement convertToBlob() in OffscreenCanvas (Closed)
Patch Set: rebase and fix global-interface-listing-service-worker-expected.txt Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-worker.html
diff --git a/third_party/WebKit/LayoutTests/virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-worker.html b/third_party/WebKit/LayoutTests/virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-worker.html
new file mode 100644
index 0000000000000000000000000000000000000000..a9be1b22ada0c5d6d183a15eba93cfa215b204ef
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/threaded/fast/idleToBlob/OffscreenCanvas-convertToBlob-webgl-worker.html
@@ -0,0 +1,42 @@
+<img id="png"/>
+<script id="myWorker" type="text/worker">
+self.onmessage = function (e) {
+ var offCanvas = new OffscreenCanvas(50, 50);
+ var gl = offCanvas.getContext('webgl');
+ gl.clearColor(0, 1, 0, 1);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+
+ // TODO: Add more image types to this test once the toImageData() for webgl
+ // is completed. See crbug.com/657531.
+ offCanvas.convertToBlob()
+ .then(function(blob) {
+ self.postMessage({version: "png", data:blob});
+ });
+}
+</script>
+<script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+}
+
+var pngImage = document.getElementById('png');
+function imageLoaded() {
+ if (window.testRunner) {
+ window.testRunner.notifyDone();
+ }
+}
+pngImage.addEventListener('load', imageLoaded);
+
+var workerBlob = new Blob([document.getElementById('myWorker').textContent]);
+var worker = new Worker(URL.createObjectURL(workerBlob));
+worker.addEventListener("message", function(msg) {
+ var blob = msg.data.data;
+ switch (msg.data.version) {
+ case 'png':
+ pngImage.src = URL.createObjectURL(blob);
+ break;
+ }
+});
+worker.postMessage("");
+</script>
+

Powered by Google App Engine
This is Rietveld 408576698