Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
8dfba77c
Commit
8dfba77c
authored
Mar 03, 2008
by
Roy Shea
Committed by
Alexandre Julliard
Mar 04, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qmgr: Implement IEnumBackgroundCopyJobs_GetCount.
parent
4609eccd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
193 additions
and
2 deletions
+193
-2
enum_jobs.c
dlls/qmgr/enum_jobs.c
+37
-2
qmgr.h
dlls/qmgr/qmgr.h
+3
-0
Makefile.in
dlls/qmgr/tests/Makefile.in
+1
-0
enum_jobs.c
dlls/qmgr/tests/enum_jobs.c
+152
-0
No files found.
dlls/qmgr/enum_jobs.c
View file @
8dfba77c
...
...
@@ -25,6 +25,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(qmgr);
static
void
EnumBackgroundCopyJobsDestructor
(
EnumBackgroundCopyJobsImpl
*
This
)
{
ULONG
i
;
for
(
i
=
0
;
i
<
This
->
numJobs
;
i
++
)
IBackgroundCopyJob_Release
(
This
->
jobs
[
i
]);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
jobs
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -105,8 +111,9 @@ static HRESULT WINAPI BITS_IEnumBackgroundCopyJobs_GetCount(
IEnumBackgroundCopyJobs
*
iface
,
ULONG
*
puCount
)
{
FIXME
(
"Not implemented
\n
"
);
return
E_NOTIMPL
;
EnumBackgroundCopyJobsImpl
*
This
=
(
EnumBackgroundCopyJobsImpl
*
)
iface
;
*
puCount
=
This
->
numJobs
;
return
S_OK
;
}
static
const
IEnumBackgroundCopyJobsVtbl
BITS_IEnumBackgroundCopyJobs_Vtbl
=
...
...
@@ -124,7 +131,10 @@ static const IEnumBackgroundCopyJobsVtbl BITS_IEnumBackgroundCopyJobs_Vtbl =
HRESULT
EnumBackgroundCopyJobsConstructor
(
LPVOID
*
ppObj
,
IBackgroundCopyManager
*
copyManager
)
{
BackgroundCopyManagerImpl
*
qmgr
=
(
BackgroundCopyManagerImpl
*
)
copyManager
;
EnumBackgroundCopyJobsImpl
*
This
;
BackgroundCopyJobImpl
*
job
;
ULONG
i
;
TRACE
(
"%p, %p)
\n
"
,
ppObj
,
copyManager
);
...
...
@@ -134,6 +144,31 @@ HRESULT EnumBackgroundCopyJobsConstructor(LPVOID *ppObj,
This
->
lpVtbl
=
&
BITS_IEnumBackgroundCopyJobs_Vtbl
;
This
->
ref
=
1
;
/* Create array of jobs */
This
->
indexJobs
=
0
;
This
->
numJobs
=
list_count
(
&
qmgr
->
jobs
);
if
(
0
<
This
->
numJobs
)
{
This
->
jobs
=
HeapAlloc
(
GetProcessHeap
(),
0
,
This
->
numJobs
*
sizeof
*
This
->
jobs
);
if
(
!
This
->
jobs
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
E_OUTOFMEMORY
;
}
}
else
This
->
jobs
=
NULL
;
i
=
0
;
LIST_FOR_EACH_ENTRY
(
job
,
&
qmgr
->
jobs
,
BackgroundCopyJobImpl
,
entryFromQmgr
)
{
IBackgroundCopyJob
*
iJob
=
(
IBackgroundCopyJob
*
)
job
;
IBackgroundCopyJob_AddRef
(
iJob
);
This
->
jobs
[
i
++
]
=
iJob
;
}
*
ppObj
=
&
This
->
lpVtbl
;
return
S_OK
;
}
dlls/qmgr/qmgr.h
View file @
8dfba77c
...
...
@@ -48,6 +48,9 @@ typedef struct
{
const
IEnumBackgroundCopyJobsVtbl
*
lpVtbl
;
LONG
ref
;
IBackgroundCopyJob
**
jobs
;
ULONG
numJobs
;
ULONG
indexJobs
;
}
EnumBackgroundCopyJobsImpl
;
/* Enum background copy files vtbl and related data */
...
...
dlls/qmgr/tests/Makefile.in
View file @
8dfba77c
...
...
@@ -7,6 +7,7 @@ IMPORTS = ole32 shlwapi user32 kernel32
CTESTS
=
\
enum_files.c
\
enum_jobs.c
\
file.c
\
job.c
\
qmgr.c
...
...
dlls/qmgr/tests/enum_jobs.c
0 → 100644
View file @
8dfba77c
/*
* Unit test suite for Enum Background Copy Jobs 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_displayNameA
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
'A'
,
0
};
static
const
WCHAR
test_displayNameB
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
'B'
,
0
};
static
IBackgroundCopyManager
*
test_manager
;
static
IBackgroundCopyJob
*
test_jobA
;
static
IBackgroundCopyJob
*
test_jobB
;
static
IEnumBackgroundCopyJobs
*
test_enumJobsA
;
static
IEnumBackgroundCopyJobs
*
test_enumJobsB
;
static
GUID
test_jobIdA
;
static
GUID
test_jobIdB
;
/* Generic test setup */
static
BOOL
setup
(
void
)
{
HRESULT
hres
;
test_manager
=
NULL
;
test_jobA
=
NULL
;
test_jobB
=
NULL
;
memset
(
&
test_jobIdA
,
0
,
sizeof
test_jobIdA
);
memset
(
&
test_jobIdB
,
0
,
sizeof
test_jobIdB
);
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_displayNameA
,
BG_JOB_TYPE_DOWNLOAD
,
&
test_jobIdA
,
&
test_jobA
);
if
(
hres
!=
S_OK
)
return
FALSE
;
hres
=
IBackgroundCopyManager_EnumJobs
(
test_manager
,
0
,
&
test_enumJobsA
);
if
(
hres
!=
S_OK
)
return
FALSE
;
hres
=
IBackgroundCopyManager_CreateJob
(
test_manager
,
test_displayNameB
,
BG_JOB_TYPE_DOWNLOAD
,
&
test_jobIdB
,
&
test_jobB
);
if
(
hres
!=
S_OK
)
return
FALSE
;
hres
=
IBackgroundCopyManager_EnumJobs
(
test_manager
,
0
,
&
test_enumJobsB
);
if
(
hres
!=
S_OK
)
return
FALSE
;
return
TRUE
;
}
/* Generic test cleanup */
static
void
teardown
(
void
)
{
if
(
test_enumJobsB
)
IEnumBackgroundCopyJobs_Release
(
test_enumJobsB
);
test_enumJobsB
=
NULL
;
if
(
test_jobB
)
IBackgroundCopyJob_Release
(
test_jobB
);
test_jobB
=
NULL
;
if
(
test_enumJobsA
)
IEnumBackgroundCopyJobs_Release
(
test_enumJobsA
);
test_enumJobsA
=
NULL
;
if
(
test_jobA
)
IBackgroundCopyJob_Release
(
test_jobA
);
test_jobA
=
NULL
;
if
(
test_manager
)
IBackgroundCopyManager_Release
(
test_manager
);
test_manager
=
NULL
;
}
/* We can't assume the job count will start at any fixed number since esp
when testing on Windows there may be other jobs created by other
processes. Even this approach of creating two jobs and checking the
difference in counts could fail if a job was created in between, but
it's probably not worth worrying about in sane test environments. */
static
void
test_GetCount
(
void
)
{
HRESULT
hres
;
ULONG
jobCountA
,
jobCountB
;
hres
=
IEnumBackgroundCopyJobs_GetCount
(
test_enumJobsA
,
&
jobCountA
);
ok
(
hres
==
S_OK
,
"GetCount failed: %08x
\n
"
,
hres
);
if
(
hres
!=
S_OK
)
{
skip
(
"Couldn't get job count
\n
"
);
return
;
}
hres
=
IEnumBackgroundCopyJobs_GetCount
(
test_enumJobsB
,
&
jobCountB
);
ok
(
hres
==
S_OK
,
"GetCount failed: %08x
\n
"
,
hres
);
if
(
hres
!=
S_OK
)
{
skip
(
"Couldn't get job count
\n
"
);
return
;
}
ok
(
jobCountB
==
jobCountA
+
1
,
"Got incorrect count
\n
"
);
}
typedef
void
(
*
test_t
)(
void
);
START_TEST
(
enum_jobs
)
{
static
const
test_t
tests
[]
=
{
test_GetCount
,
0
};
const
test_t
*
test
;
CoInitialize
(
NULL
);
for
(
test
=
tests
;
*
test
;
++
test
)
{
/* Keep state seperate between tests. */
if
(
!
setup
())
{
teardown
();
skip
(
"Unable to setup test
\n
"
);
break
;
}
(
*
test
)();
teardown
();
}
CoUninitialize
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment