Module: wine Branch: master Commit: 9a52a3e19545abfaab58c59deeac20b98d563c52 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9a52a3e19545abfaab58c59dee...
Author: Zebediah Figura z.figura12@gmail.com Date: Wed Nov 8 23:26:06 2017 -0600
quartz/tests: Remove thread-counting tests.
Signed-off-by: Zebediah Figura z.figura12@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/quartz/tests/avisplitter.c | 77 ++--------------------------------------- 1 file changed, 2 insertions(+), 75 deletions(-)
diff --git a/dlls/quartz/tests/avisplitter.c b/dlls/quartz/tests/avisplitter.c index 78ca8b8..29782a9 100644 --- a/dlls/quartz/tests/avisplitter.c +++ b/dlls/quartz/tests/avisplitter.c @@ -25,38 +25,8 @@ #include "dshow.h" #include "tlhelp32.h"
-static HANDLE (WINAPI *pCreateToolhelp32Snapshot)(DWORD, DWORD); -static BOOL (WINAPI *pThread32First)(HANDLE, LPTHREADENTRY32); -static BOOL (WINAPI *pThread32Next)(HANDLE, LPTHREADENTRY32); - static IUnknown *pAviSplitter = NULL;
-static int count_threads(void) -{ - THREADENTRY32 te; - int threads; - HANDLE h; - - h = pCreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); - te.dwSize = sizeof(te); - - if (h == INVALID_HANDLE_VALUE) - return -1; - - pThread32First(h, &te); - if (te.th32OwnerProcessID == GetCurrentProcessId()) - threads = 1; - else - threads = 0; - - while (pThread32Next(h, &te)) - if (te.th32OwnerProcessID == GetCurrentProcessId()) - ++threads; - - CloseHandle(h); - return threads; -} - static BOOL create_avisplitter(void) { HRESULT hr; @@ -303,37 +273,19 @@ static void test_filesourcefilter(void) static const WCHAR wfile[] = {'t','e','s','t','.','a','v','i',0}; static const char afile[] = "test.avi";
-/* This test doesn't use the quartz filtergraph because it makes it impossible - * to be certain that a thread is really one owned by the avi splitter. - * A lot of the decoder filters will also have their own thread, and Windows' - * filtergraph has a separate thread for start/stop/seeking requests. - * By avoiding the filtergraph altogether and connecting streams directly to - * the null renderer I am sure that this is not the case here. - */ -static void test_threads(void) +static void test_filter_graph(void) { IFileSourceFilter *pfile = NULL; IBaseFilter *preader = NULL, *pavi = NULL; IEnumPins *enumpins = NULL; IPin *filepin = NULL, *avipin = NULL; HRESULT hr; - int baselevel, curlevel, expected; HANDLE file = NULL; PIN_DIRECTION dir = PINDIR_OUTPUT; char buffer[13]; DWORD readbytes; FILTER_STATE state;
- /* We need another way of counting threads on NT4. Skip these tests (for now) */ - if (!pCreateToolhelp32Snapshot || !pThread32First || !pThread32Next) - { - win_skip("Needed thread functions are not available (NT4)\n"); - return; - } - - /* Before doing anything (the thread count at the start differs per OS) */ - baselevel = count_threads(); - file = CreateFileW(wfile, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (file == INVALID_HANDLE_VALUE) @@ -409,20 +361,11 @@ static void test_threads(void) if (hr != S_OK) goto fail;
- curlevel = count_threads(); - ok(curlevel == baselevel, - "The thread count should be %d not %d\n", baselevel, curlevel); - hr = IPin_Connect(filepin, avipin, NULL); ok(hr == S_OK, "Could not connect: %08x\n", hr); if (hr != S_OK) goto fail;
- expected = 1 + baselevel; - curlevel = count_threads(); - ok(curlevel == expected, - "The thread count should be %d not %d\n", expected, curlevel); - IPin_Release(avipin); avipin = NULL;
@@ -462,7 +405,6 @@ static void test_threads(void) break; } IBaseFilter_Run(pnull, 0); - ++expected; }
IPin_Release(avipin); @@ -494,10 +436,6 @@ static void test_threads(void) IBaseFilter_Run(pavi, 0); IBaseFilter_GetState(pavi, INFINITE, &state);
- curlevel = count_threads(); - ok(curlevel == expected, - "The thread count should be %d not %d\n", expected, curlevel); - IBaseFilter_Pause(pavi); IBaseFilter_Pause(preader); IBaseFilter_Stop(pavi); @@ -568,21 +506,10 @@ fail: IBaseFilter_Release(pavi); if (pfile) IFileSourceFilter_Release(pfile); - - curlevel = count_threads(); - todo_wine - ok(curlevel == baselevel, - "The thread count should be %d not %d\n", baselevel, curlevel); }
START_TEST(avisplitter) { - HMODULE kernel32 = GetModuleHandleA("kernel32.dll"); - - pCreateToolhelp32Snapshot = (void*)GetProcAddress(kernel32, "CreateToolhelp32Snapshot"); - pThread32First = (void*)GetProcAddress(kernel32, "Thread32First"); - pThread32Next = (void*)GetProcAddress(kernel32, "Thread32Next"); - CoInitialize(NULL);
if (!create_avisplitter()) @@ -594,7 +521,7 @@ START_TEST(avisplitter) test_query_interface(); test_basefilter(); test_filesourcefilter(); - test_threads(); + test_filter_graph();
release_avisplitter();