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

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: jochen@ comments, rebase Created 3 years, 11 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/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 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698