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

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

Issue 2553343003: ShapeDetection: add support for all CanvasImageSource input types (Closed)
Patch Set: reillyg@s comments Created 4 years 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> 7 <script>
8 8
9 var createTestForVideoElement = function(detectorName, mockReady, 9 var createTestForVideoElement = function(createDetector, mockReady,
10 detectionResultTest) { 10 detectionResultTest) {
11 async_test(function(t) { 11 async_test(function(t) {
12 var video = document.createElement('video'); 12 var video = document.createElement("video");
13 video.src = "../imported/wpt/media/white.webm"; 13 video.src = "../imported/wpt/media/white.webm";
14 video.loop = true; 14 video.loop = true;
15 video.autoplay = true; 15 video.autoplay = true;
16 video.onerror = this.unreached_func("<video> error"); 16 video.onerror = this.unreached_func("<video> error");
17 video.onplay = this.step_func(function() { 17 video.onplay = this.step_func(function() {
18 var theMock = null; 18 var theMock = null;
19 mockReady() 19 mockReady()
20 .then(mock => { 20 .then(mock => {
21 theMock = mock; 21 theMock = mock;
22 var detector = eval("new " + detectorName + "();"); 22 var detector = createDetector();
23 return detector; 23 return detector;
24 }) 24 })
25 .catch(error => { 25 .catch(error => {
26 assert_unreached("Error creating MockFaceDetection: " + error); 26 assert_unreached("Error creating Mock Detector: " + error);
27 }) 27 })
28 .then(detector => { 28 .then(detector => {
29 return detector.detect(video); 29 return detector.detect(video);
30 }) 30 })
31 .then(detectionResult => { 31 .then(detectionResult => {
32 detectionResultTest(detectionResult, theMock); 32 detectionResultTest(detectionResult, theMock);
33 t.done(); 33 t.done();
34 }) 34 })
35 .catch(error => { 35 .catch(error => {
36 assert_unreached("Error during detect(video): " + error); 36 assert_unreached("Error during detect(video): " + error);
(...skipping 17 matching lines...) Expand all
54 assert_equals(detectionResult.length, 2, "Number of barcodes"); 54 assert_equals(detectionResult.length, 2, "Number of barcodes");
55 assert_equals(detectionResult[0].rawValue, "cats", "barcode 1"); 55 assert_equals(detectionResult[0].rawValue, "cats", "barcode 1");
56 assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2"); 56 assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2");
57 } 57 }
58 58
59 // These tests verify that a Detector's detect() works on an HTMLVideoElement. 59 // 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. 60 // Use the mock mojo server implemented in mock-{barcode,face}detection.js.
61 generate_tests(createTestForVideoElement, [ 61 generate_tests(createTestForVideoElement, [
62 [ 62 [
63 "Face", 63 "Face",
64 "FaceDetector", 64 () => { return new FaceDetector(); },
65 () => { return mockFaceDetectionReady; }, 65 () => { return mockFaceDetectionReady; },
66 FaceDetectorDetectionResultTest 66 FaceDetectorDetectionResultTest
67 ], 67 ],
68 [ 68 [
69 "Barcode", 69 "Barcode",
70 "BarcodeDetector", 70 () => { return new BarcodeDetector(); },
71 () => { return mockBarcodeDetectionReady; }, 71 () => { return mockBarcodeDetectionReady; },
72 BarcodeDetectorDetectionResultTest 72 BarcodeDetectorDetectionResultTest
73 ] 73 ]
74 ]); 74 ]);
75 75
76 </script> 76 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698