Improved error message when capture device is missing.

With this patch the test stops when it doesn't find a camera instead of crashing with a large hard-to-read stack trace.

BUG=None
TEST=vie_auto_test --automated in Debug+Release on lin, mac, win

Review URL: https://webrtc-codereview.appspot.com/497003

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2077 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kjellander@webrtc.org
2012-04-20 08:10:37 +00:00
parent b61f1fa675
commit 4e645ee783

View File

@ -123,10 +123,12 @@ void ViEAutoTest::ViECaptureStandardTest()
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
webrtc::VideoCaptureFactory::CreateDeviceInfo(0);
ASSERT_TRUE(devInfo != NULL);
int numberOfCaptureDevices = devInfo->NumberOfDevices();
ViETest::Log("Number of capture devices %d", numberOfCaptureDevices);
EXPECT_GT(numberOfCaptureDevices, 0);
ASSERT_GT(numberOfCaptureDevices, 0)
<< "This test requires a capture device (i.e. a webcam)";
int captureDeviceId[10];
memset(captureDeviceId, 0, sizeof(captureDeviceId));
@ -296,7 +298,9 @@ void ViEAutoTest::ViECaptureAPITest()
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
webrtc::VideoCaptureFactory::CreateDeviceInfo(0);
EXPECT_TRUE(devInfo != NULL);
ASSERT_TRUE(devInfo != NULL);
ASSERT_GT(devInfo->NumberOfDevices(), 0u)
<< "This test requires a capture device (i.e. a webcam)";
// Get the first capture device
EXPECT_EQ(0, devInfo->GetDeviceName(0, deviceName,