Module: wine Branch: master Commit: 87f0ba49e06719751f00ffed363e157509bb33ea URL: http://source.winehq.org/git/wine.git/?a=commit;h=87f0ba49e06719751f00ffed36...
Author: Jacek Caban jacek@codeweavers.com Date: Sat Dec 25 21:32:11 2010 +0100
urlmon: Fixed a race in tests causing unexpected Switch call failures.
---
dlls/urlmon/tests/protocol.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c index e463737..dd8cbf9 100644 --- a/dlls/urlmon/tests/protocol.c +++ b/dlls/urlmon/tests/protocol.c @@ -41,7 +41,6 @@ static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
#define CHECK_EXPECT2(func) \ do { \ - trace(#func "\n"); /* temporary debug traces */ \ ok(expect_ ##func, "unexpected call " #func "\n"); \ called_ ## func = TRUE; \ }while(0) @@ -864,12 +863,16 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR else SET_EXPECT(ReportData2); SET_EXPECT(ReportResult); + if(!emulate_prot) + SET_EXPECT(Switch); 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) 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); - } + if(!emulate_prot && hres != E_PENDING) + CHECK_NOT_CALLED(Switch); /* otherwise checked in wait_for_switch loop */ if(emulate_prot) CHECK_CALLED(Read); 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;
if(direct_read) { + SET_EXPECT(Switch); while(wait_for_switch) { - SET_EXPECT(Switch); WaitForSingleObject(event_continue, INFINITE); - CHECK_CALLED(Switch); + CHECK_CALLED(Switch); /* Set in ReportData */ call_continue(&continue_protdata); SetEvent(event_continue_done); }