| 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/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "media/video/capture/video_capture_device.h" | 10 #include "media/video/capture/video_capture_device.h" |
| 11 #include "media/video/capture/video_capture_device_factory.h" | 11 #include "media/video/capture/video_capture_device_factory.h" |
| 12 #include "media/video/capture/video_capture_types.h" | 12 #include "media/video/capture/video_capture_types.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
| 17 #include "base/win/scoped_com_initializer.h" | 17 #include "base/win/scoped_com_initializer.h" |
| 18 #include "media/video/capture/win/video_capture_device_mf_win.h" | 18 #include "media/video/capture/win/video_capture_device_factory_win.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
| 22 #include "base/android/jni_android.h" | 22 #include "base/android/jni_android.h" |
| 23 #include "media/video/capture/android/video_capture_device_android.h" | 23 #include "media/video/capture/android/video_capture_device_android.h" |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
| 27 // Mac/QTKit will always give you the size you ask for and this case will fail. | 27 // Mac/QTKit will always give you the size you ask for and this case will fail. |
| 28 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize | 28 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 scoped_ptr<base::MessageLoop> loop_; | 157 scoped_ptr<base::MessageLoop> loop_; |
| 158 scoped_ptr<base::RunLoop> run_loop_; | 158 scoped_ptr<base::RunLoop> run_loop_; |
| 159 scoped_ptr<MockClient> client_; | 159 scoped_ptr<MockClient> client_; |
| 160 VideoCaptureFormat last_format_; | 160 VideoCaptureFormat last_format_; |
| 161 scoped_ptr<VideoCaptureDeviceFactory> video_capture_device_factory_; | 161 scoped_ptr<VideoCaptureDeviceFactory> video_capture_device_factory_; |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 TEST_F(VideoCaptureDeviceTest, OpenInvalidDevice) { | 164 TEST_F(VideoCaptureDeviceTest, OpenInvalidDevice) { |
| 165 #if defined(OS_WIN) | 165 #if defined(OS_WIN) |
| 166 VideoCaptureDevice::Name::CaptureApiType api_type = | 166 VideoCaptureDevice::Name::CaptureApiType api_type = |
| 167 VideoCaptureDeviceMFWin::PlatformSupported() | 167 VideoCaptureDeviceFactoryWin::PlatformSupportsMediaFoundation() |
| 168 ? VideoCaptureDevice::Name::MEDIA_FOUNDATION | 168 ? VideoCaptureDevice::Name::MEDIA_FOUNDATION |
| 169 : VideoCaptureDevice::Name::DIRECT_SHOW; | 169 : VideoCaptureDevice::Name::DIRECT_SHOW; |
| 170 VideoCaptureDevice::Name device_name("jibberish", "jibberish", api_type); | 170 VideoCaptureDevice::Name device_name("jibberish", "jibberish", api_type); |
| 171 #elif defined(OS_MACOSX) | 171 #elif defined(OS_MACOSX) |
| 172 VideoCaptureDevice::Name device_name("jibberish", "jibberish", | 172 VideoCaptureDevice::Name device_name("jibberish", "jibberish", |
| 173 VideoCaptureDevice::Name::AVFOUNDATION); | 173 VideoCaptureDevice::Name::AVFOUNDATION); |
| 174 #else | 174 #else |
| 175 VideoCaptureDevice::Name device_name("jibberish", "jibberish"); | 175 VideoCaptureDevice::Name device_name("jibberish", "jibberish"); |
| 176 #endif | 176 #endif |
| 177 scoped_ptr<VideoCaptureDevice> device = | 177 scoped_ptr<VideoCaptureDevice> device = |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // Use PIXEL_FORMAT_MAX to iterate all device names for testing | 363 // Use PIXEL_FORMAT_MAX to iterate all device names for testing |
| 364 // GetDeviceSupportedFormats(). | 364 // GetDeviceSupportedFormats(). |
| 365 scoped_ptr<VideoCaptureDevice::Name> name = | 365 scoped_ptr<VideoCaptureDevice::Name> name = |
| 366 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); | 366 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); |
| 367 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here | 367 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here |
| 368 // since we cannot forecast the hardware capabilities. | 368 // since we cannot forecast the hardware capabilities. |
| 369 ASSERT_FALSE(name); | 369 ASSERT_FALSE(name); |
| 370 } | 370 } |
| 371 | 371 |
| 372 }; // namespace media | 372 }; // namespace media |
| OLD | NEW |