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

Side by Side Diff: services/video_capture/mock_device_factory.cc

Issue 2471613005: [Mojo Video Capture] Use actual factory instances implementing media::VideoCaptureDeviceFactory (Closed)
Patch Set: rebase Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698