urlmon: Fixed a race in tests causing unexpected Switch call failures.

This commit is contained in:
Jacek Caban 2010-12-25 21:32:11 +01:00 committed by Alexandre Julliard
parent a529c4a835
commit 87f0ba49e0
1 changed files with 8 additions and 5 deletions

View File

@ -41,7 +41,6 @@ static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
#define CHECK_EXPECT2(func) \ #define CHECK_EXPECT2(func) \
do { \ do { \
trace(#func "\n"); /* temporary debug traces */ \
ok(expect_ ##func, "unexpected call " #func "\n"); \ ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \ called_ ## func = TRUE; \
}while(0) }while(0)
@ -864,12 +863,16 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
else else
SET_EXPECT(ReportData2); SET_EXPECT(ReportData2);
SET_EXPECT(ReportResult); SET_EXPECT(ReportResult);
if(!emulate_prot)
SET_EXPECT(Switch);
hres = IInternetProtocol_Read(binding_test ? binding_protocol : async_protocol, expect_pv = buf, sizeof(buf), &read); hres = IInternetProtocol_Read(binding_test ? binding_protocol : async_protocol, expect_pv = buf, sizeof(buf), &read);
ok(hres == E_PENDING || hres == S_FALSE || hres == S_OK, "Read failed: %08x\n", hres);
if(hres == S_OK) if(hres == S_OK)
ok(read, "read == 0\n"); ok(read, "read == 0\n");
if(reported_all_data) { if(reported_all_data)
ok(hres == S_FALSE, "Read failed: %08x, expected S_FALSE\n", hres); ok(hres == S_FALSE, "Read failed: %08x, expected S_FALSE\n", hres);
} if(!emulate_prot && hres != E_PENDING)
CHECK_NOT_CALLED(Switch); /* otherwise checked in wait_for_switch loop */
if(emulate_prot) if(emulate_prot)
CHECK_CALLED(Read); CHECK_CALLED(Read);
if(!reported_all_data && called_ReportData2) { if(!reported_all_data && called_ReportData2) {
@ -2763,10 +2766,10 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
expect_hrResult = test_abort ? E_ABORT : S_OK; expect_hrResult = test_abort ? E_ABORT : S_OK;
if(direct_read) { if(direct_read) {
while(wait_for_switch) {
SET_EXPECT(Switch); SET_EXPECT(Switch);
while(wait_for_switch) {
WaitForSingleObject(event_continue, INFINITE); WaitForSingleObject(event_continue, INFINITE);
CHECK_CALLED(Switch); CHECK_CALLED(Switch); /* Set in ReportData */
call_continue(&continue_protdata); call_continue(&continue_protdata);
SetEvent(event_continue_done); SetEvent(event_continue_done);
} }