1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/command_line.h"
6 #include "media/base/media_switches.h"
7 #import "media/video/capture/mac/avfoundation_glue.h"
8 #include "media/video/capture/mac/video_capture_device_factory_mac.h"
9 #include "media/video/capture/mac/video_capture_device_mac.h"
10 #include "testing/gtest/include/gtest/gtest.h"
14 class VideoCaptureDeviceFactoryMacTest : public testing::Test {
15 virtual void SetUp() {
16 CommandLine::ForCurrentProcess()->AppendSwitch(
17 switches::kEnableAVFoundation);
21 TEST_F(VideoCaptureDeviceFactoryMacTest, ListDevicesAVFoundation) {
22 if (!AVFoundationGlue::IsAVFoundationSupported()) {
23 DVLOG(1) << "AVFoundation not supported, skipping test.";
26 VideoCaptureDeviceFactoryMac video_capture_device_factory;
28 VideoCaptureDevice::Names names;
29 video_capture_device_factory.GetDeviceNames(&names);
31 DVLOG(1) << "No camera available. Exiting test.";
34 // There should be no blacklisted devices, i.e. QTKit.
35 std::string device_vid;
36 for (VideoCaptureDevice::Names::const_iterator it = names.begin();
37 it != names.end(); ++it) {
38 EXPECT_EQ(it->capture_api_type(), VideoCaptureDevice::Name::AVFOUNDATION);