Skip to content

Commit b77840d

Browse files
committed
[SHELL32_APITEST] Run the CUserNotification worker test function in a thread to copy with possible test timeouts. CORE-13177
1 parent bdae0cc commit b77840d

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

modules/rostests/apitests/shell32/CUserNotification.cpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,39 @@ TestNotification(void)
171171
ok_hr(hr, S_FALSE);
172172
}
173173

174-
START_TEST(CUserNotification)
174+
DWORD
175+
CALLBACK
176+
TestThread(LPVOID lpParam)
175177
{
178+
/* Initialize COM */
176179
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
180+
181+
/* Start the test */
177182
TestNotification();
183+
184+
/* Cleanup and return */
178185
CoUninitialize();
186+
return 0;
187+
}
188+
189+
START_TEST(CUserNotification)
190+
{
191+
HANDLE hThread;
192+
DWORD dwWait;
193+
194+
/* We create a test thread, because the notification tests can hang */
195+
hThread = CreateThread(NULL, 0, TestThread, NULL, 0, NULL);
196+
ok(hThread != NULL, "CreateThread failed with error 0x%lu\n", GetLastError());
197+
if (!hThread)
198+
{
199+
skip("Could not create the CUserNotification test thread!");
200+
return;
201+
}
202+
203+
/* Wait a maximum of 1:30 for the thread to finish (the timeout tests take some time) */
204+
dwWait = WaitForSingleObject(hThread, 90 * 1000);
205+
ok(dwWait == WAIT_OBJECT_0, "WaitForSingleObject returned %lu, expected WAIT_OBJECT_0\n", dwWait);
206+
207+
/* Cleanup and return */
208+
CloseHandle(hThread);
179209
}

0 commit comments

Comments
 (0)