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
6489a1c2
Commit
6489a1c2
authored
Jan 13, 2007
by
Jacek Caban
Committed by
Alexandre Julliard
Jan 15, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
itss: Added more protocol tests.
parent
05d2aa45
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
10 deletions
+67
-10
protocol.c
dlls/itss/tests/protocol.c
+67
-10
No files found.
dlls/itss/tests/protocol.c
View file @
6489a1c2
...
...
@@ -60,11 +60,18 @@ DEFINE_EXPECT(GetBindInfo);
DEFINE_EXPECT
(
ReportProgress_BEGINDOWNLOADDATA
);
DEFINE_EXPECT
(
ReportProgress_SENDINGREQUEST
);
DEFINE_EXPECT
(
ReportProgress_MIMETYPEAVAILABLE
);
DEFINE_EXPECT
(
ReportProgress_CACHEFILENAMEAVAIABLE
);
DEFINE_EXPECT
(
ReportProgress_DIRECTBIND
);
DEFINE_EXPECT
(
ReportData
);
DEFINE_EXPECT
(
ReportResult
);
static
HRESULT
expect_hrResult
;
static
enum
{
ITS_PROTOCOL
,
MK_PROTOCOL
}
test_protocol
;
static
HRESULT
WINAPI
ProtocolSink_QueryInterface
(
IInternetProtocolSink
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
if
(
IsEqualGUID
(
&
IID_IUnknown
,
riid
)
||
IsEqualGUID
(
&
IID_IInternetProtocolSink
,
riid
))
{
...
...
@@ -95,6 +102,8 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
{
static
const
WCHAR
blank_html
[]
=
{
'b'
,
'l'
,
'a'
,
'n'
,
'k'
,
'.'
,
'h'
,
't'
,
'm'
,
'l'
,
0
};
static
const
WCHAR
text_html
[]
=
{
't'
,
'e'
,
'x'
,
't'
,
'/'
,
'h'
,
't'
,
'm'
,
'l'
,
0
};
static
const
WCHAR
cache_file
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'.'
,
'c'
,
'h'
,
'm'
,
':'
,
':'
,
'/'
,
'b'
,
'l'
,
'a'
,
'n'
,
'k'
,
'.'
,
'h'
,
't'
,
'm'
,
'l'
,
0
};
switch
(
ulStatusCode
)
{
case
BINDSTATUS_BEGINDOWNLOADDATA
:
...
...
@@ -103,12 +112,23 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
break
;
case
BINDSTATUS_SENDINGREQUEST
:
CHECK_EXPECT
(
ReportProgress_SENDINGREQUEST
);
ok
(
!
lstrcmpW
(
szStatusText
,
blank_html
),
"unexpected szStatusText
\n
"
);
if
(
test_protocol
==
ITS_PROTOCOL
)
ok
(
!
lstrcmpW
(
szStatusText
,
blank_html
),
"unexpected szStatusText
\n
"
);
else
ok
(
szStatusText
==
NULL
,
"szStatusText != NULL
\n
"
);
break
;
case
BINDSTATUS_MIMETYPEAVAILABLE
:
CHECK_EXPECT
(
ReportProgress_MIMETYPEAVAILABLE
);
ok
(
!
lstrcmpW
(
szStatusText
,
text_html
),
"unexpected szStatusText
\n
"
);
break
;
case
BINDSTATUS_CACHEFILENAMEAVAILABLE
:
CHECK_EXPECT
(
ReportProgress_CACHEFILENAMEAVAIABLE
);
ok
(
!
lstrcmpW
(
szStatusText
,
cache_file
),
"unexpected szStatusText
\n
"
);
break
;
case
BINDSTATUS_DIRECTBIND
:
CHECK_EXPECT
(
ReportProgress_DIRECTBIND
);
ok
(
!
szStatusText
,
"szStatusText != NULL
\n
"
);
break
;
default:
ok
(
0
,
"unexpected ulStatusCode %d
\n
"
,
ulStatusCode
);
break
;
...
...
@@ -123,7 +143,10 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
CHECK_EXPECT
(
ReportData
);
ok
(
ulProgress
==
ulProgressMax
,
"ulProgress != ulProgressMax
\n
"
);
ok
(
grfBSCF
==
(
BSCF_FIRSTDATANOTIFICATION
|
BSCF_DATAFULLYAVAILABLE
),
"grcf = %08x
\n
"
,
grfBSCF
);
if
(
test_protocol
==
ITS_PROTOCOL
)
ok
(
grfBSCF
==
(
BSCF_FIRSTDATANOTIFICATION
|
BSCF_DATAFULLYAVAILABLE
),
"grcf = %08x
\n
"
,
grfBSCF
);
else
ok
(
grfBSCF
==
(
BSCF_FIRSTDATANOTIFICATION
|
BSCF_LASTDATANOTIFICATION
),
"grcf = %08x
\n
"
,
grfBSCF
);
return
S_OK
;
}
...
...
@@ -225,10 +248,15 @@ static void protocol_start(IInternetProtocol *protocol, LPCWSTR url)
HRESULT
hres
;
SET_EXPECT
(
GetBindInfo
);
if
(
test_protocol
==
MK_PROTOCOL
)
SET_EXPECT
(
ReportProgress_DIRECTBIND
);
SET_EXPECT
(
ReportProgress_SENDINGREQUEST
);
SET_EXPECT
(
ReportProgress_MIMETYPEAVAILABLE
);
if
(
test_protocol
==
MK_PROTOCOL
)
SET_EXPECT
(
ReportProgress_CACHEFILENAMEAVAIABLE
);
SET_EXPECT
(
ReportData
);
SET_EXPECT
(
ReportProgress_BEGINDOWNLOADDATA
);
if
(
test_protocol
==
ITS_PROTOCOL
)
SET_EXPECT
(
ReportProgress_BEGINDOWNLOADDATA
);
SET_EXPECT
(
ReportResult
);
expect_hrResult
=
S_OK
;
...
...
@@ -236,14 +264,19 @@ static void protocol_start(IInternetProtocol *protocol, LPCWSTR url)
ok
(
hres
==
S_OK
,
"Start failed: %08x
\n
"
,
hres
);
CHECK_CALLED
(
GetBindInfo
);
if
(
test_protocol
==
MK_PROTOCOL
)
CHECK_CALLED
(
ReportProgress_DIRECTBIND
);
CHECK_CALLED
(
ReportProgress_SENDINGREQUEST
);
CHECK_CALLED
(
ReportProgress_MIMETYPEAVAILABLE
);
if
(
test_protocol
==
MK_PROTOCOL
)
SET_EXPECT
(
ReportProgress_CACHEFILENAMEAVAIABLE
);
CHECK_CALLED
(
ReportData
);
CHECK_CALLED
(
ReportProgress_BEGINDOWNLOADDATA
);
if
(
test_protocol
==
ITS_PROTOCOL
)
CHECK_CALLED
(
ReportProgress_BEGINDOWNLOADDATA
);
CHECK_CALLED
(
ReportResult
);
}
static
void
test_
its_
protocol_url
(
IClassFactory
*
factory
,
LPCWSTR
url
)
static
void
test_protocol_url
(
IClassFactory
*
factory
,
LPCWSTR
url
)
{
IInternetProtocol
*
protocol
;
BYTE
buf
[
512
];
...
...
@@ -270,8 +303,8 @@ static void test_its_protocol_url(IClassFactory *factory, LPCWSTR url)
cb
=
0xdeadbeef
;
hres
=
IInternetProtocol_Read
(
protocol
,
buf
,
sizeof
(
buf
),
&
cb
);
ok
(
hres
==
INET_E_DATA_NOT_AVAILABLE
,
"Read returned %08x
expected INET_E_DATA_NOT_AVAILABLE
\n
"
,
hres
);
ok
(
hres
==
(
test_protocol
==
ITS_PROTOCOL
?
INET_E_DATA_NOT_AVAILABLE
:
E_FAIL
)
,
"Read returned %08x
\n
"
,
hres
);
ok
(
cb
==
0xdeadbeef
,
"cb=%u expected 0xdeadbeef
\n
"
,
cb
);
protocol_start
(
protocol
,
url
);
...
...
@@ -358,6 +391,8 @@ static void test_its_protocol(void)
static
const
WCHAR
wrong_url5
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
,
't'
,
'e'
,
's'
,
'.'
,
'c'
,
'h'
,
'm'
,
':'
,
':'
,
'/'
,
'b'
,
'l'
,
'a'
,
'n'
,
'k'
,
'.'
,
'h'
,
't'
,
'm'
,
'l'
,
0
};
test_protocol
=
ITS_PROTOCOL
;
hres
=
CoGetClassObject
(
&
CLSID_ITSProtocol
,
CLSCTX_INPROC_SERVER
,
NULL
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
ok
(
hres
==
S_OK
,
"CoGetClassObject failed: %08x
\n
"
,
hres
);
if
(
!
SUCCEEDED
(
hres
))
...
...
@@ -386,9 +421,9 @@ static void test_its_protocol(void)
ref
=
IInternetProtocol_Release
(
protocol
);
ok
(
!
ref
,
"protocol ref=%d
\n
"
,
ref
);
test_
its_
protocol_url
(
factory
,
blank_url1
);
test_
its_
protocol_url
(
factory
,
blank_url2
);
test_
its_
protocol_url
(
factory
,
blank_url3
);
test_protocol_url
(
factory
,
blank_url1
);
test_protocol_url
(
factory
,
blank_url2
);
test_protocol_url
(
factory
,
blank_url3
);
}
IClassFactory_Release
(
factory
);
...
...
@@ -397,6 +432,27 @@ static void test_its_protocol(void)
IUnknown_Release
(
unk
);
}
static
void
test_mk_protocol
(
void
)
{
IClassFactory
*
cf
;
HRESULT
hres
;
static
const
WCHAR
blank_url
[]
=
{
'm'
,
'k'
,
':'
,
'@'
,
'M'
,
'S'
,
'I'
,
'T'
,
'S'
,
't'
,
'o'
,
'r'
,
'e'
,
':'
,
't'
,
'e'
,
's'
,
't'
,
'.'
,
'c'
,
'h'
,
'm'
,
':'
,
':'
,
'/'
,
'b'
,
'l'
,
'a'
,
'n'
,
'k'
,
'.'
,
'h'
,
't'
,
'm'
,
'l'
,
0
};
test_protocol
=
MK_PROTOCOL
;
hres
=
CoGetClassObject
(
&
CLSID_MkProtocol
,
CLSCTX_INPROC_SERVER
,
NULL
,
&
IID_IClassFactory
,
(
void
**
)
&
cf
);
ok
(
hres
==
S_OK
,
"CoGetClassObject failed: %08x
\n
"
,
hres
);
if
(
!
SUCCEEDED
(
hres
))
return
;
test_protocol_url
(
cf
,
blank_url
);
IClassFactory_Release
(
cf
);
}
static
BOOL
create_chm
(
void
)
{
HANDLE
file
;
...
...
@@ -433,6 +489,7 @@ START_TEST(protocol)
return
;
test_its_protocol
();
test_mk_protocol
();
delete_chm
();
OleUninitialize
();
...
...
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