Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/shapedetection/detection-HTMLImageElement.html |
| diff --git a/third_party/WebKit/LayoutTests/shapedetection/detectshape-HTMLImageElement.html b/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLImageElement.html |
| similarity index 69% |
| rename from third_party/WebKit/LayoutTests/shapedetection/detectshape-HTMLImageElement.html |
| rename to third_party/WebKit/LayoutTests/shapedetection/detection-HTMLImageElement.html |
| index 53d32ac77762e737ad130c53625e01536ac8adac..c9932e800b73dc2e548904d0d2936dc6fdfbbb07 100644 |
| --- a/third_party/WebKit/LayoutTests/shapedetection/detectshape-HTMLImageElement.html |
| +++ b/third_party/WebKit/LayoutTests/shapedetection/detection-HTMLImageElement.html |
| @@ -2,25 +2,27 @@ |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="../resources/mojo-helpers.js"></script> |
| -<script src="resources/mock-shapedetection.js"></script> |
| +<script src="resources/mock-barcodedetection.js"></script> |
| +<script src="resources/mock-facedetection.js"></script> |
| <body> |
| <img id='img' src='../media/content/greenbox.png'/> |
| </body> |
| <script> |
| -var createTestForImageElement = function(detectorName, detectionResultTest) { |
| +var createTestForImageElement = function(detectorName, mockReady, |
| + detectionResultTest) { |
| async_test(function(t) { |
| var img = document.getElementById("img"); |
| var theMock = null; |
| - mockShapeDetectionReady |
| + mockReady() |
| .then(mock => { |
| theMock = mock; |
| var detector = eval("new " + detectorName + "();"); |
| return detector; |
| }) |
| .catch(error => { |
| - assert_unreached("Error creating MockShapeDetection: " + error); |
| + assert_unreached("Error creating MockFaceDetection: " + error); |
| }) |
| .then(detector => { |
| return detector.detect(img); |
| @@ -33,7 +35,7 @@ var createTestForImageElement = function(detectorName, detectionResultTest) { |
| assert_unreached("Error during detect(img): " + error); |
| }); |
| - }, "Detector detect(HTMLImageElement)"); |
| + }, 'Detector detect(HTMLImageElement)'); |
|
xianglu
2016/11/23 02:53:37
nit: Double quotes to be consistent. Quotes in oth
mcasas
2016/11/23 14:49:38
Done here and in the neighbouring htmls.
|
| }; |
| function FaceDetectorDetectionResultTest(detectionResult, mock) { |
| @@ -51,10 +53,20 @@ function BarcodeDetectorDetectionResultTest(detectionResult, mock) { |
| } |
| // These tests verify that a Detector's detect() works on an HTMLImageElement. |
| -// Use the mock mojo server implemented in mock-shapedetection.js. |
| +// Use the mock mojo server implemented in mock-{barcode,face}detection.js. |
| generate_tests(createTestForImageElement, [ |
| - [ "Face", "FaceDetector", FaceDetectorDetectionResultTest ], |
| - [ "Barcode", "BarcodeDetector", BarcodeDetectorDetectionResultTest ] |
| + [ |
| + "Face", |
| + "FaceDetector", |
| + () => { return mockFaceDetectionReady; }, |
|
xianglu
2016/11/23 02:53:37
Is it possible to put mockFaceDetectionReady here
mcasas
2016/11/23 14:49:38
Hmm, don't think so, it'd be evaluated directly
an
|
| + FaceDetectorDetectionResultTest |
| + ], |
| + [ |
| + "Barcode", |
| + "BarcodeDetector", |
| + () => { return mockBarcodeDetectionReady; }, |
| + BarcodeDetectorDetectionResultTest |
| + ] |
| ]); |
| </script> |