Detlef Riekenberg : wer/tests: Add more tests for Wer*ExcludedApplication.
Alexandre Julliard
julliard at winehq.org
Wed Nov 3 11:37:08 CDT 2010
Module: wine
Branch: master
Commit: 5858af901189c8ff5674e1714c4a9096987b6f44
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5858af901189c8ff5674e1714c4a9096987b6f44
Author: Detlef Riekenberg <wine.dev at web.de>
Date: Mon Nov 1 23:08:47 2010 +0100
wer/tests: Add more tests for Wer*ExcludedApplication.
---
dlls/wer/tests/main.c | 66 ++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 54 insertions(+), 12 deletions(-)
diff --git a/dlls/wer/tests/main.c b/dlls/wer/tests/main.c
index f63b7bd..b10a819 100644
--- a/dlls/wer/tests/main.c
+++ b/dlls/wer/tests/main.c
@@ -31,6 +31,7 @@
#include "wine/test.h"
static const WCHAR appcrash[] = {'A','P','P','C','R','A','S','H',0};
+static const WCHAR backslash[] = {'\\',0};
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};
@@ -39,14 +40,12 @@ static const WCHAR winetest_wer[] = {'w','i','n','e','t','e','s','t','_','w','e'
static void test_WerAddExcludedApplication(void)
{
HRESULT hr;
+ WCHAR buffer[MAX_PATH];
+ UINT res;
/* 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),
+ ok((hr == S_OK) || (hr == E_FAIL) || (hr == __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);
@@ -65,6 +64,27 @@ static void test_WerAddExcludedApplication(void)
/* cleanup */
hr = WerRemoveExcludedApplication(winetest_wer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+
+ /* appname has a path */
+ res = GetWindowsDirectoryW(buffer, sizeof(buffer) / sizeof(buffer[0]));
+ if (res > 0) {
+ /* the last part from the path is added to the inclusion list */
+ hr = WerAddExcludedApplication(buffer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+ hr = WerRemoveExcludedApplication(buffer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+
+ lstrcatW(buffer, backslash);
+ hr = WerAddExcludedApplication(buffer, FALSE);
+ ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
+
+ lstrcatW(buffer, winetest_wer);
+ hr = WerAddExcludedApplication(buffer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+ hr = WerRemoveExcludedApplication(buffer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+ }
+
}
/* #### */
@@ -72,15 +92,12 @@ static void test_WerAddExcludedApplication(void)
static void test_WerRemoveExcludedApplication(void)
{
HRESULT hr;
+ WCHAR buffer[MAX_PATH];
+ UINT res;
/* 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),
+ ok((hr == S_OK) || (hr == E_FAIL) || (hr == __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);
@@ -97,9 +114,34 @@ static void test_WerRemoveExcludedApplication(void)
/* app not in the list */
hr = WerRemoveExcludedApplication(winetest_wer, FALSE);
- ok((hr == E_FAIL) || __HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND),
+ ok((hr == E_FAIL) || (hr == __HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND)),
"got 0x%x (expected E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
+ /* appname has a path */
+ res = GetWindowsDirectoryW(buffer, sizeof(buffer) / sizeof(buffer[0]));
+ if (res > 0) {
+ hr = WerRemoveExcludedApplication(buffer, FALSE);
+ ok((hr == E_FAIL) || (hr == __HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND)),
+ "got 0x%x (expected E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
+
+ /* the last part from the path is added to the inclusion list */
+ hr = WerAddExcludedApplication(buffer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+ hr = WerRemoveExcludedApplication(buffer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+
+ lstrcatW(buffer, backslash);
+ hr = WerAddExcludedApplication(buffer, FALSE);
+ ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
+ hr = WerRemoveExcludedApplication(buffer, FALSE);
+ ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
+
+ lstrcatW(buffer, winetest_wer);
+ hr = WerAddExcludedApplication(buffer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+ hr = WerRemoveExcludedApplication(buffer, FALSE);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+ }
}
/* #### */
More information about the wine-cvs
mailing list