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

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

Issue 2844813002: Revert of [Mojo Video Capture] Adapt video_capture service to refactored video capture stack (Closed)
Patch Set: 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(640, 480), 11 media::VideoCaptureFormat kSupportedFormat(gfx::Size(),
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.
18 class RawPointerVideoCaptureDevice : public media::VideoCaptureDevice { 16 class RawPointerVideoCaptureDevice : public media::VideoCaptureDevice {
19 public: 17 public:
20 explicit RawPointerVideoCaptureDevice(media::VideoCaptureDevice* device) 18 explicit RawPointerVideoCaptureDevice(media::VideoCaptureDevice* device)
21 : device_(device) {} 19 : device_(device) {}
22 20
23 // media::VideoCaptureDevice: 21 // media::VideoCaptureDevice:
24 void AllocateAndStart(const media::VideoCaptureParams& params, 22 void AllocateAndStart(const media::VideoCaptureParams& params,
25 std::unique_ptr<Client> client) override { 23 std::unique_ptr<Client> client) override {
26 device_->AllocateAndStart(params, std::move(client)); 24 device_->AllocateAndStart(params, std::move(client));
27 } 25 }
28 void RequestRefreshFrame() override { device_->RequestRefreshFrame(); } 26 void RequestRefreshFrame() override { device_->RequestRefreshFrame(); }
29 void StopAndDeAllocate() override { device_->StopAndDeAllocate(); } 27 void StopAndDeAllocate() override { device_->StopAndDeAllocate(); }
30 void GetPhotoCapabilities(GetPhotoCapabilitiesCallback callback) override { 28 void GetPhotoCapabilities(GetPhotoCapabilitiesCallback callback) override {
31 device_->GetPhotoCapabilities(std::move(callback)); 29 device_->GetPhotoCapabilities(std::move(callback));
32 } 30 }
33 void SetPhotoOptions(media::mojom::PhotoSettingsPtr settings, 31 void SetPhotoOptions(media::mojom::PhotoSettingsPtr settings,
34 SetPhotoOptionsCallback callback) override { 32 SetPhotoOptionsCallback callback) override {
35 device_->SetPhotoOptions(std::move(settings), std::move(callback)); 33 device_->SetPhotoOptions(std::move(settings), std::move(callback));
36 } 34 }
37 void TakePhoto(TakePhotoCallback callback) override { 35 void TakePhoto(TakePhotoCallback callback) override {
38 device_->TakePhoto(std::move(callback)); 36 device_->TakePhoto(std::move(callback));
39 } 37 }
40 void OnUtilizationReport(int frame_feedback_id, double utilization) override {
41 device_->OnUtilizationReport(frame_feedback_id, utilization);
42 }
43 38
44 private: 39 private:
45 media::VideoCaptureDevice* device_; 40 media::VideoCaptureDevice* device_;
46 }; 41 };
47 42
48 } // anonymous namespace 43 } // anonymous namespace
49 44
50 namespace video_capture { 45 namespace video_capture {
51 46
52 MockDeviceFactory::MockDeviceFactory() = default; 47 MockDeviceFactory::MockDeviceFactory() = default;
(...skipping 20 matching lines...) Expand all
73 device_descriptors->push_back(entry.first); 68 device_descriptors->push_back(entry.first);
74 } 69 }
75 70
76 void MockDeviceFactory::GetSupportedFormats( 71 void MockDeviceFactory::GetSupportedFormats(
77 const media::VideoCaptureDeviceDescriptor& device_descriptor, 72 const media::VideoCaptureDeviceDescriptor& device_descriptor,
78 media::VideoCaptureFormats* supported_formats) { 73 media::VideoCaptureFormats* supported_formats) {
79 supported_formats->push_back(kSupportedFormat); 74 supported_formats->push_back(kSupportedFormat);
80 } 75 }
81 76
82 } // namespace video_capture 77 } // 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