| Index: third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html
|
| diff --git a/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html b/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html
|
| index 5c030ddc73514ee6bab37397381b446b7e3568ac..4edb7293b7103ff8b7e5dd2be3f0f0089e3e0b90 100644
|
| --- a/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html
|
| +++ b/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLCanvasElement.html
|
| @@ -4,6 +4,7 @@
|
| <script src="../resources/mojo-helpers.js"></script>
|
| <script src="resources/mock-barcodedetection.js"></script>
|
| <script src="resources/mock-facedetection.js"></script>
|
| +<script src="resources/mock-textdetection.js"></script>
|
| <script>
|
|
|
| var createTestForCanvasElement = function(createDetector,
|
| @@ -58,6 +59,12 @@ function BarcodeDetectorDetectionResultTest(detectionResult, mock) {
|
| assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2");
|
| }
|
|
|
| +function TextDetectorDetectionResultTest(detectionResult, mock) {
|
| + assert_equals(detectionResult.length, 2, "Number of textBlocks");
|
| + assert_equals(detectionResult[0].rawValue, "cats", "textBlock 1");
|
| + assert_equals(detectionResult[1].rawValue, "dogs", "textBlock 2");
|
| +}
|
| +
|
| // These tests verify that a Detector's detect() works on an HTMLCanvasElement
|
| // and on an OffscreenCanvas. Use the mock mojo server implemented in
|
| // mock-{barcode,face}detection.js.
|
| @@ -89,6 +96,20 @@ generate_tests(createTestForCanvasElement, [
|
| () => { return new OffscreenCanvas(300, 150); },
|
| () => { return mockBarcodeDetectionReady; },
|
| BarcodeDetectorDetectionResultTest
|
| + ],
|
| + [
|
| + "Text - HTMLCanvasElement",
|
| + () => { return new TextDetector(); },
|
| + () => { return document.createElement("canvas"); },
|
| + () => { return mockTextDetectionReady; },
|
| + TextDetectorDetectionResultTest
|
| + ],
|
| + [
|
| + "Text - OffscreenCanvas",
|
| + () => { return new TextDetector(); },
|
| + () => { return new OffscreenCanvas(300, 150); },
|
| + () => { return mockTextDetectionReady; },
|
| + TextDetectorDetectionResultTest
|
| ]
|
| ]);
|
|
|
|
|