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

Unified Diff: third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js

Issue 2571903003: Mojo JS bindings: switch most usage of "connection"/"router" module to "bindings". (Closed)
Patch Set: remove the changes to web_ui_mojo.js which seemed to cause flakiness. Created 4 years 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 side-by-side diff with in-line comments
Download patch
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 c934619418786f85a4096d871e5d6aaa00408647..62220e829325e1faee3485f8f70e0ba81e72dd83 100644
--- a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js
+++ b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js
@@ -5,30 +5,22 @@ let mockFaceDetectionProviderReady = define(
['third_party/WebKit/public/platform/modules/shapedetection/facedetection.mojom',
'third_party/WebKit/public/platform/modules/shapedetection/facedetection_provider.mojom',
'mojo/public/js/bindings',
- 'mojo/public/js/connection',
'mojo/public/js/core',
'content/public/renderer/frame_interfaces',
- ], (faceDetection, faceDetectionProvider, bindings, connection, mojo, interfaces) => {
+ ], (faceDetection, faceDetectionProvider, bindings, mojo, interfaces) => {
class MockFaceDetectionProvider {
constructor() {
+ this.bindingSet_ = new bindings.BindingSet(
+ faceDetectionProvider.FaceDetectionProvider);
+
interfaces.addInterfaceOverrideForTesting(
faceDetectionProvider.FaceDetectionProvider.name,
- pipe => this.bindToPipe(pipe));
- }
-
- bindToPipe(pipe) {
- this.stub_ = connection.bindHandleToStub(
- pipe, faceDetectionProvider.FaceDetectionProvider);
- bindings.StubBindings(this.stub_).delegate = this;
+ handle => this.bindingSet_.addBinding(this, handle));
}
createFaceDetection(request, options) {
- this.mock_service_ = new MockFaceDetection(options);
- this.mock_service_.stub_ = connection.bindHandleToStub(
- request.handle, faceDetection.FaceDetection);
- bindings.StubBindings(this.mock_service_.stub_).delegate =
- this.mock_service_;
+ this.mock_service_ = new MockFaceDetection(request, options);
}
getFrameData() {
@@ -45,9 +37,11 @@ let mockFaceDetectionProviderReady = define(
}
class MockFaceDetection {
- constructor(options) {
+ constructor(request, options) {
this.maxDetectedFaces_ = options.max_detected_faces;
this.fastMode_ = options.fast_mode;
+ this.binding_ = new bindings.Binding(faceDetection.FaceDetection, this,
+ request);
}
detect(frame_data, width, height) {

Powered by Google App Engine
This is Rietveld 408576698