Detlef Riekenberg : wer/tests: Add initial tests.
Alexandre Julliard
julliard at winehq.org
Tue Oct 26 12:34:54 CDT 2010
Module: wine
Branch: master
Commit: d8a5bc929d01ab6fafeba3ff80e6bceb061e8b66
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d8a5bc929d01ab6fafeba3ff80e6bceb061e8b66
Author: Detlef Riekenberg <wine.dev at web.de>
Date: Tue Oct 26 11:37:17 2010 +0200
wer/tests: Add initial tests.
---
configure | 3 +-
configure.ac | 3 +-
dlls/wer/Makefile.in | 1 +
dlls/wer/tests/Makefile.in | 7 +++
dlls/wer/tests/main.c | 110 ++++++++++++++++++++++++++++++++++++++++++++
include/werapi.h | 2 +
6 files changed, 124 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index dcb9203..32efe7f 100755
--- a/configure
+++ b/configure
@@ -14988,7 +14988,8 @@ wine_fn_config_dll vwin32.vxd enable_win16
wine_fn_config_dll w32skrnl enable_win16
wine_fn_config_dll w32sys.dll16 enable_win16
wine_fn_config_dll wbemprox enable_wbemprox
-wine_fn_config_dll wer enable_wer
+wine_fn_config_dll wer enable_wer wer
+wine_fn_config_test dlls/wer/tests wer_test
wine_fn_config_dll wiaservc enable_wiaservc
wine_fn_config_dll win32s16.dll16 enable_win16
wine_fn_config_dll win87em.dll16 enable_win16
diff --git a/configure.ac b/configure.ac
index 8bae871..7b6818b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2734,7 +2734,8 @@ WINE_CONFIG_DLL(vwin32.vxd,enable_win16)
WINE_CONFIG_DLL(w32skrnl,enable_win16)
WINE_CONFIG_DLL(w32sys.dll16,enable_win16)
WINE_CONFIG_DLL(wbemprox)
-WINE_CONFIG_DLL(wer)
+WINE_CONFIG_DLL(wer,,[wer])
+WINE_CONFIG_TEST(dlls/wer/tests)
WINE_CONFIG_DLL(wiaservc)
WINE_CONFIG_DLL(win32s16.dll16,enable_win16)
WINE_CONFIG_DLL(win87em.dll16,enable_win16)
diff --git a/dlls/wer/Makefile.in b/dlls/wer/Makefile.in
index 772182f..e90dcc0 100644
--- a/dlls/wer/Makefile.in
+++ b/dlls/wer/Makefile.in
@@ -1,4 +1,5 @@
MODULE = wer.dll
+IMPORTLIB = wer
C_SRCS = \
main.c
diff --git a/dlls/wer/tests/Makefile.in b/dlls/wer/tests/Makefile.in
new file mode 100644
index 0000000..07ed264
--- /dev/null
+++ b/dlls/wer/tests/Makefile.in
@@ -0,0 +1,7 @@
+TESTDLL = wer.dll
+IMPORTS = wer
+
+C_SRCS = \
+ main.c
+
+ at MAKE_TEST_RULES@
diff --git a/dlls/wer/tests/main.c b/dlls/wer/tests/main.c
new file mode 100644
index 0000000..183974f
--- /dev/null
+++ b/dlls/wer/tests/main.c
@@ -0,0 +1,110 @@
+/*
+ * Unit test suite for windows error reporting in Vista and above
+ *
+ * Copyright 2010 Detlef Riekenberg
+ *
+ * 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 <stdarg.h>
+#include <stdio.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+#include "winreg.h"
+
+#include "werapi.h"
+#include "wine/test.h"
+
+static const WCHAR empty[] = {0};
+static const WCHAR winetest_wer[] = {'w','i','n','e','t','e','s','t','_','w','e','r','.','e','x','e',0};
+
+/* ###### */
+
+static void test_WerAddExcludedApplication(void)
+{
+ HRESULT hr;
+
+ /* clean state */
+ hr = WerRemoveExcludedApplication(winetest_wer, FALSE);
+ if (hr == E_NOTIMPL) {
+ skip("Wer*ExcludedApplication not implemented\n");
+ return;
+ }
+ ok((hr == S_OK) || (hr == E_FAIL) || __HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND),
+ "got 0x%x (expected S_OK, E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
+
+ hr = WerAddExcludedApplication(NULL, FALSE);
+ ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
+
+ hr = WerAddExcludedApplication(empty, FALSE);
+ ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
+
+ hr = WerAddExcludedApplication(winetest_wer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+ /* app already in the list */
+ hr = WerAddExcludedApplication(winetest_wer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+
+
+ /* cleanup */
+ hr = WerRemoveExcludedApplication(winetest_wer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+}
+
+/* #### */
+
+static void test_WerRemoveExcludedApplication(void)
+{
+ HRESULT hr;
+
+ /* clean state */
+ hr = WerRemoveExcludedApplication(winetest_wer, FALSE);
+ if (hr == E_NOTIMPL) {
+ skip("Wer*ExcludedApplication not implemented\n");
+ return;
+ }
+
+ ok((hr == S_OK) || (hr == E_FAIL) || __HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND),
+ "got 0x%x (expected S_OK, E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
+
+ hr = WerAddExcludedApplication(winetest_wer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+
+ hr = WerRemoveExcludedApplication(NULL, FALSE);
+ ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
+
+ hr = WerRemoveExcludedApplication(empty, FALSE);
+ ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
+
+ hr = WerRemoveExcludedApplication(winetest_wer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+
+ /* app not in the list */
+ hr = WerRemoveExcludedApplication(winetest_wer, FALSE);
+ ok((hr == E_FAIL) || __HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND),
+ "got 0x%x (expected E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
+
+}
+
+/* ########################### */
+
+START_TEST(main)
+{
+ test_WerAddExcludedApplication();
+ test_WerRemoveExcludedApplication();
+}
diff --git a/include/werapi.h b/include/werapi.h
index 7ac03f3..54616db 100644
--- a/include/werapi.h
+++ b/include/werapi.h
@@ -32,7 +32,9 @@ typedef enum _WER_REGISTER_FILE_TYPE
WerRegFileTypeMax
} WER_REGISTER_FILE_TYPE;
+HRESULT WINAPI WerAddExcludedApplication(PCWSTR, BOOL);
HRESULT WINAPI WerRegisterFile(PCWSTR file, WER_REGISTER_FILE_TYPE regfiletype, DWORD flags);
+HRESULT WINAPI WerRemoveExcludedApplication(PCWSTR, BOOL);
#ifdef __cplusplus
}
More information about the wine-cvs
mailing list