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

Side by Side Diff: third_party/WebKit/LayoutTests/shapedetection/detection-HTMLVideoElement.html

Issue 2857803002: Shape Detection: reconnect LayoutTests (Closed)
Patch Set: Removed expectation files and corrected shapedetection-empty-input test Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="../resources/mojo-helpers.js"></script> 4 <script src="../resources/mojo-helpers.js"></script>
5 <script src="resources/mock-barcodedetection.js"></script> 5 <script src="resources/mock-barcodedetection.js"></script>
6 <script src="resources/mock-facedetection.js"></script> 6 <script src="resources/mock-facedetection.js"></script>
7 <script src="resources/mock-textdetection.js"></script> 7 <script src="resources/mock-textdetection.js"></script>
8 <script> 8 <script>
9 9
10 var createTestForVideoElement = function(createDetector, mockReady, 10 var createTestForVideoElement = function(createDetector, mockReady,
(...skipping 21 matching lines...) Expand all
32 .then(detectionResult => { 32 .then(detectionResult => {
33 detectionResultTest(detectionResult, theMock); 33 detectionResultTest(detectionResult, theMock);
34 t.done(); 34 t.done();
35 }) 35 })
36 .catch(error => { 36 .catch(error => {
37 assert_unreached("Error during detect(video): " + error); 37 assert_unreached("Error during detect(video): " + error);
38 }); 38 });
39 }); 39 });
40 40
41 video.load(); 41 video.load();
42 }, "Detector detect(HTMLVideoElement)"); 42 });
43 }; 43 };
44 44
45 function FaceDetectorDetectionResultTest(detectionResult, mock) { 45 function FaceDetectorDetectionResultTest(detectionResult, mock) {
46 const imageReceivedByMock = mock.getFrameData(); 46 const imageReceivedByMock = mock.getFrameData();
47 assert_equals(imageReceivedByMock.byteLength, 307200, 47 assert_equals(imageReceivedByMock.byteLength, 307200,
48 "Image length"); 48 "Image length");
49 const WHITE_PIXEL = 0xFFFFFFFF; 49 const WHITE_PIXEL = 0xFFFFFFFF;
50 assert_equals(imageReceivedByMock[0], WHITE_PIXEL, "Pixel color"); 50 assert_equals(imageReceivedByMock[0], WHITE_PIXEL, "Pixel color");
51 assert_equals(detectionResult.length, 3, "Number of faces"); 51 assert_equals(detectionResult.length, 3, "Number of faces");
52 } 52 }
53 53
54 function BarcodeDetectorDetectionResultTest(detectionResult, mock) { 54 function BarcodeDetectorDetectionResultTest(detectionResult, mock) {
55 assert_equals(detectionResult.length, 2, "Number of barcodes"); 55 assert_equals(detectionResult.length, 2, "Number of barcodes");
56 assert_equals(detectionResult[0].rawValue, "cats", "barcode 1"); 56 assert_equals(detectionResult[0].rawValue, "cats", "barcode 1");
57 assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2"); 57 assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2");
58 } 58 }
59 59
60 function TextDetectorDetectionResultTest(detectionResult, mock) { 60 function TextDetectorDetectionResultTest(detectionResult, mock) {
61 assert_equals(detectionResult.length, 2, "Number of textBlocks"); 61 assert_equals(detectionResult.length, 2, "Number of textBlocks");
62 assert_equals(detectionResult[0].rawValue, "cats", "textBlock 1"); 62 assert_equals(detectionResult[0].rawValue, "cats", "textBlock 1");
63 assert_equals(detectionResult[1].rawValue, "dogs", "textBlock 2"); 63 assert_equals(detectionResult[1].rawValue, "dogs", "textBlock 2");
64 } 64 }
65 65
66 // These tests verify that a Detector's detect() works on an HTMLVideoElement. 66 // These tests verify that a Detector's detect() works on an HTMLVideoElement.
67 // Use the mock mojo server implemented in mock-{barcode,face}detection.js. 67 // Use the mock mojo server implemented in mock-{barcode,face}detection.js.
68 generate_tests(createTestForVideoElement, [ 68 generate_tests(createTestForVideoElement, [
69 [ 69 [
70 "Face", 70 "Face - detect(HTMLVideoElement)",
71 () => { return new FaceDetector(); }, 71 () => { return new FaceDetector(); },
72 () => { return mockFaceDetectionProviderReady; }, 72 () => { return mockFaceDetectionProviderReady; },
73 FaceDetectorDetectionResultTest 73 FaceDetectorDetectionResultTest
74 ], 74 ],
75 [ 75 [
76 "Barcode", 76 "Barcode - detect(HTMLVideoElement)",
77 () => { return new BarcodeDetector(); }, 77 () => { return new BarcodeDetector(); },
78 () => { return mockBarcodeDetectionReady; }, 78 () => { return mockBarcodeDetectionReady; },
79 BarcodeDetectorDetectionResultTest 79 BarcodeDetectorDetectionResultTest
80 ], 80 ],
81 [ 81 [
82 "Text", 82 "Text - detect(HTMLVideoElement)",
83 () => { return new TextDetector(); }, 83 () => { return new TextDetector(); },
84 () => { return mockTextDetectionReady; }, 84 () => { return mockTextDetectionReady; },
85 TextDetectorDetectionResultTest 85 TextDetectorDetectionResultTest
86 ] 86 ]
87 ]); 87 ]);
88 88
89 </script> 89 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698