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

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

Issue 2818563006: ShapeDetection: Holding all of mock service to prevent GC (Closed)
Patch Set: ShapeDetection: Holding the MockFaceDetection to prevent Binding Object to be GCd 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 createTestForCanvasElement = function(createDetector, 10 var createTestForCanvasElement = function(createDetector,
(...skipping 28 matching lines...) Expand all
39 .catch(error => { 39 .catch(error => {
40 assert_unreached("Error during detect(canvas): " + error); 40 assert_unreached("Error during detect(canvas): " + error);
41 }); 41 });
42 } 42 }
43 43
44 img.src = "../media/content/greenbox.png"; 44 img.src = "../media/content/greenbox.png";
45 }); 45 });
46 }; 46 };
47 47
48 function FaceDetectorDetectionResultTest(detectionResult, mock) { 48 function FaceDetectorDetectionResultTest(detectionResult, mock) {
49 const imageReceivedByMock = mock.getFrameData(); 49 const imageReceivedByMock = mock.getFrameData(0);
50 assert_equals(imageReceivedByMock.byteLength, 180000,"Image length"); 50 assert_equals(imageReceivedByMock.byteLength, 180000,"Image length");
51 const GREEN_PIXEL = 0xFF00FF00; 51 const GREEN_PIXEL = 0xFF00FF00;
52 assert_equals(imageReceivedByMock[0], GREEN_PIXEL, "Pixel color"); 52 assert_equals(imageReceivedByMock[0], GREEN_PIXEL, "Pixel color");
53 assert_equals(detectionResult.length, 3, "Number of faces"); 53 assert_equals(detectionResult.length, 3, "Number of faces");
54 } 54 }
55 55
56 function BarcodeDetectorDetectionResultTest(detectionResult, mock) { 56 function BarcodeDetectorDetectionResultTest(detectionResult, mock) {
57 assert_equals(detectionResult.length, 2, "Number of barcodes"); 57 assert_equals(detectionResult.length, 2, "Number of barcodes");
58 assert_equals(detectionResult[0].rawValue, "cats", "barcode 1"); 58 assert_equals(detectionResult[0].rawValue, "cats", "barcode 1");
59 assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2"); 59 assert_equals(detectionResult[1].rawValue, "dogs", "barcode 2");
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 [ 107 [
108 "Text - detect(OffscreenCanvas)", 108 "Text - detect(OffscreenCanvas)",
109 () => { return new TextDetector(); }, 109 () => { return new TextDetector(); },
110 () => { return new OffscreenCanvas(300, 150); }, 110 () => { return new OffscreenCanvas(300, 150); },
111 () => { return mockTextDetectionReady; }, 111 () => { return mockTextDetectionReady; },
112 TextDetectorDetectionResultTest 112 TextDetectorDetectionResultTest
113 ] 113 ]
114 ]); 114 ]);
115 115
116 </script> 116 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698