| Index: third_party/WebKit/LayoutTests/imagecapture/resources/mock-imagecapture.js
|
| diff --git a/third_party/WebKit/LayoutTests/imagecapture/resources/mock-imagecapture.js b/third_party/WebKit/LayoutTests/imagecapture/resources/mock-imagecapture.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ae788164aa5a493b02ba69d52e1ed2fe3a3c0366
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/imagecapture/resources/mock-imagecapture.js
|
| @@ -0,0 +1,30 @@
|
| +"use strict";
|
| +
|
| +let mockImageCaptureReady = define(
|
| + 'mockImageCapture',
|
| + ['third_party/WebKit/public/platform/modules/imagecapture/image_capture.mojom',
|
| + 'mojo/public/js/bindings',
|
| + 'mojo/public/js/connection',
|
| + 'content/public/renderer/service_registry',
|
| + ], (imageCapture, bindings, connection, serviceRegistry) => {
|
| +
|
| + class MockImageCapture {
|
| + constructor() {
|
| + serviceRegistry.addServiceOverrideForTesting(
|
| + imageCapture.ImageCapture.name,
|
| + pipe => this.bindToPipe(pipe));
|
| + }
|
| +
|
| + bindToPipe(pipe) {
|
| + this.stub_ = connection.bindHandleToStub(
|
| + pipe, imageCapture.ImageCapture);
|
| + bindings.StubBindings(this.stub_).delegate = this;
|
| + }
|
| +
|
| + takePhoto(sourceid) {
|
| + return Promise.resolve({ mime_type : 'image/cat',
|
| + data : "(,,,)=(^.^)=(,,,)" });
|
| + }
|
| + }
|
| + return new MockImageCapture();
|
| +});
|
|
|