wer/tests: Add initial tests.

This commit is contained in:
Detlef Riekenberg 2010-10-26 11:37:17 +02:00 committed by Alexandre Julliard
parent ac194c3873
commit d8a5bc929d
6 changed files with 124 additions and 2 deletions

3
configure vendored
View File

@ -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

View File

@ -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)

View File

@ -1,4 +1,5 @@
MODULE = wer.dll
IMPORTLIB = wer
C_SRCS = \
main.c

View File

@ -0,0 +1,7 @@
TESTDLL = wer.dll
IMPORTS = wer
C_SRCS = \
main.c
@MAKE_TEST_RULES@

110
dlls/wer/tests/main.c Normal file
View File

@ -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();
}

View File

@ -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
}