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
284796e4
Commit
284796e4
authored
Sep 08, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 09, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added javascript protocol tests.
parent
f66e95c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
117 additions
and
0 deletions
+117
-0
protocol.c
dlls/mshtml/tests/protocol.c
+117
-0
No files found.
dlls/mshtml/tests/protocol.c
View file @
284796e4
...
...
@@ -20,6 +20,7 @@
#include <wine/test.h>
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
...
...
@@ -56,6 +57,7 @@
DEFINE_GUID
(
CLSID_ResProtocol
,
0x3050F3BC
,
0x98B5
,
0x11CF
,
0xBB
,
0x82
,
0x00
,
0xAA
,
0x00
,
0xBD
,
0xCE
,
0x0B
);
DEFINE_GUID
(
CLSID_AboutProtocol
,
0x3050F406
,
0x98B5
,
0x11CF
,
0xBB
,
0x82
,
0x00
,
0xAA
,
0x00
,
0xBD
,
0xCE
,
0x0B
);
DEFINE_GUID
(
CLSID_JSProtocol
,
0x3050F3B2
,
0x98B5
,
0x11CF
,
0xBB
,
0x82
,
0x00
,
0xAA
,
0x00
,
0xBD
,
0xCE
,
0x0B
);
DEFINE_EXPECT
(
GetBindInfo
);
DEFINE_EXPECT
(
ReportProgress
);
...
...
@@ -69,6 +71,19 @@ static DWORD bindf;
static
const
WCHAR
about_blank_url
[]
=
{
'a'
,
'b'
,
'o'
,
'u'
,
't'
,
':'
,
'b'
,
'l'
,
'a'
,
'n'
,
'k'
,
0
};
static
const
WCHAR
about_test_url
[]
=
{
'a'
,
'b'
,
'o'
,
'u'
,
't'
,
':'
,
't'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
about_res_url
[]
=
{
'r'
,
'e'
,
's'
,
':'
,
'b'
,
'l'
,
'a'
,
'n'
,
'k'
,
0
};
static
const
WCHAR
javascript_test_url
[]
=
{
'j'
,
'a'
,
'v'
,
'a'
,
's'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
':'
,
't'
,
'e'
,
's'
,
't'
,
'('
,
')'
,
0
};
static
const
char
*
debugstr_guid
(
REFIID
riid
)
{
static
char
buf
[
50
];
sprintf
(
buf
,
"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"
,
riid
->
Data1
,
riid
->
Data2
,
riid
->
Data3
,
riid
->
Data4
[
0
],
riid
->
Data4
[
1
],
riid
->
Data4
[
2
],
riid
->
Data4
[
3
],
riid
->
Data4
[
4
],
riid
->
Data4
[
5
],
riid
->
Data4
[
6
],
riid
->
Data4
[
7
]);
return
buf
;
}
static
HRESULT
WINAPI
ProtocolSink_QueryInterface
(
IInternetProtocolSink
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
...
...
@@ -76,6 +91,9 @@ static HRESULT WINAPI ProtocolSink_QueryInterface(IInternetProtocolSink *iface,
*
ppv
=
iface
;
return
S_OK
;
}
*
ppv
=
NULL
;
ok
(
0
,
"unexpected riid %s
\n
"
,
debugstr_guid
(
riid
));
return
E_NOINTERFACE
;
}
...
...
@@ -160,6 +178,9 @@ static HRESULT WINAPI BindInfo_QueryInterface(IInternetBindInfo *iface, REFIID r
*
ppv
=
iface
;
return
S_OK
;
}
*
ppv
=
NULL
;
ok
(
0
,
"unexpected riid %s
\n
"
,
debugstr_guid
(
riid
));
return
E_NOINTERFACE
;
}
...
...
@@ -773,12 +794,108 @@ static void test_about_protocol(void)
IUnknown_Release
(
unk
);
}
static
void
test_javascript_protocol
(
void
)
{
IInternetProtocolInfo
*
protocol_info
;
IUnknown
*
unk
;
IClassFactory
*
factory
;
HRESULT
hres
;
hres
=
CoGetClassObject
(
&
CLSID_JSProtocol
,
CLSCTX_INPROC_SERVER
,
NULL
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
ok
(
hres
==
S_OK
,
"CoGetClassObject failed: %08x
\n
"
,
hres
);
if
(
FAILED
(
hres
))
return
;
hres
=
IUnknown_QueryInterface
(
unk
,
&
IID_IInternetProtocolInfo
,
(
void
**
)
&
protocol_info
);
ok
(
hres
==
S_OK
,
"Could not get IInternetProtocolInfo interface: %08x
\n
"
,
hres
);
if
(
SUCCEEDED
(
hres
))
{
WCHAR
buf
[
128
];
DWORD
size
;
int
i
;
for
(
i
=
PARSE_CANONICALIZE
;
i
<=
PARSE_UNESCAPE
;
i
++
)
{
if
(
i
!=
PARSE_SECURITY_URL
&&
i
!=
PARSE_DOMAIN
)
{
hres
=
IInternetProtocolInfo_ParseUrl
(
protocol_info
,
javascript_test_url
,
i
,
0
,
buf
,
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]),
&
size
,
0
);
ok
(
hres
==
INET_E_DEFAULT_ACTION
,
"[%d] failed: %08x, expected INET_E_DEFAULT_ACTION
\n
"
,
i
,
hres
);
}
}
hres
=
IInternetProtocolInfo_ParseUrl
(
protocol_info
,
javascript_test_url
,
PARSE_UNESCAPE
+
1
,
0
,
buf
,
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]),
&
size
,
0
);
ok
(
hres
==
INET_E_DEFAULT_ACTION
,
"ParseUrl failed: %08x, expected INET_E_DEFAULT_ACTION
\n
"
,
hres
);
size
=
0xdeadbeef
;
hres
=
IInternetProtocolInfo_CombineUrl
(
protocol_info
,
javascript_test_url
,
javascript_test_url
,
0
,
buf
,
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]),
&
size
,
0
);
ok
(
hres
==
INET_E_USE_DEFAULT_PROTOCOLHANDLER
,
"CombineUrl failed: %08x
\n
"
,
hres
);
ok
(
size
==
0xdeadbeef
,
"size=%d
\n
"
,
size
);
hres
=
IInternetProtocolInfo_CompareUrl
(
protocol_info
,
javascript_test_url
,
javascript_test_url
,
0
);
ok
(
hres
==
E_NOTIMPL
,
"CompareUrl failed: %08x
\n
"
,
hres
);
for
(
i
=
0
;
i
<
30
;
i
++
)
{
switch
(
i
)
{
case
QUERY_USES_NETWORK
:
case
QUERY_IS_SECURE
:
break
;
default:
hres
=
IInternetProtocolInfo_QueryInfo
(
protocol_info
,
javascript_test_url
,
i
,
0
,
buf
,
sizeof
(
buf
),
&
size
,
0
);
ok
(
hres
==
INET_E_USE_DEFAULT_PROTOCOLHANDLER
,
"QueryInfo(%d) returned: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER
\n
"
,
i
,
hres
);
}
}
memset
(
buf
,
'?'
,
sizeof
(
buf
));
hres
=
IInternetProtocolInfo_QueryInfo
(
protocol_info
,
javascript_test_url
,
QUERY_USES_NETWORK
,
0
,
buf
,
sizeof
(
buf
),
&
size
,
0
);
ok
(
hres
==
S_OK
,
"QueryInfo(QUERY_USES_NETWORK) failed: %08x
\n
"
,
hres
);
ok
(
size
==
sizeof
(
DWORD
),
"size=%d
\n
"
,
size
);
ok
(
!*
(
DWORD
*
)
buf
,
"buf=%d
\n
"
,
*
(
DWORD
*
)
buf
);
memset
(
buf
,
'?'
,
sizeof
(
buf
));
hres
=
IInternetProtocolInfo_QueryInfo
(
protocol_info
,
javascript_test_url
,
QUERY_USES_NETWORK
,
0
,
buf
,
sizeof
(
buf
),
NULL
,
0
);
ok
(
hres
==
S_OK
,
"QueryInfo(QUERY_USES_NETWORK) failed: %08x
\n
"
,
hres
);
ok
(
!*
(
DWORD
*
)
buf
,
"buf=%d
\n
"
,
*
(
DWORD
*
)
buf
);
hres
=
IInternetProtocolInfo_QueryInfo
(
protocol_info
,
javascript_test_url
,
QUERY_USES_NETWORK
,
0
,
buf
,
3
,
&
size
,
0
);
ok
(
hres
==
E_FAIL
,
"QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL
\n
"
,
hres
);
hres
=
IInternetProtocolInfo_QueryInfo
(
protocol_info
,
javascript_test_url
,
QUERY_USES_NETWORK
,
0
,
NULL
,
sizeof
(
buf
),
&
size
,
0
);
ok
(
hres
==
E_FAIL
,
"QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL
\n
"
,
hres
);
hres
=
IInternetProtocolInfo_QueryInfo
(
protocol_info
,
javascript_test_url
,
60
,
0
,
NULL
,
sizeof
(
buf
),
&
size
,
0
);
ok
(
hres
==
INET_E_USE_DEFAULT_PROTOCOLHANDLER
,
"QueryInfo failed: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER
\n
"
,
hres
);
/* FIXME: test QUERY_IS_SECURE */
IInternetProtocolInfo_Release
(
protocol_info
);
}
hres
=
IUnknown_QueryInterface
(
unk
,
&
IID_IClassFactory
,
(
void
**
)
&
factory
);
ok
(
hres
==
S_OK
,
"Could not get IClassFactory interface
\n
"
);
if
(
SUCCEEDED
(
hres
))
IClassFactory_Release
(
factory
);
IUnknown_Release
(
unk
);
}
START_TEST
(
protocol
)
{
OleInitialize
(
NULL
);
test_res_protocol
();
test_about_protocol
();
test_javascript_protocol
();
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