Fixed test to not fail behind firewalls or without an internet

connection.
This commit is contained in:
Patrik Stridvall 2002-10-09 18:12:20 +00:00 committed by Alexandre Julliard
parent 91a3686853
commit 137fa2be84
1 changed files with 31 additions and 8 deletions

View File

@ -90,6 +90,8 @@ void winapi_test(int flags)
ok((hi != 0x0),"InternetOpen Failed");
trace("InternetOpenA -->\n");
if (hi == 0x0) goto abort;
InternetSetStatusCallback(hi,&callback);
trace("InternetConnectA <--\n");
@ -97,6 +99,8 @@ void winapi_test(int flags)
ok((hic != 0x0),"InternetConnect Failed");
trace("InternetConnectA -->\n");
if (hic == 0x0) goto abort;
types = (char*)malloc(100);
strcpy(types,"*");
@ -104,10 +108,20 @@ void winapi_test(int flags)
hor = HttpOpenRequestA(hic, "GET",
"/about/",
0x0,0x0,(const char**)&types,0x00400800,0xdeadbead);
if (hor == 0x0 && GetLastError() == 12007 /* ERROR_INTERNET_NAME_NOT_RESOLVED */) {
/*
* If the internet name can't be resolved we are probably behind
* a firewall or in some other way not directly connected to the
* Internet. Not enough reason to fail the test. Just ignore and
* abort.
*/
} else {
ok((hor != 0x0),"HttpOpenRequest Failed");
}
trace("HttpOpenRequestA -->\n");
if (hor == 0x0) goto abort;
trace("HttpSendRequestA -->\n");
rc = HttpSendRequestA(hor, "", 0xffffffff,0x0,0x0);
if (flags)
@ -170,13 +184,22 @@ void winapi_test(int flags)
HeapFree(GetProcessHeap(),0,buffer);
}
}
rc = InternetCloseHandle(hi);
ok ((rc != 0), "InternetCloseHandle failed");
abort:
if (hor != 0x0) {
rc = InternetCloseHandle(hor);
ok ((rc != 0), "InternetCloseHandle failed");
ok ((rc != 0), "InternetCloseHandle of handle opened by HttpOpenRequestA failed");
}
if (hor != 0x0) {
rc = InternetCloseHandle(hic);
ok ((rc != 0), "InternetCloseHandle of handle opened by InternetConnectA failed");
}
if (hi != 0x0) {
rc = InternetCloseHandle(hi);
ok ((rc != 0), "InternetCloseHandle of handle opened by InternetOpenA failed");
if (flags)
Sleep(100);
}
}
START_TEST(http)