Jacek Caban : wininet: Added 204 No Content response tests.
Alexandre Julliard
julliard at winehq.org
Fri May 13 11:17:52 CDT 2011
Module: wine
Branch: master
Commit: 5a5eddfe81d04efdc4e608c69c554a8b7dc8074d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5a5eddfe81d04efdc4e608c69c554a8b7dc8074d
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri May 13 13:49:00 2011 +0200
wininet: Added 204 No Content response tests.
---
dlls/wininet/tests/http.c | 63 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index a754dd7..b1b310c 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -1760,6 +1760,11 @@ static DWORD CALLBACK server_thread(LPVOID param)
else
send(c, notokmsg, sizeof notokmsg-1, 0);
}
+ if (strstr(buffer, "GET /test_no_content"))
+ {
+ static const char nocontentmsg[] = "HTTP/1.1 204 No Content\r\nConnection: close\r\n\r\n";
+ send(c, nocontentmsg, sizeof(nocontentmsg)-1, 0);
+ }
shutdown(c, 2);
closesocket(c);
@@ -2112,6 +2117,63 @@ static void test_http1_1(int port)
InternetCloseHandle(ses);
}
+static void test_no_content(int port)
+{
+ HINTERNET session, connection, req;
+ DWORD res;
+
+ trace("Testing 204 no content response...\n");
+
+ hCompleteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+
+ session = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC);
+ ok(session != NULL,"InternetOpen failed with error %u\n", GetLastError());
+
+ pInternetSetStatusCallbackA(session, callback);
+
+ SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
+ connection = InternetConnectA(session, "localhost", port,
+ NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef);
+ ok(connection != NULL,"InternetConnect failed with error %u\n", GetLastError());
+ CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
+
+ SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
+ req = HttpOpenRequestA(connection, "GET", "/test_no_content", NULL, NULL, NULL,
+ INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_RESYNCHRONIZE, 0xdeadbead);
+ ok(req != NULL, "HttpOpenRequest failed: %u\n", GetLastError());
+ CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
+
+ SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
+ SET_EXPECT(INTERNET_STATUS_CONNECTING_TO_SERVER);
+ SET_EXPECT(INTERNET_STATUS_CONNECTED_TO_SERVER);
+ SET_EXPECT(INTERNET_STATUS_SENDING_REQUEST);
+ SET_EXPECT(INTERNET_STATUS_REQUEST_SENT);
+ SET_EXPECT(INTERNET_STATUS_RECEIVING_RESPONSE);
+ SET_EXPECT(INTERNET_STATUS_RESPONSE_RECEIVED);
+ SET_EXPECT(INTERNET_STATUS_CLOSING_CONNECTION);
+ SET_EXPECT(INTERNET_STATUS_CONNECTION_CLOSED);
+ SET_EXPECT(INTERNET_STATUS_REQUEST_COMPLETE);
+
+ res = HttpSendRequestA(req, NULL, -1, NULL, 0);
+ ok(!res && (GetLastError() == ERROR_IO_PENDING),
+ "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
+ WaitForSingleObject(hCompleteEvent, INFINITE);
+
+ CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
+ CHECK_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
+ CHECK_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER);
+ CHECK_NOTIFIED(INTERNET_STATUS_SENDING_REQUEST);
+ CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_SENT);
+ CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
+ CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
+ CHECK_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
+ CHECK_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
+ CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
+
+ close_async_handle(session, hCompleteEvent, 2);
+ CloseHandle(hCompleteEvent);
+}
+
static void test_HttpSendRequestW(int port)
{
static const WCHAR header[] = {'U','A','-','C','P','U',':',' ','x','8','6',0};
@@ -2645,6 +2707,7 @@ static void test_http_connection(void)
test_last_error(si.port);
test_options(si.port);
test_url_caching(si.port, &si.num_testH_retrievals);
+ test_no_content(si.port);
/* send the basic request again to shutdown the server thread */
test_basic_request(si.port, "GET", "/quit");
More information about the wine-cvs
mailing list