OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "services/video_capture/mock_device_factory.h" |
| 6 |
| 7 #include <sstream> |
| 8 |
| 9 #include "base/logging.h" |
| 10 #include "base/strings/stringprintf.h" |
| 11 #include "media/capture/video/fake_video_capture_device.h" |
| 12 #include "services/video_capture/device_mock_to_media_adapter.h" |
| 13 |
| 14 namespace video_capture { |
| 15 |
| 16 MockDeviceFactory::MockDeviceFactory() = default; |
| 17 |
| 18 MockDeviceFactory::~MockDeviceFactory() = default; |
| 19 |
| 20 void MockDeviceFactory::AddMockDevice( |
| 21 mojom::MockVideoCaptureDevicePtr device, |
| 22 const media::VideoCaptureDeviceDescriptor& descriptor) { |
| 23 devices_[descriptor] = std::move(device); |
| 24 } |
| 25 |
| 26 std::unique_ptr<media::VideoCaptureDevice> MockDeviceFactory::CreateDevice( |
| 27 const media::VideoCaptureDeviceDescriptor& device_descriptor) { |
| 28 mojom::MockVideoCaptureDevicePtr* device = &(devices_[device_descriptor]); |
| 29 if (device == nullptr) { |
| 30 return nullptr; |
| 31 } |
| 32 return base::MakeUnique<DeviceMockToMediaAdapter>(device); |
| 33 } |
| 34 |
| 35 void MockDeviceFactory::GetDeviceDescriptors( |
| 36 media::VideoCaptureDeviceDescriptors* device_descriptors) { |
| 37 for (const auto& entry : devices_) |
| 38 device_descriptors->push_back(entry.first); |
| 39 } |
| 40 |
| 41 void MockDeviceFactory::GetSupportedFormats( |
| 42 const media::VideoCaptureDeviceDescriptor& device_descriptor, |
| 43 media::VideoCaptureFormats* supported_formats) { |
| 44 NOTIMPLEMENTED(); |
| 45 } |
| 46 |
| 47 } // namespace video_capture |
OLD | NEW |