Module: wine Branch: master Commit: 1f79f36373a098e937d718b7dfe7c9f823979b02 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1f79f36373a098e937d718b7df...
Author: Hans Leidekker hans@codeweavers.com Date: Wed Apr 13 13:49:46 2016 +0200
webservices/tests: Add channel tests.
Signed-off-by: Hans Leidekker hans@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/webservices/tests/Makefile.in | 1 + dlls/webservices/tests/channel.c | 63 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+)
diff --git a/dlls/webservices/tests/Makefile.in b/dlls/webservices/tests/Makefile.in index 1456b44..5f79fcb 100644 --- a/dlls/webservices/tests/Makefile.in +++ b/dlls/webservices/tests/Makefile.in @@ -2,5 +2,6 @@ TESTDLL = webservices.dll IMPORTS = webservices
C_SRCS = \ + channel.c \ reader.c \ writer.c diff --git a/dlls/webservices/tests/channel.c b/dlls/webservices/tests/channel.c new file mode 100644 index 0000000..82a7a69 --- /dev/null +++ b/dlls/webservices/tests/channel.c @@ -0,0 +1,63 @@ +/* + * Copyright 2016 Hans Leidekker for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdio.h> +#include "windows.h" +#include "webservices.h" +#include "wine/test.h" + +static void test_WsCreateChannel(void) +{ + HRESULT hr; + WS_CHANNEL *channel; + WS_CHANNEL_STATE state; + ULONG size, value; + + hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, NULL, NULL ) ; + ok( hr == E_INVALIDARG, "got %08x\n", hr ); + + channel = NULL; + hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, &channel, NULL ) ; + ok( hr == S_OK, "got %08x\n", hr ); + ok( channel != NULL, "channel not set\n" ); + + value = 0xdeadbeef; + size = sizeof(value); + hr = WsGetChannelProperty( channel, WS_CHANNEL_PROPERTY_MAX_BUFFERED_MESSAGE_SIZE, &value, size, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( value == 65536, "got %u\n", value ); + + /* read-only property */ + state = 0xdeadbeef; + size = sizeof(state); + hr = WsGetChannelProperty( channel, WS_CHANNEL_PROPERTY_STATE, &state, size, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( state == WS_CHANNEL_STATE_CREATED, "got %u\n", state ); + + state = WS_CHANNEL_STATE_CREATED; + size = sizeof(state); + hr = WsSetChannelProperty( channel, WS_CHANNEL_PROPERTY_STATE, &state, size, NULL ); + ok( hr == E_INVALIDARG, "got %08x\n", hr ); + + WsFreeChannel( channel ); +} + +START_TEST(channel) +{ + test_WsCreateChannel(); +}