Module: wine Branch: master Commit: d4a7a9d43dad1e63d411f3e7454948a7256115f1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d4a7a9d43dad1e63d411f3e745...
Author: Hans Leidekker hans@codeweavers.com Date: Tue Dec 22 14:32:56 2009 +0100
wininet: Avoid test failures on win9x.
---
dlls/wininet/tests/http.c | 32 ++++++++++++++++++++++++++++---- 1 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 345172c..5d57549 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -1754,7 +1754,7 @@ static DWORD CALLBACK server_thread(LPVOID param) static void test_basic_request(int port, const char *verb, const char *url) { HINTERNET hi, hc, hr; - DWORD r, count, error; + DWORD r, count; char buffer[0x100];
hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); @@ -1766,11 +1766,8 @@ static void test_basic_request(int port, const char *verb, const char *url) hr = HttpOpenRequest(hc, verb, url, NULL, NULL, NULL, 0, 0); ok(hr != NULL, "HttpOpenRequest failed\n");
- SetLastError(0xdeadbeef); r = HttpSendRequest(hr, NULL, 0, NULL, 0); - error = GetLastError(); ok(r, "HttpSendRequest failed\n"); - ok(error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", error);
count = 0; memset(buffer, 0, sizeof buffer); @@ -1784,6 +1781,32 @@ static void test_basic_request(int port, const char *verb, const char *url) InternetCloseHandle(hi); }
+static void test_last_error(int port) +{ + HINTERNET hi, hc, hr; + DWORD error; + BOOL r; + + hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); + ok(hi != NULL, "open failed\n"); + + hc = InternetConnect(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); + ok(hc != NULL, "connect failed\n"); + + hr = HttpOpenRequest(hc, NULL, "/test1", NULL, NULL, NULL, 0, 0); + ok(hr != NULL, "HttpOpenRequest failed\n"); + + SetLastError(0xdeadbeef); + r = HttpSendRequest(hr, NULL, 0, NULL, 0); + error = GetLastError(); + ok(r, "HttpSendRequest failed\n"); + ok(error == ERROR_SUCCESS || broken(error != ERROR_SUCCESS), "expected ERROR_SUCCESS, got %u\n", error); + + InternetCloseHandle(hr); + InternetCloseHandle(hc); + InternetCloseHandle(hi); +} + static void test_proxy_indirect(int port) { HINTERNET hi, hc, hr; @@ -2427,6 +2450,7 @@ static void test_http_connection(void) test_response_without_headers(si.port); test_HttpQueryInfo(si.port); test_HttpSendRequestW(si.port); + test_last_error(si.port);
/* send the basic request again to shutdown the server thread */ test_basic_request(si.port, "GET", "/quit");