2 * Test suite for TaskScheduler interface
4 * Copyright (C) 2008 Google (Roy Shea)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include "wine/test.h"
27 static ITaskScheduler *test_task_scheduler;
29 static void test_NewWorkItem(void)
33 const WCHAR task_name[] = {'T', 'e', 's', 't', 'i', 'n', 'g', 0};
36 /* Initialize a GUID that will not be a recognized CLSID or a IID */
37 CoCreateGuid(&GUID_BAD);
39 /* Create TaskScheduler */
40 hres = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER,
41 &IID_ITaskScheduler, (void **) &test_task_scheduler);
42 ok(hres == S_OK, "CTaskScheduler CoCreateInstance failed: %08x\n", hres);
45 skip("Failed to create task scheduler. Skipping tests.\n");
49 /* Test basic task creation */
50 hres = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name,
51 &CLSID_CTask, &IID_ITask, (IUnknown**)&task);
52 ok(hres == S_OK, "NewNetworkItem failed: %08x\n", hres);
56 /* Task creation attempt using invalid work item class ID */
57 hres = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name,
58 &GUID_BAD, &IID_ITask, (IUnknown**)&task);
59 ok(hres == CLASS_E_CLASSNOTAVAILABLE,
60 "Expected CLASS_E_CLASSNOTAVAILABLE: %08x\n", hres);
62 /* Task creation attempt using invalid interface ID */
63 hres = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name,
64 &CLSID_CTask, &GUID_BAD, (IUnknown**)&task);
65 ok(hres == E_NOINTERFACE, "Expected E_NOINTERFACE: %08x\n", hres);
67 /* Task creation attempt using invalid work item class and interface ID */
68 hres = ITaskScheduler_NewWorkItem(test_task_scheduler, task_name,
69 &GUID_BAD, &GUID_BAD, (IUnknown**)&task);
70 ok(hres == CLASS_E_CLASSNOTAVAILABLE,
71 "Expected CLASS_E_CLASSNOTAVAILABLE: %08x\n", hres);
73 ITaskScheduler_Release(test_task_scheduler);
77 START_TEST(task_scheduler)