Owen Rudge : wsdapi/tests: Add initial tests for WSDCreateDiscoveryPublisher.

Alexandre Julliard julliard at winehq.org
Wed Apr 12 15:02:33 CDT 2017


Module: wine
Branch: master
Commit: 85f993ed932a173c362e344d95d2742aa7928ebd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=85f993ed932a173c362e344d95d2742aa7928ebd

Author: Owen Rudge <orudge at codeweavers.com>
Date:   Tue Apr 11 21:20:09 2017 +0100

wsdapi/tests: Add initial tests for WSDCreateDiscoveryPublisher.

Signed-off-by: Owen Rudge <orudge at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 configure                     |   1 +
 configure.ac                  |   1 +
 dlls/wsdapi/tests/Makefile.in |   5 +++
 dlls/wsdapi/tests/discovery.c | 100 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 107 insertions(+)

diff --git a/configure b/configure
index 93fd7e5..e4b9dd2 100755
--- a/configure
+++ b/configure
@@ -18493,6 +18493,7 @@ wine_fn_config_dll wpcap enable_wpcap
 wine_fn_config_dll ws2_32 enable_ws2_32 implib
 wine_fn_config_test dlls/ws2_32/tests ws2_32_test
 wine_fn_config_dll wsdapi enable_wsdapi implib
+wine_fn_config_test dlls/wsdapi/tests wsdapi_test
 wine_fn_config_dll wshom.ocx enable_wshom_ocx clean
 wine_fn_config_test dlls/wshom.ocx/tests wshom.ocx_test clean
 wine_fn_config_dll wsnmp32 enable_wsnmp32 implib
diff --git a/configure.ac b/configure.ac
index b231fe9..a2fc66d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3527,6 +3527,7 @@ WINE_CONFIG_DLL(wpcap)
 WINE_CONFIG_DLL(ws2_32,,[implib])
 WINE_CONFIG_TEST(dlls/ws2_32/tests)
 WINE_CONFIG_DLL(wsdapi,,[implib])
+WINE_CONFIG_TEST(dlls/wsdapi/tests)
 WINE_CONFIG_DLL(wshom.ocx,,[clean])
 WINE_CONFIG_TEST(dlls/wshom.ocx/tests,[clean])
 WINE_CONFIG_DLL(wsnmp32,,[implib])
diff --git a/dlls/wsdapi/tests/Makefile.in b/dlls/wsdapi/tests/Makefile.in
new file mode 100644
index 0000000..c351d10
--- /dev/null
+++ b/dlls/wsdapi/tests/Makefile.in
@@ -0,0 +1,5 @@
+TESTDLL   = wsdapi.dll
+IMPORTS   = wsdapi ole32 user32
+
+C_SRCS = \
+	discovery.c
diff --git a/dlls/wsdapi/tests/discovery.c b/dlls/wsdapi/tests/discovery.c
new file mode 100644
index 0000000..280b034
--- /dev/null
+++ b/dlls/wsdapi/tests/discovery.c
@@ -0,0 +1,100 @@
+/*
+ * Web Services on Devices
+ * Discovery tests
+ *
+ * Copyright 2017 Owen Rudge 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
+ */
+
+#define COBJMACROS
+
+#include <windows.h>
+
+#include "wine/test.h"
+#include "initguid.h"
+#include "objbase.h"
+#include "wsdapi.h"
+
+static void CreateDiscoveryPublisher_tests(void)
+{
+    IWSDiscoveryPublisher *publisher = NULL;
+    IWSDiscoveryPublisher *publisher2;
+    IUnknown *unknown;
+    HRESULT rc;
+    ULONG ref;
+
+    rc = WSDCreateDiscoveryPublisher(NULL, NULL);
+    ok((rc == E_POINTER) || (rc == E_INVALIDARG), "WSDCreateDiscoveryPublisher(NULL, NULL) failed: %08x\n", rc);
+
+    rc = WSDCreateDiscoveryPublisher(NULL, &publisher);
+    ok(rc == S_OK, "WSDCreateDiscoveryPublisher(NULL, &publisher) failed: %08x\n", rc);
+    ok(publisher != NULL, "WSDCreateDiscoveryPublisher(NULL, &publisher) failed: publisher == NULL\n");
+
+    /* Try to query for objects */
+    rc = IWSDiscoveryPublisher_QueryInterface(publisher, &IID_IUnknown, (LPVOID*)&unknown);
+    ok(rc == S_OK,"IWSDiscoveryPublisher_QueryInterface(IID_IUnknown) failed: %08x\n", rc);
+
+    if (rc == S_OK)
+        IUnknown_Release(unknown);
+
+    rc = IWSDiscoveryPublisher_QueryInterface(publisher, &IID_IWSDiscoveryPublisher, (LPVOID*)&publisher2);
+    ok(rc == S_OK,"IWSDiscoveryPublisher_QueryInterface(IID_IWSDiscoveryPublisher) failed: %08x\n", rc);
+
+    if (rc == S_OK)
+        IWSDiscoveryPublisher_Release(publisher2);
+
+    ref = IWSDiscoveryPublisher_Release(publisher);
+    ok(ref == 0, "IWSDiscoveryPublisher_Release() has %d references, should have 0\n", ref);
+}
+
+static void Publish_tests(void)
+{
+    IWSDiscoveryPublisher *publisher = NULL;
+    HRESULT rc;
+    ULONG ref;
+
+    rc = WSDCreateDiscoveryPublisher(NULL, &publisher);
+    ok(rc == S_OK, "WSDCreateDiscoveryPublisher(NULL, &publisher) failed: %08x\n", rc);
+    ok(publisher != NULL, "WSDCreateDiscoveryPublisher(NULL, &publisher) failed: publisher == NULL\n");
+
+    /* Test SetAddressFamily */
+    rc = IWSDiscoveryPublisher_SetAddressFamily(publisher, 12345);
+    ok(rc == E_INVALIDARG, "IWSDiscoveryPublisher_SetAddressFamily(12345) returned unexpected result: %08x\n", rc);
+
+    rc = IWSDiscoveryPublisher_SetAddressFamily(publisher, WSDAPI_ADDRESSFAMILY_IPV4);
+    ok(rc == S_OK, "IWSDiscoveryPublisher_SetAddressFamily(WSDAPI_ADDRESSFAMILY_IPV4) failed: %08x\n", rc);
+
+    /* Try to update the address family after already setting it */
+    rc = IWSDiscoveryPublisher_SetAddressFamily(publisher, WSDAPI_ADDRESSFAMILY_IPV6);
+    ok(rc == STG_E_INVALIDFUNCTION, "IWSDiscoveryPublisher_SetAddressFamily(WSDAPI_ADDRESSFAMILY_IPV6) returned unexpected result: %08x\n", rc);
+
+    /* TODO: Register notification sink */
+
+    /* TODO: Publish */
+
+    ref = IWSDiscoveryPublisher_Release(publisher);
+    ok(ref == 0, "IWSDiscoveryPublisher_Release() has %d references, should have 0\n", ref);
+}
+
+START_TEST(discovery)
+{
+    CoInitialize(NULL);
+
+    CreateDiscoveryPublisher_tests();
+    Publish_tests();
+
+    CoUninitialize();
+}




More information about the wine-cvs mailing list