Revert 3105 - 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

TBR=tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/936026

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3111 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mikhal@webrtc.org 2012-11-15 23:38:27 +00:00
parent 37ff69d608
commit 01c4b98f90
4 changed files with 17 additions and 28 deletions

View File

@ -36,19 +36,17 @@ void FindCaptureDeviceOnSystem(webrtc::ViECapture* capture,
*device_video = webrtc::VideoCaptureFactory::Create(4571, unique_id); *device_video = webrtc::VideoCaptureFactory::Create(4571, unique_id);
EXPECT_TRUE(*device_video != NULL); EXPECT_TRUE(*device_video != NULL);
if (*device_video) { (*device_video)->AddRef();
(*device_video)->AddRef();
int error = capture->AllocateCaptureDevice(**device_video, *device_id); int error = capture->AllocateCaptureDevice(**device_video, *device_id);
if (error == 0) { if (error == 0) {
ViETest::Log("Using capture device: %s, captureId: %d.", ViETest::Log("Using capture device: %s, captureId: %d.",
device_name, *device_id); device_name, *device_id);
capture_device_set = true; capture_device_set = true;
break; break;
} else { } else {
(*device_video)->Release(); (*device_video)->Release();
(*device_video) = NULL; (*device_video) = NULL;
}
} }
} }
delete dev_info; delete dev_info;

View File

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

View File

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

View File

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