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

Side by Side Diff: media/video/capture/mac/video_capture_device_factory_mac_unittest.mm

Issue 294893006: VideoCaptureDeviceFactory: Change device enumeration to callback + QTKit enumerates in UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: QTKit/AVFoundation Factory create of inexistent device and associated unit tests Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
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 "media/base/media_switches.h" 7 #include "media/base/media_switches.h"
7 #import "media/video/capture/mac/avfoundation_glue.h" 8 #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_factory_mac.h"
9 #include "media/video/capture/mac/video_capture_device_mac.h" 10 #include "media/video/capture/mac/video_capture_device_mac.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 namespace media { 13 namespace media {
13 14
14 class VideoCaptureDeviceFactoryMacTest : public testing::Test { 15 class VideoCaptureDeviceFactoryMacTest : public testing::Test {
15 virtual void SetUp() { 16 virtual void SetUp() {
16 CommandLine::ForCurrentProcess()->AppendSwitch( 17 CommandLine::ForCurrentProcess()->AppendSwitch(
17 switches::kEnableAVFoundation); 18 switches::kEnableAVFoundation);
18 } 19 }
19 }; 20 };
20 21
21 TEST_F(VideoCaptureDeviceFactoryMacTest, ListDevicesAVFoundation) { 22 TEST_F(VideoCaptureDeviceFactoryMacTest, ListDevicesAVFoundation) {
22 if (!AVFoundationGlue::IsAVFoundationSupported()) { 23 if (!AVFoundationGlue::IsAVFoundationSupported()) {
23 DVLOG(1) << "AVFoundation not supported, skipping test."; 24 DVLOG(1) << "AVFoundation not supported, skipping test.";
24 return; 25 return;
25 } 26 }
26 VideoCaptureDeviceFactoryMac video_capture_device_factory; 27 VideoCaptureDeviceFactoryMac video_capture_device_factory(
28 base::MessageLoopProxy::current());
27 29
28 VideoCaptureDevice::Names names; 30 VideoCaptureDevice::Names names;
29 video_capture_device_factory.GetDeviceNames(&names); 31 video_capture_device_factory.GetDeviceNames(&names);
30 if (!names.size()) { 32 if (!names.size()) {
31 DVLOG(1) << "No camera available. Exiting test."; 33 DVLOG(1) << "No camera available. Exiting test.";
32 return; 34 return;
33 } 35 }
34 // There should be no blacklisted devices, i.e. QTKit. 36 // There should be no blacklisted devices, i.e. QTKit.
35 std::string device_vid; 37 std::string device_vid;
36 for (VideoCaptureDevice::Names::const_iterator it = names.begin(); 38 for (VideoCaptureDevice::Names::const_iterator it = names.begin();
37 it != names.end(); ++it) { 39 it != names.end(); ++it) {
38 EXPECT_EQ(it->capture_api_type(), VideoCaptureDevice::Name::AVFOUNDATION); 40 EXPECT_EQ(it->capture_api_type(), VideoCaptureDevice::Name::AVFOUNDATION);
39 } 41 }
40 } 42 }
41 43
42 }; // namespace media 44 }; // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698