Nikolay Sivov : mfplat/tests: Add some tests for serial queues.
Alexandre Julliard
julliard at winehq.org
Fri Mar 1 16:42:10 CST 2019
Module: wine
Branch: master
Commit: 859f9bacc2ac0202b836f711d644f039590cb898
URL: https://source.winehq.org/git/wine.git/?a=commit;h=859f9bacc2ac0202b836f711d644f039590cb898
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Mar 1 11:03:11 2019 +0300
mfplat/tests: Add some tests for serial queues.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mfplat/tests/mfplat.c | 62 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 61 insertions(+), 1 deletion(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index cc8a0f4..e5e074e 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -44,6 +44,7 @@ static HRESULT (WINAPI *pMFCreateMemoryBuffer)(DWORD max_length, IMFMediaBuffer
static void* (WINAPI *pMFHeapAlloc)(SIZE_T size, ULONG flags, char *file, int line, EAllocationType type);
static void (WINAPI *pMFHeapFree)(void *p);
static HRESULT (WINAPI *pMFPutWaitingWorkItem)(HANDLE event, LONG priority, IMFAsyncResult *result, MFWORKITEM_KEY *key);
+static HRESULT (WINAPI *pMFAllocateSerialWorkQueue)(DWORD queue, DWORD *serial_queue);
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
@@ -312,7 +313,8 @@ static void init_functions(void)
{
HMODULE mod = GetModuleHandleA("mfplat.dll");
-#define X(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return;
+#define X(f) p##f = (void*)GetProcAddress(mod, #f)
+ X(MFAllocateSerialWorkQueue);
X(MFCopyImage);
X(MFCreateSourceResolver);
X(MFCreateMFByteStreamOnStream);
@@ -1092,6 +1094,63 @@ todo_wine
ok(hr == S_OK, "Failed to shutdown, hr %#x.\n", hr);
}
+static void test_serial_queue(void)
+{
+ static const DWORD queue_ids[] =
+ {
+ MFASYNC_CALLBACK_QUEUE_STANDARD,
+ MFASYNC_CALLBACK_QUEUE_RT,
+ MFASYNC_CALLBACK_QUEUE_IO,
+ MFASYNC_CALLBACK_QUEUE_TIMER,
+ MFASYNC_CALLBACK_QUEUE_MULTITHREADED,
+ MFASYNC_CALLBACK_QUEUE_LONG_FUNCTION,
+ };
+ DWORD queue, serial_queue;
+ unsigned int i;
+ HRESULT hr;
+
+ if (!pMFAllocateSerialWorkQueue)
+ {
+ skip("Serial queues are not supported.\n");
+ return;
+ }
+
+ hr = MFStartup(MF_VERSION, MFSTARTUP_FULL);
+ ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(queue_ids); ++i)
+ {
+ BOOL broken_types = queue_ids[i] == MFASYNC_CALLBACK_QUEUE_TIMER ||
+ queue_ids[i] == MFASYNC_CALLBACK_QUEUE_LONG_FUNCTION;
+
+ hr = pMFAllocateSerialWorkQueue(queue_ids[i], &serial_queue);
+ ok(hr == S_OK || broken(broken_types && hr == E_INVALIDARG) /* Win8 */,
+ "%u: failed to allocate a queue, hr %#x.\n", i, hr);
+
+ if (SUCCEEDED(hr))
+ {
+ hr = MFUnlockWorkQueue(serial_queue);
+ ok(hr == S_OK, "%u: failed to unlock the queue, hr %#x.\n", i, hr);
+ }
+ }
+
+ /* Chain them together. */
+ hr = pMFAllocateSerialWorkQueue(MFASYNC_CALLBACK_QUEUE_STANDARD, &serial_queue);
+ ok(hr == S_OK, "Failed to allocate a queue, hr %#x.\n", hr);
+
+ hr = pMFAllocateSerialWorkQueue(serial_queue, &queue);
+ ok(hr == S_OK, "Failed to allocate a queue, hr %#x.\n", hr);
+
+ hr = MFUnlockWorkQueue(serial_queue);
+ ok(hr == S_OK, "Failed to unlock the queue, hr %#x.\n", hr);
+
+ hr = MFUnlockWorkQueue(queue);
+ ok(hr == S_OK, "Failed to unlock the queue, hr %#x.\n", hr);
+
+ hr = MFShutdown();
+ ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
+}
+
START_TEST(mfplat)
{
CoInitialize(NULL);
@@ -1114,6 +1173,7 @@ START_TEST(mfplat)
test_MFCreateCollection();
test_MFHeapAlloc();
test_scheduled_items();
+ test_serial_queue();
CoUninitialize();
}
More information about the wine-cvs
mailing list