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

Unified Diff: third_party/WebKit/LayoutTests/shapedetection/resources/worker.js

Issue 2629523008: Shape Detection: Remove ConstructorCallWith=Document (Closed)
Patch Set: Add layout test for worker Created 3 years, 11 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/shapedetection/resources/worker.js
diff --git a/third_party/WebKit/LayoutTests/shapedetection/resources/worker.js b/third_party/WebKit/LayoutTests/shapedetection/resources/worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..c26b28bf1fec6dda8199e0e5ba970d9aba886f80
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/shapedetection/resources/worker.js
@@ -0,0 +1,21 @@
+importScripts("../../resources/testharness.js");
+
+onmessage = function(e) {
+ var detector;
+ switch (e.data.detectorType) {
+ case "Face": detector = new FaceDetector(); break;
+ case "Barcode": detector = new BarcodeDetector(); break;
+ case "Text": detector = new TextDetector(); break;
+ }
+
+ var imageBitmap = e.data.bitmap;
+ detector.detect(imageBitmap)
+ .then(detectionResult => {
+ assert_equals(detectionResult.length, e.data.expectedLength,
+ "Number of " + e.data.detectorType);
+ postMessage("PASS");
+ })
+ .catch(error => {
+ assert_unreached("Error during detect(img): " + error);
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698