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

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

Issue 2919253002: Don't move raw pointers in services (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « services/ui/public/cpp/bitmap/child_shared_bitmap_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 namespace video_capture { 50 namespace video_capture {
51 51
52 MockDeviceFactory::MockDeviceFactory() = default; 52 MockDeviceFactory::MockDeviceFactory() = default;
53 53
54 MockDeviceFactory::~MockDeviceFactory() = default; 54 MockDeviceFactory::~MockDeviceFactory() = default;
55 55
56 void MockDeviceFactory::AddMockDevice( 56 void MockDeviceFactory::AddMockDevice(
57 media::VideoCaptureDevice* device, 57 media::VideoCaptureDevice* device,
58 const media::VideoCaptureDeviceDescriptor& descriptor) { 58 const media::VideoCaptureDeviceDescriptor& descriptor) {
59 devices_[descriptor] = std::move(device); 59 devices_[descriptor] = device;
60 } 60 }
61 61
62 std::unique_ptr<media::VideoCaptureDevice> MockDeviceFactory::CreateDevice( 62 std::unique_ptr<media::VideoCaptureDevice> MockDeviceFactory::CreateDevice(
63 const media::VideoCaptureDeviceDescriptor& device_descriptor) { 63 const media::VideoCaptureDeviceDescriptor& device_descriptor) {
64 if (devices_.find(device_descriptor) == devices_.end()) 64 if (devices_.find(device_descriptor) == devices_.end())
65 return nullptr; 65 return nullptr;
66 return base::MakeUnique<RawPointerVideoCaptureDevice>( 66 return base::MakeUnique<RawPointerVideoCaptureDevice>(
67 devices_[device_descriptor]); 67 devices_[device_descriptor]);
68 } 68 }
69 69
70 void MockDeviceFactory::GetDeviceDescriptors( 70 void MockDeviceFactory::GetDeviceDescriptors(
71 media::VideoCaptureDeviceDescriptors* device_descriptors) { 71 media::VideoCaptureDeviceDescriptors* device_descriptors) {
72 for (const auto& entry : devices_) 72 for (const auto& entry : devices_)
73 device_descriptors->push_back(entry.first); 73 device_descriptors->push_back(entry.first);
74 } 74 }
75 75
76 void MockDeviceFactory::GetSupportedFormats( 76 void MockDeviceFactory::GetSupportedFormats(
77 const media::VideoCaptureDeviceDescriptor& device_descriptor, 77 const media::VideoCaptureDeviceDescriptor& device_descriptor,
78 media::VideoCaptureFormats* supported_formats) { 78 media::VideoCaptureFormats* supported_formats) {
79 supported_formats->push_back(kSupportedFormat); 79 supported_formats->push_back(kSupportedFormat);
80 } 80 }
81 81
82 } // namespace video_capture 82 } // namespace video_capture
OLDNEW
« no previous file with comments | « services/ui/public/cpp/bitmap/child_shared_bitmap_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698