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

Unified Diff: content/browser/renderer_host/media/mock_video_capture_provider.h

Issue 2803483003: [Mojo Video Capture] Split interface BuildableVideoCaptureDevice (Closed)
Patch Set: Remove fallback mechanism. Created 3 years, 8 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: content/browser/renderer_host/media/mock_video_capture_provider.h
diff --git a/content/browser/renderer_host/media/mock_video_capture_provider.h b/content/browser/renderer_host/media/mock_video_capture_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..30f729697a96c17c291f80ffc685c28fdfba39f2
--- /dev/null
+++ b/content/browser/renderer_host/media/mock_video_capture_provider.h
@@ -0,0 +1,100 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MOCK_VIDEO_CAPTURE_PROVIDER_H_
+#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MOCK_VIDEO_CAPTURE_PROVIDER_H_
+
+#include "content/browser/renderer_host/media/video_capture_provider.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace content {
+
+class MockVideoCaptureProvider : public VideoCaptureProvider {
+ public:
+ MockVideoCaptureProvider();
+ ~MockVideoCaptureProvider() override;
+
+ MOCK_METHOD1(GetDeviceInfosAsync,
+ void(const base::Callback<
+ void(const std::vector<media::VideoCaptureDeviceInfo>&)>&
+ result_callback));
+
+ MOCK_METHOD0(CreateDeviceLauncher,
+ std::unique_ptr<VideoCaptureDeviceLauncher>());
+};
+
+class MockVideoCaptureDeviceLauncher : public VideoCaptureDeviceLauncher {
+ public:
+ MockVideoCaptureDeviceLauncher();
+ ~MockVideoCaptureDeviceLauncher() override;
+
+ MOCK_METHOD6(DoLaunchDeviceAsync,
+ void(const std::string& device_id,
+ MediaStreamType stream_type,
+ const media::VideoCaptureParams& params,
+ base::WeakPtr<media::VideoFrameReceiver>* receiver,
+ Callbacks* callbacks,
+ base::OnceClosure* done_cb));
+
+ MOCK_METHOD0(AbortLaunch, void());
+
+ void LaunchDeviceAsync(const std::string& device_id,
+ MediaStreamType stream_type,
+ const media::VideoCaptureParams& params,
+ base::WeakPtr<media::VideoFrameReceiver> receiver,
+ Callbacks* callbacks,
+ base::OnceClosure done_cb) override {
+ DoLaunchDeviceAsync(device_id, stream_type, params, &receiver, callbacks,
+ &done_cb);
+ }
+};
+
+class MockLaunchedVideoCaptureDevice : public LaunchedVideoCaptureDevice {
+ public:
+ MockLaunchedVideoCaptureDevice();
+ ~MockLaunchedVideoCaptureDevice() override;
+
+ MOCK_CONST_METHOD1(
+ DoGetPhotoCapabilities,
+ void(media::VideoCaptureDevice::GetPhotoCapabilitiesCallback* callback));
+ MOCK_METHOD2(
+ DoSetPhotoOptions,
+ void(media::mojom::PhotoSettingsPtr* settings,
+ media::VideoCaptureDevice::SetPhotoOptionsCallback* callback));
+ MOCK_METHOD1(DoTakePhoto,
+ void(media::VideoCaptureDevice::TakePhotoCallback* callback));
+ MOCK_METHOD0(MaybeSuspendDevice, void());
+ MOCK_METHOD0(ResumeDevice, void());
+ MOCK_METHOD0(RequestRefreshFrame, void());
+ MOCK_METHOD2(DoSetDesktopCaptureWindowId,
+ void(gfx::NativeViewId window_id, base::OnceClosure* done_cb));
+ MOCK_METHOD2(OnUtilizationReport,
+ void(int frame_feedback_id, double utilization));
+
+ void GetPhotoCapabilities(
+ media::VideoCaptureDevice::GetPhotoCapabilitiesCallback callback)
+ const override {
+ DoGetPhotoCapabilities(&callback);
+ }
+
+ void SetPhotoOptions(
+ media::mojom::PhotoSettingsPtr settings,
+ media::VideoCaptureDevice::SetPhotoOptionsCallback callback) {
+ DoSetPhotoOptions(&settings, &callback);
+ }
+
+ void TakePhoto(
+ media::VideoCaptureDevice::TakePhotoCallback callback) override {
+ DoTakePhoto(&callback);
+ }
+
+ void SetDesktopCaptureWindowIdAsync(gfx::NativeViewId window_id,
+ base::OnceClosure done_cb) override {
+ DoSetDesktopCaptureWindowId(window_id, &done_cb);
+ }
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MOCK_VIDEO_CAPTURE_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698