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

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

Issue 2818513003: [Mojo Video Capture] Adapt video_capture service to refactored video capture stack (Closed)
Patch Set: Fix compile errors 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/ptr_util.h" 5 #include "base/memory/ptr_util.h"
6 #include "services/video_capture/test/mock_device_factory.h" 6 #include "services/video_capture/test/mock_device_factory.h"
7 7
8 namespace { 8 namespace {
9 9
10 // Report a single hard-coded supported format to clients. 10 // Report a single hard-coded supported format to clients.
11 media::VideoCaptureFormat kSupportedFormat(gfx::Size(), 11 media::VideoCaptureFormat kSupportedFormat(gfx::Size(640, 480),
12 25.0f, 12 25.0f,
13 media::PIXEL_FORMAT_I420, 13 media::PIXEL_FORMAT_I420,
14 media::PIXEL_STORAGE_CPU); 14 media::PIXEL_STORAGE_CPU);
15 15
16 // Wraps a raw pointer to a media::VideoCaptureDevice and allows us to
17 // create a std::unique_ptr<media::VideoCaptureDevice> that delegates to it.
16 class RawPointerVideoCaptureDevice : public media::VideoCaptureDevice { 18 class RawPointerVideoCaptureDevice : public media::VideoCaptureDevice {
17 public: 19 public:
18 explicit RawPointerVideoCaptureDevice(media::VideoCaptureDevice* device) 20 explicit RawPointerVideoCaptureDevice(media::VideoCaptureDevice* device)
19 : device_(device) {} 21 : device_(device) {}
20 22
21 // media::VideoCaptureDevice: 23 // media::VideoCaptureDevice:
22 void AllocateAndStart(const media::VideoCaptureParams& params, 24 void AllocateAndStart(const media::VideoCaptureParams& params,
23 std::unique_ptr<Client> client) override { 25 std::unique_ptr<Client> client) override {
24 device_->AllocateAndStart(params, std::move(client)); 26 device_->AllocateAndStart(params, std::move(client));
25 } 27 }
26 void RequestRefreshFrame() override { device_->RequestRefreshFrame(); } 28 void RequestRefreshFrame() override { device_->RequestRefreshFrame(); }
27 void StopAndDeAllocate() override { device_->StopAndDeAllocate(); } 29 void StopAndDeAllocate() override { device_->StopAndDeAllocate(); }
28 void GetPhotoCapabilities(GetPhotoCapabilitiesCallback callback) override { 30 void GetPhotoCapabilities(GetPhotoCapabilitiesCallback callback) override {
29 device_->GetPhotoCapabilities(std::move(callback)); 31 device_->GetPhotoCapabilities(std::move(callback));
30 } 32 }
31 void SetPhotoOptions(media::mojom::PhotoSettingsPtr settings, 33 void SetPhotoOptions(media::mojom::PhotoSettingsPtr settings,
32 SetPhotoOptionsCallback callback) override { 34 SetPhotoOptionsCallback callback) override {
33 device_->SetPhotoOptions(std::move(settings), std::move(callback)); 35 device_->SetPhotoOptions(std::move(settings), std::move(callback));
34 } 36 }
35 void TakePhoto(TakePhotoCallback callback) override { 37 void TakePhoto(TakePhotoCallback callback) override {
36 device_->TakePhoto(std::move(callback)); 38 device_->TakePhoto(std::move(callback));
37 } 39 }
40 void OnUtilizationReport(int frame_feedback_id, double utilization) override {
41 device_->OnUtilizationReport(frame_feedback_id, utilization);
42 }
38 43
39 private: 44 private:
40 media::VideoCaptureDevice* device_; 45 media::VideoCaptureDevice* device_;
41 }; 46 };
42 47
43 } // anonymous namespace 48 } // anonymous namespace
44 49
45 namespace video_capture { 50 namespace video_capture {
46 51
47 MockDeviceFactory::MockDeviceFactory() = default; 52 MockDeviceFactory::MockDeviceFactory() = default;
(...skipping 20 matching lines...) Expand all
68 device_descriptors->push_back(entry.first); 73 device_descriptors->push_back(entry.first);
69 } 74 }
70 75
71 void MockDeviceFactory::GetSupportedFormats( 76 void MockDeviceFactory::GetSupportedFormats(
72 const media::VideoCaptureDeviceDescriptor& device_descriptor, 77 const media::VideoCaptureDeviceDescriptor& device_descriptor,
73 media::VideoCaptureFormats* supported_formats) { 78 media::VideoCaptureFormats* supported_formats) {
74 supported_formats->push_back(kSupportedFormat); 79 supported_formats->push_back(kSupportedFormat);
75 } 80 }
76 81
77 } // namespace video_capture 82 } // namespace video_capture
OLDNEW
« no previous file with comments | « services/video_capture/test/fake_device_unittest.cc ('k') | services/video_capture/test/mock_device_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698