Chromium Code Reviews| Index: content/browser/renderer_host/media/video_capture_manager.h |
| diff --git a/content/browser/renderer_host/media/video_capture_manager.h b/content/browser/renderer_host/media/video_capture_manager.h |
| index 35aee8eba235ef42c49b1fae80e37feb8b17652f..e259bbc50ff490365641dd58d15b839694998be8 100644 |
| --- a/content/browser/renderer_host/media/video_capture_manager.h |
| +++ b/content/browser/renderer_host/media/video_capture_manager.h |
| @@ -24,6 +24,7 @@ |
| #include "content/common/content_export.h" |
| #include "content/common/media/media_stream_options.h" |
| #include "media/video/capture/video_capture_device.h" |
| +#include "media/video/capture/video_capture_device_factory.h" |
| #include "media/video/capture/video_capture_types.h" |
| namespace content { |
| @@ -55,7 +56,7 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| // Used by unit test to make sure a fake device is used instead of a real |
| // video capture device. Due to timing requirements, the function must be |
| // called before EnumerateDevices and Open. |
| - void UseFakeDevice(); |
| + void UseFakeDevice(scoped_ptr<media::VideoCaptureDeviceFactory> factory); |
|
perkj_chrome
2014/04/15 09:34:01
Why not just inject the factory in the ctor? Tests
mcasas
2014/04/15 13:47:09
Extended the ctor to accept a Factory.
Some highe
|
| // Called by VideoCaptureHost to locate a capture device for |capture_params|, |
| // adding the Host as a client of the device's controller if successful. The |
| @@ -103,6 +104,11 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| void SetDesktopCaptureWindowId(media::VideoCaptureSessionId session_id, |
| gfx::NativeViewId window_id); |
| + // Gets a weak reference to the device factory, used for tests. |
| + media::VideoCaptureDeviceFactory* video_capture_device_factory() const { |
| + return video_capture_device_factory_.get(); |
| + } |
| + |
| private: |
| virtual ~VideoCaptureManager(); |
| struct DeviceEntry; |
| @@ -220,6 +226,8 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| typedef std::set<DeviceEntry*> DeviceEntries; |
| DeviceEntries devices_; |
| + scoped_ptr<media::VideoCaptureDeviceFactory> video_capture_device_factory_; |
| + |
| // Local cache of the enumerated video capture devices' names and capture |
| // supported formats. A snapshot of the current devices and their capabilities |
| // is composed in GetAvailableDevicesInfoOnDeviceThread() --coming |
| @@ -229,15 +237,13 @@ class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { |
| // active device capture format from the VideoCaptureController associated. |
| DeviceInfos devices_info_cache_; |
| - // For unit testing and for performance/quality tests, a test device can be |
| - // used instead of a real one. The device can be a simple fake device (a |
| - // rolling pacman), or a file that is played in a loop continuously. This only |
| - // applies to the MEDIA_DEVICE_VIDEO_CAPTURE device type. |
| - enum { |
| - DISABLED, |
| - TEST_PATTERN, |
| - Y4M_FILE |
| - } artificial_device_source_for_testing_; |
| + // A test device can be used for unit testing and for performance/quality |
| + // measurements. This device is usually injected from the test harness, but |
| + // can also come from MediaStreamManager in normal operation, via command line |
| + // flag. Supported test devices include a simple fake device (a rolling |
| + // pacman), or a file that is played in a loop continuously. Test device is |
| + // only and always of type MEDIA_DEVICE_VIDEO_CAPTURE. |
| + bool use_testing_device_source_; |
|
perkj_chrome
2014/04/15 09:34:01
We want to get rid of this type of things in the p
mcasas
2014/04/15 13:47:09
Done.
|
| // Accessed on the device thread only. |
| std::map<media::VideoCaptureSessionId, gfx::NativeViewId> |