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

Side by Side Diff: third_party/WebKit/LayoutTests/shapedetection/detection-HTMLVideoElement.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 <script> 8 <script>
8 9
9 var createTestForVideoElement = function(createDetector, mockReady, 10 var createTestForVideoElement = function(createDetector, mockReady,
10 detectionResultTest) { 11 detectionResultTest) {
11 async_test(function(t) { 12 async_test(function(t) {
12 var video = document.createElement("video"); 13 var video = document.createElement("video");
13 video.src = "../imported/wpt/media/white.webm"; 14 video.src = "../imported/wpt/media/white.webm";
14 video.loop = true; 15 video.loop = true;
15 video.autoplay = true; 16 video.autoplay = true;
16 video.onerror = this.unreached_func("<video> error"); 17 video.onerror = this.unreached_func("<video> error");
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 assert_equals(imageReceivedByMock[0], WHITE_PIXEL, "Pixel color"); 50 assert_equals(imageReceivedByMock[0], WHITE_PIXEL, "Pixel color");
50 assert_equals(detectionResult.length, 3, "Number of faces"); 51 assert_equals(detectionResult.length, 3, "Number of faces");
51 } 52 }
52 53
53 function BarcodeDetectorDetectionResultTest(detectionResult, mock) { 54 function BarcodeDetectorDetectionResultTest(detectionResult, mock) {
54 assert_equals(detectionResult.length, 2, "Number of barcodes"); 55 assert_equals(detectionResult.length, 2, "Number of barcodes");
55 assert_equals(detectionResult[0].rawValue, "cats", "barcode 1"); 56 assert_equals(detectionResult[0].rawValue, "cats", "barcode 1");
56 assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2"); 57 assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2");
57 } 58 }
58 59
60 function TextDetectorDetectionResultTest(detectionResult, mock) {
61 assert_equals(detectionResult.length, 2, "Number of textBlocks");
62 assert_equals(detectionResult[0].rawValue, "cats", "textBlock 1");
63 assert_equals(detectionResult[1].rawValue, "dogs", "textBlock 2");
64 }
65
59 // 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.
60 // 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.
61 generate_tests(createTestForVideoElement, [ 68 generate_tests(createTestForVideoElement, [
62 [ 69 [
63 "Face", 70 "Face",
64 () => { return new FaceDetector(); }, 71 () => { return new FaceDetector(); },
65 () => { return mockFaceDetectionProviderReady; }, 72 () => { return mockFaceDetectionProviderReady; },
66 FaceDetectorDetectionResultTest 73 FaceDetectorDetectionResultTest
67 ], 74 ],
68 [ 75 [
69 "Barcode", 76 "Barcode",
70 () => { return new BarcodeDetector(); }, 77 () => { return new BarcodeDetector(); },
71 () => { return mockBarcodeDetectionReady; }, 78 () => { return mockBarcodeDetectionReady; },
72 BarcodeDetectorDetectionResultTest 79 BarcodeDetectorDetectionResultTest
80 ],
81 [
82 "Text",
83 () => { return new TextDetector(); },
84 () => { return mockTextDetectionReady; },
85 TextDetectorDetectionResultTest
73 ] 86 ]
74 ]); 87 ]);
75 88
76 </script> 89 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698