Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51631 Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/winhttp/tests/notification.c | 16 ++++++++++++++-- dlls/winhttp/tests/winhttp.c | 19 ++++++++++++++----- 2 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c index 4cfffe6687e..ca2adfb098b 100644 --- a/dlls/winhttp/tests/notification.c +++ b/dlls/winhttp/tests/notification.c @@ -660,6 +660,7 @@ static const struct notification websocket_test[] = { winhttp_websocket_complete_upgrade, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, NF_SIGNAL }, { winhttp_websocket_send, WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, NF_SIGNAL }, { winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SIGNAL }, + { winhttp_websocket_receive, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SIGNAL }, { winhttp_websocket_shutdown, WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE, NF_SIGNAL }, { winhttp_websocket_close, WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE, NF_SIGNAL }, { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING }, @@ -715,7 +716,7 @@ static void test_websocket(void)
setup_test( &info, winhttp_connect, __LINE__ ); SetLastError( 0xdeadbeef ); - connection = WinHttpConnect( session, L"echo.websocket.org", 0, 0 ); + connection = WinHttpConnect( session, L"ws.ifelse.io", 0, 0 ); err = GetLastError(); ok( connection != NULL, "got %u\n", err); ok( err == ERROR_SUCCESS || broken(err == WSAEINVAL) /* < win7 */, "got %u\n", err ); @@ -785,7 +786,18 @@ static void test_websocket(void) WaitForSingleObject( info.wait, INFINITE ); ok( size == 0xdeadbeef, "got %u\n", size ); ok( type == 0xdeadbeef, "got %u\n", type ); - ok( buffer[0], "unexpected data\n" ); + ok( buffer[0] == 'R', "unexpected data\n" ); + + setup_test( &info, winhttp_websocket_receive, __LINE__ ); + buffer[0] = 0; + size = 0xdeadbeef; + type = 0xdeadbeef; + err = pWinHttpWebSocketReceive( socket, buffer, sizeof(buffer), &size, &type ); + ok( err == ERROR_SUCCESS, "got %u\n", err ); + WaitForSingleObject( info.wait, INFINITE ); + ok( size == 0xdeadbeef, "got %u\n", size ); + ok( type == 0xdeadbeef, "got %u\n", type ); + ok( buffer[0] == 'h', "unexpected data\n" );
setup_test( &info, winhttp_websocket_shutdown, __LINE__ ); err = pWinHttpWebSocketShutdown( socket, 1000, (void *)"success", sizeof("success") ); diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 60204f6536f..ab8b444ad3f 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -3291,7 +3291,7 @@ static void test_websocket(int port) session = WinHttpOpen(L"winetest", 0, NULL, NULL, 0); ok(session != NULL, "got %u\n", GetLastError());
- connection = WinHttpConnect(session, L"echo.websocket.org", 0, 0); + connection = WinHttpConnect(session, L"ws.ifelse.io", 0, 0); ok(connection != NULL, "got %u\n", GetLastError());
request = WinHttpOpenRequest(connection, L"GET", L"/", NULL, NULL, NULL, 0); @@ -3316,6 +3316,15 @@ static void test_websocket(int port) socket = pWinHttpWebSocketCompleteUpgrade(request, 0); ok(socket != NULL, "got %u\n", GetLastError());
+ buf[0] = 0; + count = 0; + type = 0xdeadbeef; + error = pWinHttpWebSocketReceive(socket, buf, sizeof(buf), &count, &type); + ok(!error, "got %u\n", error); + ok(buf[0] == 'R', "got %c\n", buf[0]); + ok(count == 26, "got %u\n", count); + ok(type == WINHTTP_WEB_SOCKET_UTF8_MESSAGE_BUFFER_TYPE, "got %u\n", type); + error = pWinHttpWebSocketSend(socket, WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE, NULL, 1); ok(error == ERROR_INVALID_PARAMETER, "got %u\n", error);
@@ -3388,10 +3397,10 @@ static void test_websocket(int port) error = pWinHttpWebSocketQueryCloseStatus(socket, NULL, NULL, 0, &len); ok(error == ERROR_INVALID_PARAMETER, "got %u\n", error);
- len = 0; + len = 0xdeadbeef; error = pWinHttpWebSocketQueryCloseStatus(socket, &close_status, NULL, 0, &len); - ok(error == ERROR_INSUFFICIENT_BUFFER, "got %u\n", error); - ok(len, "len not set\n"); + ok(!error, "got %u\n", error); + ok(!len, "got %u\n", len);
error = pWinHttpWebSocketQueryCloseStatus(socket, &close_status, NULL, 1, &len); ok(error == ERROR_INVALID_PARAMETER, "got %u\n", error); @@ -3402,7 +3411,7 @@ static void test_websocket(int port) error = pWinHttpWebSocketQueryCloseStatus(socket, &close_status, buf, sizeof(buf), &len); ok(!error, "got %u\n", error); ok(close_status == 1000, "got %08x\n", close_status); - ok(len == sizeof("success"), "got %u\n", len); + ok(!len, "got %u\n", len);
WinHttpCloseHandle(socket); WinHttpCloseHandle(request);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=98508
Your paranoid android.
=== w8adm (32 bit report) ===
winhttp: notification.c:239: Test failed: failed to send request 12007 notification.c:241: Test failed: unexpected function 3, expected 4. probably some notifications were missing notification.c:243: Test failed: failed to receive response 12019 notification.c:247: Test failed: failed unexpectedly 12019 notification.c:248: Test failed: request failed unexpectedly 2147344384 notification.c:251: Test failed: unexpected function 3, expected 13. probably some notifications were missing notification.c:111: Test failed: 251: expected status 0x00000002 got 0x00000800 notification.c:112: Test failed: 251: expected function 3 got 13
=== w864 (64 bit report) ===
winhttp: notification.c:111: Test failed: 734: expected status 0x00000008 got 0x00200000
=== w1064v1809 (64 bit report) ===
winhttp: notification.c:111: Test failed: 734: expected status 0x00000008 got 0x00200000
=== w10pro64 (64 bit report) ===
winhttp: notification.c:111: Test failed: 734: expected status 0x00000008 got 0x00200000