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

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

Issue 2588293005: Shape Detection: Add Text Detection in Chrome Android (Closed)
Patch Set: Created 3 years, 12 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
(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/connection',
8 'mojo/public/js/core',
9 'content/public/renderer/frame_interfaces',
10 ], (textDetection, bindings, connection, mojo, interfaces) => {
11
12 class MockTextDetection {
13 constructor() {
14 interfaces.addInterfaceOverrideForTesting(
15 textDetection.TextDetection.name,
16 pipe => this.bindToPipe(pipe));
17 }
18
19 bindToPipe(pipe) {
20 this.stub_ = connection.bindHandleToStub(pipe,
21 textDetection.TextDetection);
Reilly Grant (use Gerrit) 2016/12/23 02:24:28 yzshen@ recently sent me a patch with a new API fo
xianglu 2017/01/03 20:47:27 Done.
22 bindings.StubBindings(this.stub_).delegate = this;
23 }
24
25 detect(frame_data, width, height) {
26 let receivedStruct = mojo.mapBuffer(frame_data, 0, width*height*4, 0);
27 this.buffer_data_ = new Uint32Array(receivedStruct.buffer);
28 return Promise.resolve({
29 results: [
30 {
31 raw_value : "cats",
32 bounding_box: { x: 1.0, y: 1.0, width: 100.0, height: 100.0 }
33 },
34 {
35 raw_value : "dogs",
36 bounding_box: { x: 2.0, y: 2.0, width: 50.0, height: 50.0 }
37 },
38 ],
39 });
40 mojo.unmapBuffer(receivedStruct.buffer);
41 }
42
43 getFrameData() {
44 return this.buffer_data_;
45 }
46 }
47 return new MockTextDetection();
48 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698