[9/9] webservices/tests: Add channel tests.

Hans Leidekker hans at codeweavers.com
Wed Apr 13 06:49:46 CDT 2016


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/webservices/tests/Makefile.in |  1 +
 dlls/webservices/tests/channel.c   | 63 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)
 create mode 100644 dlls/webservices/tests/channel.c

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();
+}
-- 
2.8.0.rc3




More information about the wine-patches mailing list