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

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

Issue 2369693002: Shapedetection module: Blink side implementation (Closed)
Patch Set: rockot@ comments Created 4 years, 2 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 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);
mcasas 2016/10/03 21:02:46 Try to stick to 80 characters despite not being co
xianglu 2016/10/03 22:00:06 Done.
21 bindings.StubBindings(this.stub_).delegate = this;
22 }
23
24 detectFace(frame_data, width, height) {
25 let receivedStruct = mojo.mapBuffer(frame_data, 0, width*height*4, 0);
26 this.buffer_data_ = new Uint32Array(receivedStruct.buffer);
27 return Promise.resolve({
28 result: {
29 boundingBoxes: [
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 },
mcasas 2016/10/03 21:02:46 A bounding box should be a normalized coordinate t
xianglu 2016/10/03 22:00:06 Done.
33 ]
34 }
35 });
36 mojo.unmapBuffer(receivedStruct.buffer);
37 }
38
39 getFrameData() {
40 return this.buffer_data_;
41 }
42 }
43 return new MockShapeDetection();
44 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698