| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 run_loop_->QuitClosure().Run(); | 143 run_loop_->QuitClosure().Run(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void WaitForCapturedFrame() { | 146 void WaitForCapturedFrame() { |
| 147 run_loop_.reset(new base::RunLoop()); | 147 run_loop_.reset(new base::RunLoop()); |
| 148 run_loop_->Run(); | 148 run_loop_->Run(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 scoped_ptr<media::VideoCaptureDevice::Names> EnumerateDevices() { | 151 scoped_ptr<media::VideoCaptureDevice::Names> EnumerateDevices() { |
| 152 media::VideoCaptureDevice::Names* names; | 152 media::VideoCaptureDevice::Names* names; |
| 153 EXPECT_CALL(*device_enumeration_listener_, | 153 EXPECT_CALL(*device_enumeration_listener_.get(), |
| 154 OnEnumeratedDevicesCallbackPtr(_)).WillOnce(SaveArg<0>(&names)); | 154 OnEnumeratedDevicesCallbackPtr(_)).WillOnce(SaveArg<0>(&names)); |
| 155 | 155 |
| 156 video_capture_device_factory_->EnumerateDeviceNames( | 156 video_capture_device_factory_->EnumerateDeviceNames( |
| 157 base::Bind(&DeviceEnumerationListener::OnEnumeratedDevicesCallback, | 157 base::Bind(&DeviceEnumerationListener::OnEnumeratedDevicesCallback, |
| 158 device_enumeration_listener_)); | 158 device_enumeration_listener_)); |
| 159 base::MessageLoop::current()->RunUntilIdle(); | 159 base::MessageLoop::current()->RunUntilIdle(); |
| 160 return scoped_ptr<media::VideoCaptureDevice::Names>(names); | 160 return scoped_ptr<media::VideoCaptureDevice::Names>(names); |
| 161 } | 161 } |
| 162 | 162 |
| 163 const VideoCaptureFormat& last_format() const { return last_format_; } | 163 const VideoCaptureFormat& last_format() const { return last_format_; } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 // Use PIXEL_FORMAT_MAX to iterate all device names for testing | 423 // Use PIXEL_FORMAT_MAX to iterate all device names for testing |
| 424 // GetDeviceSupportedFormats(). | 424 // GetDeviceSupportedFormats(). |
| 425 scoped_ptr<VideoCaptureDevice::Name> name = | 425 scoped_ptr<VideoCaptureDevice::Name> name = |
| 426 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); | 426 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); |
| 427 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here | 427 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here |
| 428 // since we cannot forecast the hardware capabilities. | 428 // since we cannot forecast the hardware capabilities. |
| 429 ASSERT_FALSE(name); | 429 ASSERT_FALSE(name); |
| 430 } | 430 } |
| 431 | 431 |
| 432 }; // namespace media | 432 }; // namespace media |
| OLD | NEW |