| OLD | NEW |
| (Empty) | |
| 1 "use strict"; |
| 2 |
| 3 let mockTextDetectionReady = define( |
| 4 'mockTextDetection', |
| 5 ['third_party/WebKit/public/platform/modules/shapedetection/textdetection.mojo
m', |
| 6 'mojo/public/js/bindings', |
| 7 'mojo/public/js/core', |
| 8 'content/public/renderer/frame_interfaces', |
| 9 ], (textDetection, bindings, mojo, interfaces) => { |
| 10 |
| 11 class MockTextDetection { |
| 12 constructor() { |
| 13 this.bindingSet_ = new bindings.BindingSet(textDetection.TextDetection); |
| 14 |
| 15 interfaces.addInterfaceOverrideForTesting( |
| 16 textDetection.TextDetection.name, |
| 17 handle => this.bindingSet_.addBinding(this, handle)); |
| 18 } |
| 19 |
| 20 detect(frame_data, width, height) { |
| 21 let receivedStruct = mojo.mapBuffer(frame_data, 0, width*height*4, 0); |
| 22 this.buffer_data_ = new Uint32Array(receivedStruct.buffer); |
| 23 return Promise.resolve({ |
| 24 results: [ |
| 25 { |
| 26 raw_value : "cats", |
| 27 bounding_box: { x: 1.0, y: 1.0, width: 100.0, height: 100.0 } |
| 28 }, |
| 29 { |
| 30 raw_value : "dogs", |
| 31 bounding_box: { x: 2.0, y: 2.0, width: 50.0, height: 50.0 } |
| 32 }, |
| 33 ], |
| 34 }); |
| 35 mojo.unmapBuffer(receivedStruct.buffer); |
| 36 } |
| 37 |
| 38 getFrameData() { |
| 39 return this.buffer_data_; |
| 40 } |
| 41 } |
| 42 return new MockTextDetection(); |
| 43 }); |
| OLD | NEW |