urlmon/tests: Avoid infinite timeouts in tests.

This commit is contained in:
Alexandre Julliard 2013-01-29 16:01:23 +01:00
parent cf0334b654
commit 9d8e5651eb
2 changed files with 23 additions and 19 deletions

View File

@ -668,12 +668,12 @@ static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOL
if(binding_test) {
SetEvent(event_complete);
WaitForSingleObject(event_complete2, INFINITE);
ok( WaitForSingleObject(event_complete2, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
return S_OK;
}if(direct_read) {
continue_protdata = *pProtocolData;
SetEvent(event_continue);
WaitForSingleObject(event_continue_done, INFINITE);
ok( WaitForSingleObject(event_continue_done, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
}else {
call_continue(pProtocolData);
SetEvent(event_complete);
@ -2935,7 +2935,7 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
if(direct_read) {
SET_EXPECT(Switch);
while(wait_for_switch) {
WaitForSingleObject(event_continue, INFINITE);
ok( WaitForSingleObject(event_continue, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
CHECK_CALLED(Switch); /* Set in ReportData */
call_continue(&continue_protdata);
SetEvent(event_continue_done);
@ -2945,7 +2945,7 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
ok((hres == E_PENDING && cb==0) ||
(hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE);
ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(bindf & BINDF_FROMURLMON)
CHECK_CALLED(Switch);
else
@ -2963,7 +2963,7 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
ok((hres == E_PENDING && cb==0) ||
(hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE);
ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(bindf & BINDF_FROMURLMON)
CHECK_CALLED(Switch);
else
@ -3139,12 +3139,16 @@ static void test_ftp_protocol(void)
ok((hres == E_PENDING && cb==0) ||
(hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE);
ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
while(1) {
hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
if(hres == E_PENDING)
WaitForSingleObject(event_complete, INFINITE);
{
DWORD ret = WaitForSingleObject(event_complete, 90000);
ok( ret == WAIT_OBJECT_0, "wait timed out\n" );
if (ret != WAIT_OBJECT_0) break;
}
else
if(cb == 0) break;
}
@ -3522,7 +3526,7 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
if(prot == HTTP_TEST || prot == HTTPS_TEST) {
while(prot_state < 4) {
WaitForSingleObject(event_complete, INFINITE);
ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(mimefilter_test && filtered_protocol) {
SET_EXPECT(Continue);
IInternetProtocol_Continue(filtered_protocol, pdata);
@ -3547,7 +3551,7 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
}
if(direct_read)
CHECK_CALLED(ReportData); /* Set in ReportResult */
WaitForSingleObject(event_complete, INFINITE);
ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
}else {
if(mimefilter_test)
SET_EXPECT(MimeFilter_LockRequest);

View File

@ -474,7 +474,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
BINDSTATUS_FINDINGRESOURCE, wszWineHQSite);
ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
if(!no_callback) {
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(bind_to_object)
CHECK_CALLED(Obj_OnProgress_FINDINGRESOURCE);
else
@ -491,7 +491,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
BINDSTATUS_CONNECTING, wszWineHQIP);
ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
if(!no_callback) {
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(bind_to_object)
CHECK_CALLED(Obj_OnProgress_CONNECTING);
else
@ -508,7 +508,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
BINDSTATUS_SENDINGREQUEST, NULL);
ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
if(!no_callback) {
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(bind_to_object)
CHECK_CALLED(Obj_OnProgress_SENDINGREQUEST);
else
@ -522,7 +522,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
SET_EXPECT(OnProgress_REDIRECTING);
hres = IInternetProtocolSink_ReportProgress(protocol_sink, BINDSTATUS_REDIRECTING, winetest_data_urlW);
ok(hres == S_OK, "ReportProgress(BINDSTATUS_REFIRECTING) failed: %08x\n", hres);
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
if(bind_to_object)
CHECK_CALLED(Obj_OnProgress_REDIRECTING);
else
@ -535,7 +535,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
prot_state = 1;
hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
ok(hres == S_OK, "Switch failed: %08x\n", hres);
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
CHECK_CALLED(Continue);
CHECK_CALLED(Read);
@ -563,7 +563,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
prot_state = 2;
hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
ok(hres == S_OK, "Switch failed: %08x\n", hres);
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
CHECK_CALLED(Continue);
if(test_abort) {
CHECK_CALLED(OnProgress_DOWNLOADINGDATA);
@ -582,7 +582,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
prot_state = 2;
hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
ok(hres == S_OK, "Switch failed: %08x\n", hres);
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
CHECK_CALLED(Continue);
CHECK_CALLED(Read);
if(!no_callback) {
@ -594,7 +594,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
prot_state = 3;
hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
ok(hres == S_OK, "Switch failed: %08x\n", hres);
WaitForSingleObject(complete_event, INFINITE);
ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
CHECK_CALLED(Continue);
CHECK_CALLED(Read);
if(!no_callback) {
@ -1947,7 +1947,7 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRES
if((test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == WINETEST_TEST) && emulate_protocol) {
SetEvent(complete_event);
if(iface != &objbsc)
WaitForSingleObject(complete_event2, INFINITE);
ok( WaitForSingleObject(complete_event2, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
}
return S_OK;
@ -3008,7 +3008,7 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToStorage failed: %08x\n", hres);
else if(no_callback) {
if(emulate_protocol)
WaitForSingleObject(complete_event2, INFINITE);
ok( WaitForSingleObject(complete_event2, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres);
ok(unk != NULL, "unk == NULL\n");
}else if(!(bindf & BINDF_ASYNCHRONOUS) && tymed == TYMED_FILE) {