Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/shapedetection/shapedetection-empty-input.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/shapedetection/shapedetection-empty-input.html b/third_party/WebKit/LayoutTests/fast/shapedetection/shapedetection-empty-input.html |
| index 7f62e5c8f7cf51e256a15f615b4bd83a383508f2..233dca453bb9335eb4fcee6946ccef0f805476ba 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/shapedetection/shapedetection-empty-input.html |
| +++ b/third_party/WebKit/LayoutTests/fast/shapedetection/shapedetection-empty-input.html |
| @@ -4,22 +4,27 @@ |
| <script> |
| // This test verifies FaceDetector.detect() with an empty HTMLImageElement. |
| -async_test(function(t) { |
| - var image = new Image(); |
| - var faceDetector = new FaceDetector(); |
| - var tryFaceDetection = function() { |
| - faceDetector.detect(image) |
| - .then(faceDetectionResult => { |
| - assert_equals(faceDetectionResult.length, 0); |
| - t.done(); |
| - }) |
| - .catch(error => { |
| - assert_unreached("detect() rejected with error: " + error) |
| - }); |
| - }; |
| - image.onload = tryFaceDetection; |
| - image.onerror = tryFaceDetection; |
| - image.src = ""; |
| -}, "FaceDetector should resolve empty images with empty results."); |
| +var makeAsyncTest = function(detectorName) { |
|
xianglu
2016/11/15 19:19:29
Consider changing this name to something more expl
mcasas
2016/11/15 20:22:55
Done renaming after offline discussion.
|
| + async_test(function(t) { |
| + var image = new Image(); |
| + var detector = eval("new " + detectorName + "();"); |
| + var tryDetection = function() { |
| + detector.detect(image) |
| + .then(detectionResult => { |
| + assert_equals(detectionResult.length, 0); |
| + t.done(); |
| + }) |
| + .catch(error => { |
| + assert_unreached("detect() rejected with error: " + error) |
| + }); |
| + }; |
| + image.onload = tryDetection; |
| + image.onerror = tryDetection; |
| + image.src = ""; |
| + }, "Detectors should resolve empty images with empty results."); |
| +}; |
| + |
| +generate_tests(makeAsyncTest, [["Face", "FaceDetector"], |
| + ["Barcode", "BarcodeDetector"]]); |
| </script> |