From c56eec22e2ad93de1b1d10490b293af2e9486997 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 21 Sep 2006 12:44:56 +0200 Subject: [PATCH] wininet/tests: Don't fail the tests if the network is unreachable. --- dlls/wininet/tests/http.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 404d705132b..ff4526dd749 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -591,7 +591,12 @@ static void HttpSendRequestEx_test(void) ok( hConnect != NULL, "Unable to connect to http://crossover.codeweavers.com\n"); hRequest = HttpOpenRequest(hConnect, "POST", "/posttest.php", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0); - ok( hRequest != NULL, "Failed to open request handle\n"); + if (!hRequest && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED) + { + trace( "Network unreachable, skipping test\n" ); + goto done; + } + ok( hRequest != NULL, "Failed to open request handle err %lx\n", GetLastError()); BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS); @@ -622,6 +627,7 @@ static void HttpSendRequestEx_test(void) ok(strncmp(szBuffer,"mode => Test\n",dwBytesRead)==0,"Got string %s\n",szBuffer); ok(InternetCloseHandle(hRequest), "Close request handle failed\n"); +done: ok(InternetCloseHandle(hConnect), "Close connect handle failed\n"); ok(InternetCloseHandle(hSession), "Close session handle failed\n"); } @@ -644,6 +650,11 @@ static void HttpHeaders_test(void) ok( hConnect != NULL, "Unable to connect to http://crossover.codeweavers.com\n"); hRequest = HttpOpenRequest(hConnect, "POST", "/posttest.php", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0); + if (!hRequest && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED) + { + trace( "Network unreachable, skipping test\n" ); + goto done; + } ok( hRequest != NULL, "Failed to open request handle\n"); index = 0; @@ -799,6 +810,7 @@ static void HttpHeaders_test(void) ok(InternetCloseHandle(hRequest), "Close request handle failed\n"); +done: ok(InternetCloseHandle(hConnect), "Close connect handle failed\n"); ok(InternetCloseHandle(hSession), "Close session handle failed\n"); } -- 2.11.4.GIT