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

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

Issue 1966083003: ImageCapture: takePhoto() mock LayoutTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mlamouri@ comments Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
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();
+});

Powered by Google App Engine
This is Rietveld 408576698