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

Side by Side Diff: third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js

Issue 2859413002: Shape Detection: add idl and mojom for face landmarks and wire for Mac (Closed)
Patch Set: service-worker's global-interface-listing-expected.txt updated 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 "use strict"; 1 "use strict";
2 2
3 let mockFaceDetectionProviderReady = define( 3 let mockFaceDetectionProviderReady = define(
4 'mockFaceDetectionProvider', 4 'mockFaceDetectionProvider',
5 ['services/shape_detection/public/interfaces/facedetection.mojom', 5 ['services/shape_detection/public/interfaces/facedetection.mojom',
6 'services/shape_detection/public/interfaces/facedetection_provider.mojom', 6 'services/shape_detection/public/interfaces/facedetection_provider.mojom',
7 'mojo/public/js/bindings', 7 'mojo/public/js/bindings',
8 'mojo/public/js/core', 8 'mojo/public/js/core',
9 'content/public/renderer/interfaces', 9 'content/public/renderer/interfaces',
10 ], (faceDetection, faceDetectionProvider, bindings, mojo, interfaces) => { 10 ], (faceDetection, faceDetectionProvider, bindings, mojo, interfaces) => {
(...skipping 30 matching lines...) Expand all
41 this.maxDetectedFaces_ = options.max_detected_faces; 41 this.maxDetectedFaces_ = options.max_detected_faces;
42 this.fastMode_ = options.fast_mode; 42 this.fastMode_ = options.fast_mode;
43 this.binding_ = new bindings.Binding(faceDetection.FaceDetection, this, 43 this.binding_ = new bindings.Binding(faceDetection.FaceDetection, this,
44 request); 44 request);
45 } 45 }
46 46
47 detect(frame_data, width, height) { 47 detect(frame_data, width, height) {
48 let receivedStruct = mojo.mapBuffer(frame_data, 0, width*height*4, 0); 48 let receivedStruct = mojo.mapBuffer(frame_data, 0, width*height*4, 0);
49 this.buffer_data_ = new Uint32Array(receivedStruct.buffer); 49 this.buffer_data_ = new Uint32Array(receivedStruct.buffer);
50 return Promise.resolve({ 50 return Promise.resolve({
51 result: { 51 results: [
52 bounding_boxes: [ 52 {
53 { x : 1.0, y: 1.0, width: 100.0, height: 100.0 }, 53 bounding_box: {x: 1.0, y: 1.0, width: 100.0, height: 100.0},
54 { x : 2.0, y: 2.0, width: 200.0, height: 200.0 }, 54 landmarks: [{
55 { x : 3.0, y: 3.0, width: 300.0, height: 300.0 }, 55 type: faceDetection.LandmarkType.EYE,
56 ] 56 location: {x: 4.0, y: 5.0}
57 } 57 }]
58 },
59 {
60 bounding_box: {x: 2.0, y: 2.0, width: 200.0, height: 200.0},
61 landmarks: []
62 },
63 {
64 bounding_box: {x: 3.0, y: 3.0, width: 300.0, height: 300.0},
65 landmarks: []
66 },
67 ]
58 }); 68 });
59 mojo.unmapBuffer(receivedStruct.buffer); 69 mojo.unmapBuffer(receivedStruct.buffer);
60 } 70 }
61 } 71 }
62 return new MockFaceDetectionProvider(); 72 return new MockFaceDetectionProvider();
63 }); 73 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698