bits: Implemented BITS_IBackgroundCopyJob_GetId (25/26)
Roy Shea
roy at cs.hmc.edu
Mon Nov 19 18:24:16 CST 2007
---
dlls/qmgr/job.c | 11 ++++-
dlls/qmgr/tests/Makefile.in | 3 +-
dlls/qmgr/tests/job.c | 98 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 109 insertions(+), 3 deletions(-)
create mode 100644 dlls/qmgr/tests/job.c
diff --git a/dlls/qmgr/job.c b/dlls/qmgr/job.c
index 966909d..8a1765f 100644
--- a/dlls/qmgr/job.c
+++ b/dlls/qmgr/job.c
@@ -155,8 +155,15 @@ static HRESULT WINAPI BITS_IBackgroundCopyJob_GetId(
IBackgroundCopyJob* iface,
GUID *pVal)
{
- FIXME("Not implemented\n");
- return E_NOTIMPL;
+ ICOM_THIS_MULTI(BackgroundCopyJobImpl, lpVtbl, iface);
+
+ if (!pVal)
+ {
+ return E_POINTER;
+ }
+
+ memcpy(pVal, &This->jobId, sizeof(GUID));
+ return S_OK;
}
static HRESULT WINAPI BITS_IBackgroundCopyJob_GetType(
diff --git a/dlls/qmgr/tests/Makefile.in b/dlls/qmgr/tests/Makefile.in
index cbb0401..53002a4 100644
--- a/dlls/qmgr/tests/Makefile.in
+++ b/dlls/qmgr/tests/Makefile.in
@@ -8,7 +8,8 @@ MODCFLAGS = @BUILTINFLAG@
EXTRAINCL = -I$(SRCDIR)/..
CTESTS = \
- qmgr.c
+ qmgr.c \
+ job.c
IDL_I_SRCS = ../qmgr_local.idl
diff --git a/dlls/qmgr/tests/job.c b/dlls/qmgr/tests/job.c
new file mode 100644
index 0000000..efbb9f6
--- /dev/null
+++ b/dlls/qmgr/tests/job.c
@@ -0,0 +1,98 @@
+/*
+ * Unit test suite for Background Copy Job Interface
+ *
+ * Copyright 2007 Google (Roy Shea)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdio.h>
+
+#define COBJMACROS
+
+#include "wine/test.h"
+#include "bits.h"
+
+/* Globals used by many tests */
+static const WCHAR test_displayName[] = {'T', 'e', 's', 't', 0};
+static IBackgroundCopyManager* test_manager;
+static IBackgroundCopyJob* test_job;
+static GUID test_jobId;
+
+/* Generic test setup */
+static BOOL setup(void)
+{
+ HRESULT hres;
+
+ test_manager = NULL;
+ test_job = NULL;
+ memset(&test_jobId, 0, sizeof(GUID));
+
+ hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL,
+ CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager,
+ (void **) &test_manager);
+ if(hres != S_OK)
+ {
+ return FALSE;
+ }
+ hres = IBackgroundCopyManager_CreateJob(test_manager, test_displayName,
+ BG_JOB_TYPE_DOWNLOAD, &test_jobId, &test_job);
+ if(hres != S_OK)
+ {
+ IBackgroundCopyManager_Release(test_job);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Generic test cleanup */
+static void teardown(void)
+{
+ IBackgroundCopyManager_Release(test_job);
+}
+
+/* Test that the jobId is properly set */
+static void test_GetId(void)
+{
+ HRESULT hres;
+ GUID tmpId;
+
+ if (!setup())
+ {
+ skip("Unable to setup test\n");
+ return;
+ }
+
+ hres = IBackgroundCopyJob_GetId(test_job, &tmpId);
+ ok(hres == S_OK, "GetId failed: %08x\n", hres);
+ if(hres != S_OK)
+ {
+ skip("Unable to get ID of test_job.\n");
+ teardown();
+ return;
+ }
+ ok(memcmp(&tmpId, &test_jobId, sizeof(GUID)) == 0, "Got incorrect GUID\n");
+ teardown();
+}
+
+START_TEST(job)
+{
+ CoInitialize(NULL);
+ test_GetId();
+ CoUninitialize();
+}
+
+
--
1.5.3.1
More information about the wine-patches
mailing list