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

Side by Side Diff: media/capture/video/video_capture_device_unittest.cc

Issue 1815983003: Remove deprecated QTKit Video Capture Support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 (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 #include <utility> 9 #include <utility>
10 10
(...skipping 22 matching lines...) Expand all
33 #include "media/base/mac/avfoundation_glue.h" 33 #include "media/base/mac/avfoundation_glue.h"
34 #include "media/capture/video/mac/video_capture_device_factory_mac.h" 34 #include "media/capture/video/mac/video_capture_device_factory_mac.h"
35 #endif 35 #endif
36 36
37 #if defined(OS_ANDROID) 37 #if defined(OS_ANDROID)
38 #include "base/android/jni_android.h" 38 #include "base/android/jni_android.h"
39 #include "media/capture/video/android/video_capture_device_android.h" 39 #include "media/capture/video/android/video_capture_device_android.h"
40 #endif 40 #endif
41 41
42 #if defined(OS_MACOSX) 42 #if defined(OS_MACOSX)
43 // Mac/QTKit will always give you the size you ask for and this case will fail. 43 // We will always get YUYV from the Mac AVFoundation implementations.
44 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize
45 // We will always get YUYV from the Mac QTKit/AVFoundation implementations.
46 #define MAYBE_CaptureMjpeg DISABLED_CaptureMjpeg 44 #define MAYBE_CaptureMjpeg DISABLED_CaptureMjpeg
47 #elif defined(OS_WIN) 45 #elif defined(OS_WIN)
48 #define MAYBE_AllocateBadSize AllocateBadSize 46 #define MAYBE_AllocateBadSize AllocateBadSize
49 #define MAYBE_CaptureMjpeg CaptureMjpeg 47 #define MAYBE_CaptureMjpeg CaptureMjpeg
50 #elif defined(OS_ANDROID) 48 #elif defined(OS_ANDROID)
51 // TODO(wjia): enable those tests on Android. 49 // TODO(wjia): enable those tests on Android.
52 // On Android, native camera (JAVA) delivers frames on UI thread which is the 50 // On Android, native camera (JAVA) delivers frames on UI thread which is the
53 // main thread for tests. This results in no frame received by 51 // main thread for tests. This results in no frame received by
54 // VideoCaptureAndroid. 52 // VideoCaptureAndroid.
55 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize 53 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 #endif 262 #endif
265 263
266 TEST_F(VideoCaptureDeviceTest, MAYBE_OpenInvalidDevice) { 264 TEST_F(VideoCaptureDeviceTest, MAYBE_OpenInvalidDevice) {
267 #if defined(OS_WIN) 265 #if defined(OS_WIN)
268 VideoCaptureDevice::Name::CaptureApiType api_type = 266 VideoCaptureDevice::Name::CaptureApiType api_type =
269 VideoCaptureDeviceFactoryWin::PlatformSupportsMediaFoundation() 267 VideoCaptureDeviceFactoryWin::PlatformSupportsMediaFoundation()
270 ? VideoCaptureDevice::Name::MEDIA_FOUNDATION 268 ? VideoCaptureDevice::Name::MEDIA_FOUNDATION
271 : VideoCaptureDevice::Name::DIRECT_SHOW; 269 : VideoCaptureDevice::Name::DIRECT_SHOW;
272 VideoCaptureDevice::Name device_name("jibberish", "jibberish", api_type); 270 VideoCaptureDevice::Name device_name("jibberish", "jibberish", api_type);
273 #elif defined(OS_MACOSX) 271 #elif defined(OS_MACOSX)
274 VideoCaptureDevice::Name device_name( 272 VideoCaptureDevice::Name device_name("jibberish", "jibberish",
275 "jibberish", "jibberish", AVFoundationGlue::IsAVFoundationSupported() 273 VideoCaptureDevice::Name::AVFOUNDATION);
276 ? VideoCaptureDevice::Name::AVFOUNDATION
277 : VideoCaptureDevice::Name::QTKIT);
278 #else 274 #else
279 VideoCaptureDevice::Name device_name("jibberish", "jibberish"); 275 VideoCaptureDevice::Name device_name("jibberish", "jibberish");
280 #endif 276 #endif
281 scoped_ptr<VideoCaptureDevice> device = 277 scoped_ptr<VideoCaptureDevice> device =
282 video_capture_device_factory_->Create(device_name); 278 video_capture_device_factory_->Create(device_name);
283 #if !defined(OS_MACOSX)
284 EXPECT_TRUE(device == NULL); 279 EXPECT_TRUE(device == NULL);
285 #else
286 if (AVFoundationGlue::IsAVFoundationSupported()) {
287 EXPECT_TRUE(device == NULL);
288 } else {
289 // The presence of the actual device is only checked on AllocateAndStart()
290 // and not on creation for QTKit API in Mac OS X platform.
291 EXPECT_CALL(*client_, OnError(_, _)).Times(1);
292
293 VideoCaptureParams capture_params;
294 capture_params.requested_format.frame_size.SetSize(640, 480);
295 capture_params.requested_format.frame_rate = 30;
296 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420;
297 device->AllocateAndStart(capture_params, std::move(client_));
298 device->StopAndDeAllocate();
299 }
300 #endif
301 } 280 }
302 281
303 TEST_P(VideoCaptureDeviceTest, CaptureWithSize) { 282 TEST_P(VideoCaptureDeviceTest, CaptureWithSize) {
304 names_ = EnumerateDevices(); 283 names_ = EnumerateDevices();
305 if (names_->empty()) { 284 if (names_->empty()) {
306 VLOG(1) << "No camera available. Exiting test."; 285 VLOG(1) << "No camera available. Exiting test.";
307 return; 286 return;
308 } 287 }
309 288
310 const gfx::Size& size = GetParam(); 289 const gfx::Size& size = GetParam();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // GetDeviceSupportedFormats(). 459 // GetDeviceSupportedFormats().
481 scoped_ptr<VideoCaptureDevice::Name> name = 460 scoped_ptr<VideoCaptureDevice::Name> name =
482 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); 461 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX);
483 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else 462 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else
484 // to test here 463 // to test here
485 // since we cannot forecast the hardware capabilities. 464 // since we cannot forecast the hardware capabilities.
486 ASSERT_FALSE(name); 465 ASSERT_FALSE(name);
487 } 466 }
488 467
489 }; // namespace media 468 }; // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698