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
516aac90
Commit
516aac90
authored
Aug 10, 2010
by
Thomas Mullaly
Committed by
Alexandre Julliard
Aug 19, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon/tests: Added a few tests for CreateIUriBuilder.
parent
de11a2a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
11 deletions
+52
-11
uri.c
dlls/urlmon/tests/uri.c
+40
-10
uri.c
dlls/urlmon/uri.c
+12
-1
No files found.
dlls/urlmon/tests/uri.c
View file @
516aac90
...
...
@@ -18,16 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* IUri testing framework goals:
* - Test invalid args
* - invalid flags
* - invalid args (IUri, uri string)
* - Test parsing for components when no canonicalization occurs
* - Test parsing for components when canonicalization occurs.
* - More tests...
*/
#include <wine/test.h>
#include <stdarg.h>
#include <stddef.h>
...
...
@@ -44,6 +34,7 @@
static
HRESULT
(
WINAPI
*
pCreateUri
)(
LPCWSTR
,
DWORD
,
DWORD_PTR
,
IUri
**
);
static
HRESULT
(
WINAPI
*
pCreateUriWithFragment
)(
LPCWSTR
,
LPCWSTR
,
DWORD
,
DWORD_PTR
,
IUri
**
);
static
HRESULT
(
WINAPI
*
pCreateIUriBuilder
)(
IUri
*
,
DWORD
,
DWORD_PTR
,
IUriBuilder
**
);
static
const
WCHAR
http_urlW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'w'
,
'w'
,
'w'
,
'.'
,
'w'
,
'i'
,
'n'
,
'e'
,
'h'
,
'q'
,
'.'
,
'o'
,
'r'
,
'g'
,
'/'
,
0
};
...
...
@@ -3756,6 +3747,11 @@ static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
return
ret
;
}
static
inline
ULONG
get_refcnt
(
IUri
*
uri
)
{
IUri_AddRef
(
uri
);
return
IUri_Release
(
uri
);
}
/*
* Simple tests to make sure the CreateUri function handles invalid flag combinations
* correctly.
...
...
@@ -4884,12 +4880,43 @@ static void test_CreateUriWithFragment(void) {
}
}
static
void
test_CreateIUriBuilder
(
void
)
{
HRESULT
hr
;
IUriBuilder
*
builder
=
NULL
;
IUri
*
uri
;
hr
=
pCreateIUriBuilder
(
NULL
,
0
,
0
,
NULL
);
ok
(
hr
==
E_POINTER
,
"Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x
\n
"
,
hr
,
E_POINTER
);
/* CreateIUriBuilder increases the ref count of the IUri it receives. */
hr
=
pCreateUri
(
http_urlW
,
0
,
0
,
&
uri
);
ok
(
hr
==
S_OK
,
"Error: CreateUri returned 0x%08x, expected 0x%08x.
\n
"
,
hr
,
S_OK
);
if
(
SUCCEEDED
(
hr
))
{
ULONG
cur_count
,
orig_count
;
orig_count
=
get_refcnt
(
uri
);
hr
=
pCreateIUriBuilder
(
uri
,
0
,
0
,
&
builder
);
ok
(
hr
==
S_OK
,
"Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.
\n
"
,
hr
,
S_OK
);
ok
(
builder
!=
NULL
,
"Error: Expecting builder not to be NULL
\n
"
);
cur_count
=
get_refcnt
(
uri
);
ok
(
cur_count
==
orig_count
+
1
,
"Error: Expected the ref count to be %u, but was %u instead.
\n
"
,
orig_count
+
1
,
cur_count
);
if
(
builder
)
IUriBuilder_Release
(
builder
);
cur_count
=
get_refcnt
(
uri
);
ok
(
cur_count
==
orig_count
,
"Error: Expected the ref count to be %u, but was %u instead.
\n
"
,
orig_count
,
cur_count
);
}
if
(
uri
)
IUri_Release
(
uri
);
}
START_TEST
(
uri
)
{
HMODULE
hurlmon
;
hurlmon
=
GetModuleHandle
(
"urlmon.dll"
);
pCreateUri
=
(
void
*
)
GetProcAddress
(
hurlmon
,
"CreateUri"
);
pCreateUriWithFragment
=
(
void
*
)
GetProcAddress
(
hurlmon
,
"CreateUriWithFragment"
);
pCreateIUriBuilder
=
(
void
*
)
GetProcAddress
(
hurlmon
,
"CreateIUriBuilder"
);
if
(
!
pCreateUri
)
{
win_skip
(
"CreateUri is not present, skipping tests.
\n
"
);
...
...
@@ -4937,4 +4964,7 @@ START_TEST(uri) {
trace
(
"test CreateUriWithFragment...
\n
"
);
test_CreateUriWithFragment
();
trace
(
"test CreateIUriBuilder...
\n
"
);
test_CreateIUriBuilder
();
}
dlls/urlmon/uri.c
View file @
516aac90
...
...
@@ -75,6 +75,8 @@ typedef struct {
typedef
struct
{
const
IUriBuilderVtbl
*
lpIUriBuilderVtbl
;
LONG
ref
;
IUri
*
uri
;
}
UriBuilder
;
typedef
struct
{
...
...
@@ -4080,8 +4082,10 @@ static ULONG WINAPI UriBuilder_Release(IUriBuilder *iface)
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
if
(
!
ref
)
if
(
!
ref
)
{
if
(
This
->
uri
)
IUri_Release
(
This
->
uri
);
heap_free
(
This
);
}
return
ref
;
}
...
...
@@ -4300,6 +4304,9 @@ HRESULT WINAPI CreateIUriBuilder(IUri *pIUri, DWORD dwFlags, DWORD_PTR dwReserve
TRACE
(
"(%p %x %x %p)
\n
"
,
pIUri
,
dwFlags
,
(
DWORD
)
dwReserved
,
ppIUriBuilder
);
if
(
!
ppIUriBuilder
)
return
E_POINTER
;
ret
=
heap_alloc
(
sizeof
(
UriBuilder
));
if
(
!
ret
)
return
E_OUTOFMEMORY
;
...
...
@@ -4307,6 +4314,10 @@ HRESULT WINAPI CreateIUriBuilder(IUri *pIUri, DWORD dwFlags, DWORD_PTR dwReserve
ret
->
lpIUriBuilderVtbl
=
&
UriBuilderVtbl
;
ret
->
ref
=
1
;
ret
->
uri
=
pIUri
;
if
(
pIUri
)
IUri_AddRef
(
pIUri
);
*
ppIUriBuilder
=
URIBUILDER
(
ret
);
return
S_OK
;
}
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