Commit 601b3b27 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

urlmon: Fix race in protocol tests.

The value of *called is set asynchronously and so the callback function could be called after IInternetProtocol_Read returns E_PENDING. The value of *called is only predictable after the WaitForSingleObject call returns. Therefore, remove the checks on *called before this call.
parent 4730205f
......@@ -1557,7 +1557,6 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_first)
if(SUCCEEDED(hres)) {
BYTE buf[3600];
DWORD cb;
int *called = (bindf & BINDF_FROMURLMON) ? &called_Switch : &called_ReportData;
test_priority(http_protocol);
......@@ -1579,8 +1578,8 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_first)
expect_hrResult = S_OK;
hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
ok((!*called && hres == E_PENDING && cb==0) ||
(*called && hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
ok((hres == E_PENDING && cb==0) ||
(hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE);
if(bindf & BINDF_FROMURLMON)
......@@ -1596,8 +1595,8 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_first)
hres = IInternetProtocol_Read(http_protocol, buf, sizeof(buf), &cb);
if(hres == E_PENDING) {
hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
ok((!*called && hres == E_PENDING && cb==0) ||
(*called && hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
ok((hres == E_PENDING && cb==0) ||
(hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
WaitForSingleObject(event_complete, INFINITE);
if(bindf & BINDF_FROMURLMON)
CHECK_CALLED(Switch);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment