OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/message_loop/message_loop_proxy.h" | 6 #include "base/message_loop/message_loop.h" |
7 #import "media/base/mac/avfoundation_glue.h" | 7 #import "media/base/mac/avfoundation_glue.h" |
8 #include "media/base/media_switches.h" | 8 #include "media/base/media_switches.h" |
9 #include "media/video/capture/mac/video_capture_device_factory_mac.h" | 9 #include "media/video/capture/mac/video_capture_device_factory_mac.h" |
10 #include "media/video/capture/mac/video_capture_device_mac.h" | 10 #include "media/video/capture/mac/video_capture_device_mac.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 | 14 |
15 class VideoCaptureDeviceFactoryMacTest : public testing::Test { | 15 class VideoCaptureDeviceFactoryMacTest : public testing::Test { |
16 void SetUp() override { | 16 void SetUp() override { |
17 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 17 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
18 switches::kEnableAVFoundation); | 18 switches::kEnableAVFoundation); |
19 } | 19 } |
| 20 |
| 21 private: |
| 22 base::MessageLoop message_loop_; |
20 }; | 23 }; |
21 | 24 |
22 TEST_F(VideoCaptureDeviceFactoryMacTest, ListDevicesAVFoundation) { | 25 TEST_F(VideoCaptureDeviceFactoryMacTest, ListDevicesAVFoundation) { |
23 if (!AVFoundationGlue::IsAVFoundationSupported()) { | 26 if (!AVFoundationGlue::IsAVFoundationSupported()) { |
24 DVLOG(1) << "AVFoundation not supported, skipping test."; | 27 DVLOG(1) << "AVFoundation not supported, skipping test."; |
25 return; | 28 return; |
26 } | 29 } |
27 VideoCaptureDeviceFactoryMac video_capture_device_factory( | 30 VideoCaptureDeviceFactoryMac video_capture_device_factory( |
28 base::MessageLoopProxy::current()); | 31 base::MessageLoopProxy::current()); |
29 | 32 |
30 VideoCaptureDevice::Names names; | 33 VideoCaptureDevice::Names names; |
31 video_capture_device_factory.GetDeviceNames(&names); | 34 video_capture_device_factory.GetDeviceNames(&names); |
32 if (!names.size()) { | 35 if (!names.size()) { |
33 DVLOG(1) << "No camera available. Exiting test."; | 36 DVLOG(1) << "No camera available. Exiting test."; |
34 return; | 37 return; |
35 } | 38 } |
36 // There should be no blacklisted devices, i.e. QTKit. | 39 // There should be no blacklisted devices, i.e. QTKit. |
37 std::string device_vid; | 40 std::string device_vid; |
38 for (VideoCaptureDevice::Names::const_iterator it = names.begin(); | 41 for (VideoCaptureDevice::Names::const_iterator it = names.begin(); |
39 it != names.end(); ++it) { | 42 it != names.end(); ++it) { |
40 EXPECT_EQ(it->capture_api_type(), VideoCaptureDevice::Name::AVFOUNDATION); | 43 EXPECT_EQ(it->capture_api_type(), VideoCaptureDevice::Name::AVFOUNDATION); |
41 } | 44 } |
42 } | 45 } |
43 | 46 |
44 }; // namespace media | 47 }; // namespace media |
OLD | NEW |