OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/capture/video/video_capture_device.h" | 5 #include "media/capture/video/video_capture_device.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 192 } |
193 | 193 |
194 std::unique_ptr<VideoCaptureDevice::Names> EnumerateDevices() { | 194 std::unique_ptr<VideoCaptureDevice::Names> EnumerateDevices() { |
195 VideoCaptureDevice::Names* names; | 195 VideoCaptureDevice::Names* names; |
196 EXPECT_CALL(*device_enumeration_listener_.get(), | 196 EXPECT_CALL(*device_enumeration_listener_.get(), |
197 OnEnumeratedDevicesCallbackPtr(_)).WillOnce(SaveArg<0>(&names)); | 197 OnEnumeratedDevicesCallbackPtr(_)).WillOnce(SaveArg<0>(&names)); |
198 | 198 |
199 video_capture_device_factory_->EnumerateDeviceNames( | 199 video_capture_device_factory_->EnumerateDeviceNames( |
200 base::Bind(&DeviceEnumerationListener::OnEnumeratedDevicesCallback, | 200 base::Bind(&DeviceEnumerationListener::OnEnumeratedDevicesCallback, |
201 device_enumeration_listener_)); | 201 device_enumeration_listener_)); |
202 base::MessageLoop::current()->RunUntilIdle(); | 202 base::RunLoop().RunUntilIdle(); |
203 return std::unique_ptr<VideoCaptureDevice::Names>(names); | 203 return std::unique_ptr<VideoCaptureDevice::Names>(names); |
204 } | 204 } |
205 | 205 |
206 const VideoCaptureFormat& last_format() const { return last_format_; } | 206 const VideoCaptureFormat& last_format() const { return last_format_; } |
207 | 207 |
208 std::unique_ptr<VideoCaptureDevice::Name> | 208 std::unique_ptr<VideoCaptureDevice::Name> |
209 GetFirstDeviceNameSupportingPixelFormat( | 209 GetFirstDeviceNameSupportingPixelFormat( |
210 const VideoPixelFormat& pixel_format) { | 210 const VideoPixelFormat& pixel_format) { |
211 names_ = EnumerateDevices(); | 211 names_ = EnumerateDevices(); |
212 if (names_->empty()) { | 212 if (names_->empty()) { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 // GetDeviceSupportedFormats(). | 476 // GetDeviceSupportedFormats(). |
477 std::unique_ptr<VideoCaptureDevice::Name> name = | 477 std::unique_ptr<VideoCaptureDevice::Name> name = |
478 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); | 478 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); |
479 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else | 479 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else |
480 // to test here | 480 // to test here |
481 // since we cannot forecast the hardware capabilities. | 481 // since we cannot forecast the hardware capabilities. |
482 ASSERT_FALSE(name); | 482 ASSERT_FALSE(name); |
483 } | 483 } |
484 | 484 |
485 }; // namespace media | 485 }; // namespace media |
OLD | NEW |