Don't crash the unit test host when tests fail.

Instead, just report the error, fail, and move on.

TEST=Run vie_auto_test, option=1.
    On my machine most of the tests fail for some reason
    that I'm still investigating, but the tests shouldn't
    be crashing the process which is what I'm fixing here.
Review URL: https://webrtc-codereview.appspot.com/929019

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3105 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tommi@webrtc.org 2012-11-15 14:38:10 +00:00
parent 2d0b81b8af
commit 5ea70e619e
4 changed files with 28 additions and 17 deletions

View File

@ -36,6 +36,7 @@ void FindCaptureDeviceOnSystem(webrtc::ViECapture* capture,
*device_video = webrtc::VideoCaptureFactory::Create(4571, unique_id);
EXPECT_TRUE(*device_video != NULL);
if (*device_video) {
(*device_video)->AddRef();
int error = capture->AllocateCaptureDevice(**device_video, *device_id);
@ -49,6 +50,7 @@ void FindCaptureDeviceOnSystem(webrtc::ViECapture* capture,
(*device_video) = NULL;
}
}
}
delete dev_info;
EXPECT_TRUE(capture_device_set) << "Found no suitable camera on your system.";
}

View File

@ -28,7 +28,7 @@ void ViEAutoTest::ViEBaseStandardTest() {
int video_channel = -1;
EXPECT_EQ(0, interfaces.base->CreateChannel(video_channel));
webrtc::VideoCaptureModule* video_capture_module(NULL);
webrtc::VideoCaptureModule* video_capture_module = NULL;
const unsigned int kMaxDeviceNameLength = 128;
char device_name[kMaxDeviceNameLength];
memset(device_name, 0, kMaxDeviceNameLength);
@ -44,6 +44,10 @@ void ViEAutoTest::ViEBaseStandardTest() {
&capture_id,
&video_capture_module);
EXPECT_TRUE(video_capture_module);
if (!video_capture_module)
return;
EXPECT_EQ(0, capture_interface->ConnectCaptureDevice(capture_id,
video_channel));
EXPECT_EQ(0, capture_interface->StartCapture(capture_id));

View File

@ -121,10 +121,10 @@ void ViEAutoTest::ViECaptureStandardTest() {
ASSERT_GT(number_of_capture_devices, 0)
<< "This test requires a capture device (i.e. a webcam)";
int capture_device_id[10];
memset(capture_device_id, 0, sizeof(capture_device_id));
webrtc::VideoCaptureModule* vcpms[10];
memset(vcpms, 0, sizeof(vcpms));
#if !defined(WEBRTC_MAC)
int capture_device_id[10] = {0};
webrtc::VideoCaptureModule* vcpms[10] = {0};
#endif
// Check capabilities
for (int device_index = 0; device_index < number_of_capture_devices;
@ -179,6 +179,9 @@ void ViEAutoTest::ViECaptureStandardTest() {
webrtc::VideoCaptureModule* vcpm =
webrtc::VideoCaptureFactory::Create(device_index, device_unique_name);
EXPECT_TRUE(vcpm != NULL);
if (!vcpm)
continue;
vcpm->AddRef();
vcpms[device_index] = vcpm;
@ -249,6 +252,7 @@ void ViEAutoTest::ViECaptureStandardTest() {
EXPECT_EQ(0, video_engine.capture->ReleaseCaptureDevice(
capture_device_id[device_index]));
#endif // !WEBRTC_ANDROID
if (vcpms[device_index])
vcpms[device_index]->Release();
}
#endif // !WEBRTC_MAC

View File

@ -66,6 +66,7 @@ TbCaptureDevice::~TbCaptureDevice(void)
{
EXPECT_EQ(0, ViE.capture->StopCapture(captureId));
EXPECT_EQ(0, ViE.capture->ReleaseCaptureDevice(captureId));
if (vcpm_)
vcpm_->Release();
}