wsdapi/tests: Add tests for Get/SetLocalAddress.

Signed-off-by: Owen Rudge <orudge@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Owen Rudge 2017-06-20 22:26:05 +01:00 committed by Alexandre Julliard
parent d0abe77273
commit f21d3836a2
1 changed files with 59 additions and 0 deletions

View File

@ -66,11 +66,70 @@ static void CreateUdpMessageParameters_tests(void)
ok(ref == 0, "IWSDUdpMessageParameters_Release() has %d references, should have 0\n", ref);
}
static void LocalAddress_tests(void)
{
IWSDUdpAddress *origUdpAddress = NULL;
IWSDAddress *returnedAddress = NULL;
IWSDUdpMessageParameters *udpMessageParams = NULL;
WCHAR address[] = {'1','.','2','.','3','.','4',0};
WSADATA wsaData;
HRESULT rc;
int ret;
ret = WSAStartup(MAKEWORD(2, 2), &wsaData);
ok(ret == 0, "WSAStartup failed: %d\n", ret);
rc = WSDCreateUdpMessageParameters(&udpMessageParams);
ok(rc == S_OK, "WSDCreateUdpMessageParameters(NULL, &udpMessageParams) failed: %08x\n", rc);
ok(udpMessageParams != NULL, "WSDCreateUdpMessageParameters(NULL, &udpMessageParams) failed: udpMessageParams == NULL\n");
rc = IWSDUdpMessageParameters_GetLocalAddress(udpMessageParams, NULL);
todo_wine ok(rc == E_POINTER, "GetLocalAddress failed: %08x\n", rc);
ok(returnedAddress == NULL, "GetLocalAddress returned %p\n", returnedAddress);
rc = IWSDUdpMessageParameters_GetLocalAddress(udpMessageParams, &returnedAddress);
todo_wine ok(rc == E_ABORT, "GetLocalAddress failed: %08x\n", rc);
ok(returnedAddress == NULL, "GetLocalAddress returned %p\n", returnedAddress);
rc = WSDCreateUdpAddress(&origUdpAddress);
ok(rc == S_OK, "WSDCreateUdpAddress(NULL, &origUdpAddress) failed: %08x\n", rc);
ok(origUdpAddress != NULL, "WSDCreateUdpMessageParameters(NULL, &origUdpAddress) failed: origUdpAddress == NULL\n");
rc = IWSDUdpAddress_SetTransportAddress(origUdpAddress, address);
todo_wine ok(rc == S_OK, "SetTransportAddress failed: %08x\n", rc);
rc = IWSDUdpMessageParameters_SetLocalAddress(udpMessageParams, (IWSDAddress *)origUdpAddress);
todo_wine ok(rc == S_OK, "SetLocalAddress failed: %08x\n", rc);
rc = IWSDUdpMessageParameters_GetLocalAddress(udpMessageParams, &returnedAddress);
todo_wine ok(rc == S_OK, "GetLocalAddress failed: %08x\n", rc);
todo_wine ok(returnedAddress != NULL, "GetLocalAddress returned NULL\n");
/* Check if GetLocalAddress returns the same object */
todo_wine ok(returnedAddress == (IWSDAddress *)origUdpAddress, "returnedAddress != origUdpAddress\n");
ret = IWSDUdpMessageParameters_Release(udpMessageParams);
ok(ret == 0, "IWSDUdpMessageParameters_Release() has %d references, should have 0\n", ret);
if (returnedAddress != NULL)
{
ret = IWSDAddress_Release(returnedAddress);
ok(ret == 1, "IWSDAddress_Release() has %d references, should have 1\n", ret);
}
ret = IWSDUdpAddress_Release(origUdpAddress);
ok(ret == 0, "IWSDUdpMessageParameters_Release() has %d references, should have 0\n", ret);
ret = WSACleanup();
ok(ret == 0, "WSACleanup failed: %d\n", ret);
}
START_TEST(msgparams)
{
CoInitialize(NULL);
CreateUdpMessageParameters_tests();
LocalAddress_tests();
CoUninitialize();
}