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.
This commit is contained in:
parent
4730205ffb
commit
601b3b2732
|
@ -1557,7 +1557,6 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_first)
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres)) {
|
||||||
BYTE buf[3600];
|
BYTE buf[3600];
|
||||||
DWORD cb;
|
DWORD cb;
|
||||||
int *called = (bindf & BINDF_FROMURLMON) ? &called_Switch : &called_ReportData;
|
|
||||||
|
|
||||||
test_priority(http_protocol);
|
test_priority(http_protocol);
|
||||||
|
|
||||||
|
@ -1579,8 +1578,8 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_first)
|
||||||
expect_hrResult = S_OK;
|
expect_hrResult = S_OK;
|
||||||
|
|
||||||
hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
|
hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
|
||||||
ok((!*called && hres == E_PENDING && cb==0) ||
|
ok((hres == E_PENDING && cb==0) ||
|
||||||
(*called && hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
|
(hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
|
||||||
|
|
||||||
WaitForSingleObject(event_complete, INFINITE);
|
WaitForSingleObject(event_complete, INFINITE);
|
||||||
if(bindf & BINDF_FROMURLMON)
|
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);
|
hres = IInternetProtocol_Read(http_protocol, buf, sizeof(buf), &cb);
|
||||||
if(hres == E_PENDING) {
|
if(hres == E_PENDING) {
|
||||||
hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
|
hres = IInternetProtocol_Read(http_protocol, buf, 1, &cb);
|
||||||
ok((!*called && hres == E_PENDING && cb==0) ||
|
ok((hres == E_PENDING && cb==0) ||
|
||||||
(*called && hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
|
(hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
|
||||||
WaitForSingleObject(event_complete, INFINITE);
|
WaitForSingleObject(event_complete, INFINITE);
|
||||||
if(bindf & BINDF_FROMURLMON)
|
if(bindf & BINDF_FROMURLMON)
|
||||||
CHECK_CALLED(Switch);
|
CHECK_CALLED(Switch);
|
||||||
|
|
Loading…
Reference in New Issue