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

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

Issue 2588293005: Shape Detection: Add Text Detection in Chrome Android (Closed)
Patch Set: jochen@ comments, rebase 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 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 <body> 8 <body>
8 <img id="img" src="../media/content/greenbox.png"/> 9 <img id="img" src="../media/content/greenbox.png"/>
9 </body> 10 </body>
10 <script> 11 <script>
11 12
12 var createTestForImageElement = function(createDetector, mockReady, 13 var createTestForImageElement = function(createDetector, mockReady,
13 detectionResultTest) { 14 detectionResultTest) {
14 async_test(function(t) { 15 async_test(function(t) {
15 var img = document.getElementById("img"); 16 var img = document.getElementById("img");
16 17
(...skipping 28 matching lines...) Expand all
45 assert_equals(imageReceivedByMock[0], GREEN_PIXEL, "Pixel color"); 46 assert_equals(imageReceivedByMock[0], GREEN_PIXEL, "Pixel color");
46 assert_equals(detectionResult.length, 3, "Number of faces"); 47 assert_equals(detectionResult.length, 3, "Number of faces");
47 } 48 }
48 49
49 function BarcodeDetectorDetectionResultTest(detectionResult, mock) { 50 function BarcodeDetectorDetectionResultTest(detectionResult, mock) {
50 assert_equals(detectionResult.length, 2, "Number of barcodes"); 51 assert_equals(detectionResult.length, 2, "Number of barcodes");
51 assert_equals(detectionResult[0].rawValue, "cats", "barcode 1"); 52 assert_equals(detectionResult[0].rawValue, "cats", "barcode 1");
52 assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2"); 53 assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2");
53 } 54 }
54 55
56 function TextDetectorDetectionResultTest(detectionResult, mock) {
57 assert_equals(detectionResult.length, 2, "Number of textBlocks");
58 assert_equals(detectionResult[0].rawValue, "cats", "textBlock 1");
59 assert_equals(detectionResult[1].rawValue, "dogs", "textBlock 2");
60 }
61
55 // These tests verify that a Detector's detect() works on an HTMLImageElement. 62 // These tests verify that a Detector's detect() works on an HTMLImageElement.
56 // Use the mock mojo server implemented in mock-{barcode,face}detection.js. 63 // Use the mock mojo server implemented in mock-{barcode,face}detection.js.
57 generate_tests(createTestForImageElement, [ 64 generate_tests(createTestForImageElement, [
58 [ 65 [
59 "Face", 66 "Face",
60 () => { return new FaceDetector(); }, 67 () => { return new FaceDetector(); },
61 () => { return mockFaceDetectionProviderReady; }, 68 () => { return mockFaceDetectionProviderReady; },
62 FaceDetectorDetectionResultTest 69 FaceDetectorDetectionResultTest
63 ], 70 ],
64 [ 71 [
65 "Barcode", 72 "Barcode",
66 () => { return new BarcodeDetector(); }, 73 () => { return new BarcodeDetector(); },
67 () => { return mockBarcodeDetectionReady; }, 74 () => { return mockBarcodeDetectionReady; },
68 BarcodeDetectorDetectionResultTest 75 BarcodeDetectorDetectionResultTest
76 ],
77 [
78 "Text",
79 () => { return new TextDetector(); },
80 () => { return mockTextDetectionReady; },
81 TextDetectorDetectionResultTest
69 ] 82 ]
70 ]); 83 ]);
71 84
72 </script> 85 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698