From 4e645ee78303c75bb27ade8cfdcf4ebd2f781210 Mon Sep 17 00:00:00 2001 From: "kjellander@webrtc.org" Date: Fri, 20 Apr 2012 08:10:37 +0000 Subject: [PATCH] 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 --- .../test/auto_test/source/vie_autotest_capture.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/video_engine/test/auto_test/source/vie_autotest_capture.cc b/src/video_engine/test/auto_test/source/vie_autotest_capture.cc index 0b4092a7eb..fb3cdb4ce7 100644 --- a/src/video_engine/test/auto_test/source/vie_autotest_capture.cc +++ b/src/video_engine/test/auto_test/source/vie_autotest_capture.cc @@ -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,