Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 "use strict"; | |
| 2 | |
| 3 let mockShapeDetectionReady = define( | |
| 4 'mockShapeDetection', | |
| 5 ['third_party/WebKit/public/platform/modules/shapedetection/shapedetection.moj om', | |
| 6 'mojo/public/js/bindings', | |
| 7 'mojo/public/js/connection', | |
| 8 'mojo/public/js/core', | |
| 9 'content/public/renderer/frame_interfaces', | |
| 10 ], (shapeDetection, bindings, connection, mojo, interfaces) => { | |
| 11 | |
| 12 class MockShapeDetection { | |
| 13 constructor() { | |
| 14 interfaces.addInterfaceOverrideForTesting( | |
| 15 shapeDetection.ShapeDetection.name, | |
| 16 pipe => this.bindToPipe(pipe)); | |
| 17 } | |
| 18 | |
| 19 bindToPipe(pipe) { | |
| 20 this.stub_ = connection.bindHandleToStub(pipe, shapeDetection.ShapeDetecti on); | |
| 21 bindings.StubBindings(this.stub_).delegate = this; | |
| 22 } | |
| 23 | |
| 24 detectFace(frame_data, width, height) { | |
| 25 let mojoResult = mojo.mapBuffer(frame_data, 0 /*offset*/, width*height*4/* size*/, 0/*flag*/); | |
|
Ken Rockot(use gerrit already)
2016/09/30 18:05:23
nit: the inline comments are probably unnecessary
xianglu
2016/10/03 18:12:07
Done.
| |
| 26 this.buffer_data_ = new Uint32Array(mojoResult.buffer); | |
| 27 return Promise.resolve( | |
| 28 { boundingBoxes : | |
|
Ken Rockot(use gerrit already)
2016/09/30 18:05:23
style nit: I don't think this is correct indenting
xianglu
2016/10/03 18:12:07
Done.
| |
| 29 [ | |
| 30 { x : 1.0, y: 1.0, width: 100.0, height: 100.0 }, | |
| 31 { x : 2.0, y: 2.0, width: 200.0, height: 200.0 }, | |
| 32 { x : 3.0, y: 3.0, width: 300.0, height: 300.0 }, | |
| 33 ] | |
| 34 }); | |
| 35 mojo.unmapBuffer(mojoResult.buffer); | |
| 36 } | |
| 37 | |
| 38 getFrameData() { | |
| 39 return this.buffer_data_; | |
| 40 } | |
| 41 } | |
| 42 return new MockShapeDetection(); | |
| 43 }); | |
| OLD | NEW |