Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js |
| diff --git a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js |
| index 1faf89f7727c4a8bcbeb293978e3c643e5d2693a..52dc0d8d0e98a2e4f7dd08adb3c3a42cd572493f 100644 |
| --- a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js |
| +++ b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js |
| @@ -17,36 +17,42 @@ let mockFaceDetectionProviderReady = define( |
| interfaces.addInterfaceOverrideForTesting( |
| faceDetectionProvider.FaceDetectionProvider.name, |
| handle => this.bindingSet_.addBinding(this, handle)); |
| + |
| + this.serviceArray_ = []; |
|
Ken Rockot(use gerrit already)
2017/05/03 16:48:54
nit: how about "mockServiceInstances_" instead of
|
| + this.buffer_data_ = []; |
| } |
| createFaceDetection(request, options) { |
| - this.mock_service_ = new MockFaceDetection(request, options); |
| + this.maxDetectedFaces_ = options.max_detected_faces; |
|
Ken Rockot(use gerrit already)
2017/05/03 16:48:54
Doesn't this effectively cause the same problem as
|
| + this.fastMode_ = options.fast_mode; |
| + |
| + let mock_service = new MockFaceDetection(request, options, this); |
|
Ken Rockot(use gerrit already)
2017/05/03 16:48:54
nit: Please either just delete this unnecessary li
|
| + this.serviceArray_.push(mock_service); |
| } |
| getFrameData() { |
| - return this.mock_service_.buffer_data_; |
| + return this.buffer_data_; |
|
Ken Rockot(use gerrit already)
2017/05/03 16:48:54
nit: While you're here, please fix the naming styl
|
| } |
| getMaxDetectedFaces() { |
| - return this.mock_service_.maxDetectedFaces_; |
| + return this.maxDetectedFaces_; |
| } |
| getFastMode () { |
| - return this.mock_service_.fastMode_; |
| + return this.fastMode_; |
| } |
| } |
| class MockFaceDetection { |
| - constructor(request, options) { |
| - this.maxDetectedFaces_ = options.max_detected_faces; |
| - this.fastMode_ = options.fast_mode; |
| + constructor(request, options, provider) { |
| + this.provider_ = provider; |
| this.binding_ = new bindings.Binding(faceDetection.FaceDetection, this, |
| request); |
| } |
| detect(frame_data, width, height) { |
| let receivedStruct = mojo.mapBuffer(frame_data, 0, width*height*4, 0); |
| - this.buffer_data_ = new Uint32Array(receivedStruct.buffer); |
| + this.provider_.buffer_data_ = new Uint32Array(receivedStruct.buffer); |
| return Promise.resolve({ |
| result: { |
| bounding_boxes: [ |