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

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

Issue 2590393002: Revert of Mojo JS bindings: switch most usage of "connection"/"router" module to "bindings". (Closed)
Patch Set: 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 62220e829325e1faee3485f8f70e0ba81e72dd83..c934619418786f85a4096d871e5d6aaa00408647 100644
--- a/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js
+++ b/third_party/WebKit/LayoutTests/shapedetection/resources/mock-facedetection.js
@@ -5,22 +5,30 @@
['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, mojo, interfaces) => {
+ ], (faceDetection, faceDetectionProvider, bindings, connection, mojo, interfaces) => {
class MockFaceDetectionProvider {
constructor() {
- this.bindingSet_ = new bindings.BindingSet(
- faceDetectionProvider.FaceDetectionProvider);
-
interfaces.addInterfaceOverrideForTesting(
faceDetectionProvider.FaceDetectionProvider.name,
- handle => this.bindingSet_.addBinding(this, handle));
+ pipe => this.bindToPipe(pipe));
+ }
+
+ bindToPipe(pipe) {
+ this.stub_ = connection.bindHandleToStub(
+ pipe, faceDetectionProvider.FaceDetectionProvider);
+ bindings.StubBindings(this.stub_).delegate = this;
}
createFaceDetection(request, options) {
- this.mock_service_ = new MockFaceDetection(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_;
}
getFrameData() {
@@ -37,11 +45,9 @@
}
class MockFaceDetection {
- constructor(request, options) {
+ constructor(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