Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4866d1bd
Commit
4866d1bd
authored
Feb 28, 2008
by
Roy Shea
Committed by
Alexandre Julliard
Feb 29, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qmgr: Implement GetLocalName and GetRemoteName for IBackgroundCopyFile.
parent
5c4776c2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
192 additions
and
5 deletions
+192
-5
file.c
dlls/qmgr/file.c
+19
-5
Makefile.in
dlls/qmgr/tests/Makefile.in
+1
-0
file.c
dlls/qmgr/tests/file.c
+172
-0
No files found.
dlls/qmgr/file.c
View file @
4866d1bd
...
...
@@ -68,21 +68,35 @@ static ULONG WINAPI BITS_IBackgroundCopyFile_Release(
return
ref
;
}
/*
** IBackgroundCopyFile methods **
*/
/*
Get the remote name of a background copy file
*/
static
HRESULT
WINAPI
BITS_IBackgroundCopyFile_GetRemoteName
(
IBackgroundCopyFile
*
iface
,
LPWSTR
*
pVal
)
{
FIXME
(
"Not implemented
\n
"
);
return
E_NOTIMPL
;
BackgroundCopyFileImpl
*
This
=
(
BackgroundCopyFileImpl
*
)
iface
;
int
n
=
(
lstrlenW
(
This
->
info
.
RemoteName
)
+
1
)
*
sizeof
(
WCHAR
);
*
pVal
=
CoTaskMemAlloc
(
n
);
if
(
!*
pVal
)
return
E_OUTOFMEMORY
;
memcpy
(
*
pVal
,
This
->
info
.
RemoteName
,
n
);
return
S_OK
;
}
static
HRESULT
WINAPI
BITS_IBackgroundCopyFile_GetLocalName
(
IBackgroundCopyFile
*
iface
,
LPWSTR
*
pVal
)
{
FIXME
(
"Not implemented
\n
"
);
return
E_NOTIMPL
;
BackgroundCopyFileImpl
*
This
=
(
BackgroundCopyFileImpl
*
)
iface
;
int
n
=
(
lstrlenW
(
This
->
info
.
LocalName
)
+
1
)
*
sizeof
(
WCHAR
);
*
pVal
=
CoTaskMemAlloc
(
n
);
if
(
!*
pVal
)
return
E_OUTOFMEMORY
;
memcpy
(
*
pVal
,
This
->
info
.
LocalName
,
n
);
return
S_OK
;
}
static
HRESULT
WINAPI
BITS_IBackgroundCopyFile_GetProgress
(
...
...
dlls/qmgr/tests/Makefile.in
View file @
4866d1bd
...
...
@@ -7,6 +7,7 @@ IMPORTS = ole32 shlwapi user32 kernel32
CTESTS
=
\
enum_files.c
\
file.c
\
job.c
\
qmgr.c
...
...
dlls/qmgr/tests/file.c
0 → 100644
View file @
4866d1bd
/*
* Unit test suite for Background Copy File 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>
#include <shlwapi.h>
#define COBJMACROS
#include "wine/test.h"
#include "bits.h"
/* Globals used by many tests */
#define NUM_FILES 1
static
const
WCHAR
test_remoteName
[]
=
{
'r'
,
'e'
,
'm'
,
'o'
,
't'
,
'e'
,
0
};
static
const
WCHAR
test_localName
[]
=
{
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
0
};
static
WCHAR
test_localFile
[
MAX_PATH
];
static
WCHAR
test_remoteUrl
[
MAX_PATH
];
static
const
ULONG
test_fileCount
=
NUM_FILES
;
static
const
WCHAR
test_displayName
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
0
};
static
IBackgroundCopyJob
*
test_job
;
static
IBackgroundCopyManager
*
test_manager
;
static
IEnumBackgroundCopyFiles
*
test_enumFiles
;
static
IBackgroundCopyFile
*
test_file
;
/* Helper function to add a file to a job. The helper function takes base
file name and creates properly formed path and URL strings for creation of
the file. */
static
HRESULT
addFileHelper
(
IBackgroundCopyJob
*
job
,
const
WCHAR
*
localName
,
const
WCHAR
*
remoteName
)
{
DWORD
urlSize
;
GetCurrentDirectoryW
(
MAX_PATH
,
test_localFile
);
PathAppendW
(
test_localFile
,
localName
);
GetCurrentDirectoryW
(
MAX_PATH
,
test_remoteUrl
);
PathAppendW
(
test_remoteUrl
,
remoteName
);
urlSize
=
MAX_PATH
;
UrlCreateFromPathW
(
test_remoteUrl
,
test_remoteUrl
,
&
urlSize
,
0
);
UrlUnescapeW
(
test_remoteUrl
,
NULL
,
&
urlSize
,
URL_UNESCAPE_INPLACE
);
return
IBackgroundCopyJob_AddFile
(
test_job
,
test_remoteUrl
,
test_localFile
);
}
/* Generic test setup */
static
BOOL
setup
(
void
)
{
HRESULT
hres
;
GUID
test_jobId
;
test_manager
=
NULL
;
test_job
=
NULL
;
memset
(
&
test_jobId
,
0
,
sizeof
test_jobId
);
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_manager
);
return
FALSE
;
}
if
(
addFileHelper
(
test_job
,
test_localName
,
test_remoteName
)
!=
S_OK
||
IBackgroundCopyJob_EnumFiles
(
test_job
,
&
test_enumFiles
)
!=
S_OK
)
{
IBackgroundCopyJob_Release
(
test_job
);
IBackgroundCopyManager_Release
(
test_manager
);
return
FALSE
;
}
hres
=
IEnumBackgroundCopyFiles_Next
(
test_enumFiles
,
1
,
&
test_file
,
NULL
);
if
(
hres
!=
S_OK
)
{
IEnumBackgroundCopyFiles_Release
(
test_enumFiles
);
IBackgroundCopyJob_Release
(
test_job
);
IBackgroundCopyManager_Release
(
test_manager
);
return
FALSE
;
}
return
TRUE
;
}
/* Generic test cleanup */
static
void
teardown
(
void
)
{
IBackgroundCopyFile_Release
(
test_file
);
IEnumBackgroundCopyFiles_Release
(
test_enumFiles
);
IBackgroundCopyJob_Release
(
test_job
);
IBackgroundCopyManager_Release
(
test_manager
);
}
/* Test that the remote name is properly set */
static
void
test_GetRemoteName
(
void
)
{
HRESULT
hres
;
LPWSTR
name
;
hres
=
IBackgroundCopyFile_GetRemoteName
(
test_file
,
&
name
);
ok
(
hres
==
S_OK
,
"GetRemoteName failed: %08x
\n
"
,
hres
);
if
(
hres
!=
S_OK
)
{
skip
(
"Unable to get remote name of test_file.
\n
"
);
return
;
}
ok
(
lstrcmpW
(
name
,
test_remoteUrl
)
==
0
,
"Got incorrect remote name
\n
"
);
CoTaskMemFree
(
name
);
}
/* Test that the local name is properly set */
static
void
test_GetLocalName
(
void
)
{
HRESULT
hres
;
LPWSTR
name
;
hres
=
IBackgroundCopyFile_GetLocalName
(
test_file
,
&
name
);
ok
(
hres
==
S_OK
,
"GetLocalName failed: %08x
\n
"
,
hres
);
if
(
hres
!=
S_OK
)
{
skip
(
"Unable to get local name of test_file.
\n
"
);
return
;
}
ok
(
lstrcmpW
(
name
,
test_localFile
)
==
0
,
"Got incorrect local name
\n
"
);
CoTaskMemFree
(
name
);
}
typedef
void
(
*
test_t
)(
void
);
START_TEST
(
file
)
{
static
const
test_t
tests
[]
=
{
test_GetRemoteName
,
test_GetLocalName
,
0
};
const
test_t
*
test
;
CoInitialize
(
NULL
);
for
(
test
=
tests
;
*
test
;
++
test
)
{
/* Keep state seperate between tests. */
if
(
!
setup
())
{
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