summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/imagebitmap_extensions_on_worker.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/canvas/test/imagebitmap_extensions_on_worker.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/canvas/test/imagebitmap_extensions_on_worker.js')
-rw-r--r--dom/canvas/test/imagebitmap_extensions_on_worker.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/dom/canvas/test/imagebitmap_extensions_on_worker.js b/dom/canvas/test/imagebitmap_extensions_on_worker.js
new file mode 100644
index 000000000..63116e80e
--- /dev/null
+++ b/dom/canvas/test/imagebitmap_extensions_on_worker.js
@@ -0,0 +1,47 @@
+importScripts("imagebitmap_extensions_data.js");
+importScripts("imagebitmap_extensions.js");
+
+var gGroundTruthImageData;
+var gImageData;
+var gImageBitmap;
+var gPNGBlob;
+var gJPEGBlob;
+
+onmessage = function(event) {
+ if (event.data.type == "setSources") {
+ gGroundTruthImageData = event.data.groundTruthImageData;
+ gImageData = event.data.imageData;
+ gImageBitmap = event.data.imageBitmap;
+ gPNGBlob = event.data.pngBlob;
+ gJPEGBlob = event.data.jpegBlob;
+
+ ok(!!gGroundTruthImageData, "Get gGroundTruthImageData!");
+ ok(!!gImageData, "Get gImageData!");
+ ok(!!gImageBitmap, "Get gImageBitmap!");
+ ok(!!gPNGBlob, "Get gPNGBlob!");
+ ok(!!gJPEGBlob, "Get gJPEGBlob!");
+
+ runTests();
+ }
+};
+
+function ok(expect, msg) {
+ postMessage({"type": "status", status: !!expect, msg: msg});
+}
+
+function runTests() {
+ testExceptions().
+ then(testColorConversions()).
+ then( function() { return Promise.all([testAccessing_randomTest("ImageData", gImageData, 0),
+ testAccessing_randomTest("ImageBitmap", gImageBitmap, 0),
+ testAccessing_randomTest("PNG", gPNGBlob, 0),
+ testAccessing_randomTest("JPEG", gJPEGBlob, 10) // JPEG loses information
+ ]); }).
+ then( function() { return Promise.all([testCreateFromArrayBffer_randomTest("ImageData", gImageData, 0),
+ testCreateFromArrayBffer_randomTest("ImageBitmap", gImageBitmap, 0),
+ testCreateFromArrayBffer_randomTest("PNG", gPNGBlob, 0),
+ testCreateFromArrayBffer_randomTest("JPEG", gJPEGBlob, 10) // JPEG loses information
+ ]); }).
+ then(function() { return testInvalidAccess([gImageData, gImageBitmap, gPNGBlob, gJPEGBlob]); } ).
+ then(function() {postMessage({"type": "finish"});}, function(ev) { failed(ev); postMessage({"type": "finish"}); });
+} \ No newline at end of file