mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 12:22:22 +00:00
[URLMON_WINETEST]
sync urlmon_winetest to wine 1.1.39 svn path=/trunk/; revision=45885
This commit is contained in:
parent
5df3fe3f82
commit
38a74f7e1e
5 changed files with 267 additions and 98 deletions
|
@ -270,6 +270,10 @@ static const WCHAR wszHttp[] = {'h','t','t','p',0};
|
|||
static const WCHAR wszAbout[] = {'a','b','o','u','t',0};
|
||||
static const WCHAR wszEmpty[] = {0};
|
||||
|
||||
static const WCHAR wszWineHQ[] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
|
||||
static const WCHAR wszHttpWineHQ[] = {'h','t','t','p',':','/','/','w','w','w','.',
|
||||
'w','i','n','e','h','q','.','o','r','g',0};
|
||||
|
||||
struct parse_test {
|
||||
LPCWSTR url;
|
||||
HRESULT secur_hres;
|
||||
|
@ -277,15 +281,19 @@ struct parse_test {
|
|||
HRESULT path_hres;
|
||||
LPCWSTR path;
|
||||
LPCWSTR schema;
|
||||
LPCWSTR domain;
|
||||
HRESULT domain_hres;
|
||||
LPCWSTR rootdocument;
|
||||
HRESULT rootdocument_hres;
|
||||
};
|
||||
|
||||
static const struct parse_test parse_tests[] = {
|
||||
{url1, S_OK, url1, E_INVALIDARG, NULL, wszRes},
|
||||
{url2, E_FAIL, url2, E_INVALIDARG, NULL, wszEmpty},
|
||||
{url3, E_FAIL, url3, S_OK, path3, wszFile},
|
||||
{url4, E_FAIL, url4e, S_OK, path4, wszFile},
|
||||
{url5, E_FAIL, url5, E_INVALIDARG, NULL, wszHttp},
|
||||
{url6, S_OK, url6, E_INVALIDARG, NULL, wszAbout}
|
||||
{url1, S_OK, url1, E_INVALIDARG, NULL, wszRes, NULL, E_FAIL, NULL, E_FAIL},
|
||||
{url2, E_FAIL, url2, E_INVALIDARG, NULL, wszEmpty, NULL, E_FAIL, NULL, E_FAIL},
|
||||
{url3, E_FAIL, url3, S_OK, path3, wszFile, wszEmpty, S_OK, NULL, E_FAIL},
|
||||
{url4, E_FAIL, url4e, S_OK, path4, wszFile, wszEmpty, S_OK, NULL, E_FAIL},
|
||||
{url5, E_FAIL, url5, E_INVALIDARG, NULL, wszHttp, wszWineHQ, S_OK, wszHttpWineHQ, S_OK},
|
||||
{url6, S_OK, url6, E_INVALIDARG, NULL, wszAbout, NULL, E_FAIL, NULL, E_FAIL},
|
||||
};
|
||||
|
||||
static void test_CoInternetParseUrl(void)
|
||||
|
@ -331,6 +339,23 @@ static void test_CoInternetParseUrl(void)
|
|||
ok(hres == S_OK, "[%d] schema failed: %08x\n", i, hres);
|
||||
ok(size == lstrlenW(parse_tests[i].schema), "[%d] wrong size\n", i);
|
||||
ok(!lstrcmpW(parse_tests[i].schema, buf), "[%d] wrong schema\n", i);
|
||||
|
||||
if(memcmp(parse_tests[i].url, wszRes, 3*sizeof(WCHAR))
|
||||
&& memcmp(parse_tests[i].url, wszAbout, 5*sizeof(WCHAR))) {
|
||||
memset(buf, 0xf0, sizeof(buf));
|
||||
hres = CoInternetParseUrl(parse_tests[i].url, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(WCHAR), &size, 0);
|
||||
ok(hres == parse_tests[i].domain_hres, "[%d] domain failed: %08x\n", i, hres);
|
||||
if(parse_tests[i].domain)
|
||||
ok(!lstrcmpW(parse_tests[i].domain, buf), "[%d] wrong domain, received %s\n", i, wine_dbgstr_w(buf));
|
||||
}
|
||||
|
||||
memset(buf, 0xf0, sizeof(buf));
|
||||
hres = CoInternetParseUrl(parse_tests[i].url, PARSE_ROOTDOCUMENT, 0, buf,
|
||||
sizeof(buf)/sizeof(WCHAR), &size, 0);
|
||||
ok(hres == parse_tests[i].rootdocument_hres, "[%d] rootdocument failed: %08x\n", i, hres);
|
||||
if(parse_tests[i].rootdocument)
|
||||
ok(!lstrcmpW(parse_tests[i].rootdocument, buf), "[%d] wrong rootdocument, received %s\n", i, wine_dbgstr_w(buf));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -755,7 +780,19 @@ static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface
|
|||
PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
|
||||
DWORD *pcchResult, DWORD dwReserved)
|
||||
{
|
||||
CHECK_EXPECT(ParseUrl);
|
||||
CHECK_EXPECT2(ParseUrl);
|
||||
|
||||
if(ParseAction == PARSE_SECURITY_URL) {
|
||||
if(pcchResult)
|
||||
*pcchResult = sizeof(url1)/sizeof(WCHAR);
|
||||
|
||||
if(cchResult<sizeof(url1)/sizeof(WCHAR))
|
||||
return S_FALSE;
|
||||
|
||||
memcpy(pwzResult, url1, sizeof(url1));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -800,7 +837,7 @@ static IClassFactory *expect_cf;
|
|||
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
|
||||
CHECK_EXPECT(QI_IInternetProtocolInfo);
|
||||
CHECK_EXPECT2(QI_IInternetProtocolInfo);
|
||||
ok(iface == expect_cf, "unexpected iface\n");
|
||||
*ppv = &protocol_info;
|
||||
return qiret;
|
||||
|
@ -871,6 +908,7 @@ static void test_NameSpace(void)
|
|||
{
|
||||
IInternetSession *session;
|
||||
WCHAR buf[200];
|
||||
LPWSTR sec_url;
|
||||
DWORD size;
|
||||
HRESULT hres;
|
||||
|
||||
|
@ -918,6 +956,34 @@ static void test_NameSpace(void)
|
|||
CHECK_CALLED(QI_IInternetProtocolInfo);
|
||||
CHECK_CALLED(ParseUrl);
|
||||
|
||||
SET_EXPECT(QI_IInternetProtocolInfo);
|
||||
SET_EXPECT(ParseUrl);
|
||||
|
||||
hres = CoInternetParseUrl(url8, PARSE_SECURITY_URL, 0, buf,
|
||||
sizeof(buf)/sizeof(WCHAR), &size, 0);
|
||||
ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
|
||||
ok(size == sizeof(url1)/sizeof(WCHAR), "Size = %d\n", size);
|
||||
if(size == sizeof(url1)/sizeof(WCHAR))
|
||||
ok(!memcmp(buf, url1, sizeof(url1)), "Encoded url = %s\n", wine_dbgstr_w(buf));
|
||||
|
||||
CHECK_CALLED(QI_IInternetProtocolInfo);
|
||||
CHECK_CALLED(ParseUrl);
|
||||
|
||||
SET_EXPECT(QI_IInternetProtocolInfo);
|
||||
SET_EXPECT(ParseUrl);
|
||||
|
||||
hres = CoInternetGetSecurityUrl(url8, &sec_url, PSU_SECURITY_URL_ONLY, 0);
|
||||
ok(hres == S_OK, "CoInternetGetSecurityUrl failed: %08x\n", hres);
|
||||
if(hres == S_OK) {
|
||||
ok(lstrlenW(sec_url)>sizeof(wszFile)/sizeof(WCHAR) &&
|
||||
!memcmp(sec_url, wszFile, sizeof(wszFile)-sizeof(WCHAR)),
|
||||
"Encoded url = %s\n", wine_dbgstr_w(sec_url));
|
||||
CoTaskMemFree(sec_url);
|
||||
}
|
||||
|
||||
CHECK_CALLED(QI_IInternetProtocolInfo);
|
||||
CHECK_CALLED(ParseUrl);
|
||||
|
||||
hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
|
||||
ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ static const WCHAR gzipW[] = {'g','z','i','p',0};
|
|||
static HRESULT expect_hrResult;
|
||||
static LPCWSTR file_name, http_url, expect_wsz;
|
||||
static IInternetProtocol *async_protocol = NULL;
|
||||
static BOOL first_data_notif, http_is_first, http_post_test;
|
||||
static BOOL first_data_notif, http_is_first, http_post_test, test_redirect;
|
||||
static int state = 0, prot_state, read_report_data;
|
||||
static DWORD bindf, ex_priority , pi;
|
||||
static IInternetProtocol *binding_protocol, *filtered_protocol;
|
||||
|
@ -442,19 +442,23 @@ static void call_continue(PROTOCOLDATA *protocol_data)
|
|||
CLEAR_CALLED(ReportProgress_FINDINGRESOURCE);
|
||||
CLEAR_CALLED(ReportProgress_CONNECTING);
|
||||
CLEAR_CALLED(ReportProgress_PROXYDETECTING);
|
||||
} else todo_wine {
|
||||
CHECK_NOT_CALLED(ReportProgress_FINDINGRESOURCE);
|
||||
/* IE7 does call this */
|
||||
CLEAR_CALLED(ReportProgress_CONNECTING);
|
||||
}
|
||||
}else if(test_redirect) {
|
||||
CHECK_CALLED(ReportProgress_FINDINGRESOURCE);
|
||||
}else todo_wine {
|
||||
CHECK_NOT_CALLED(ReportProgress_FINDINGRESOURCE);
|
||||
/* IE7 does call this */
|
||||
CLEAR_CALLED(ReportProgress_CONNECTING);
|
||||
}
|
||||
}
|
||||
if(tested_protocol == FTP_TEST)
|
||||
todo_wine CHECK_CALLED(ReportProgress_SENDINGREQUEST);
|
||||
else if (tested_protocol != HTTPS_TEST)
|
||||
CHECK_CALLED(ReportProgress_SENDINGREQUEST);
|
||||
if(test_redirect)
|
||||
CHECK_CALLED(ReportProgress_REDIRECTING);
|
||||
if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST) {
|
||||
SET_EXPECT(OnResponse);
|
||||
if(tested_protocol == HTTPS_TEST)
|
||||
if(tested_protocol == HTTPS_TEST || test_redirect)
|
||||
SET_EXPECT(ReportProgress_ACCEPTRANGES);
|
||||
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
|
||||
if(bindf & BINDF_NEEDFILE)
|
||||
|
@ -478,6 +482,8 @@ static void call_continue(PROTOCOLDATA *protocol_data)
|
|||
CHECK_CALLED(OnResponse);
|
||||
if(tested_protocol == HTTPS_TEST)
|
||||
CHECK_CALLED(ReportProgress_ACCEPTRANGES);
|
||||
else if(test_redirect)
|
||||
CLEAR_CALLED(ReportProgress_ACCEPTRANGES);
|
||||
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
|
||||
if(bindf & BINDF_NEEDFILE)
|
||||
CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
|
||||
|
@ -616,7 +622,10 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
|
|||
break;
|
||||
case BINDSTATUS_REDIRECTING:
|
||||
CHECK_EXPECT(ReportProgress_REDIRECTING);
|
||||
ok(szStatusText == NULL, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
|
||||
if(test_redirect)
|
||||
ok(!strcmp_wa(szStatusText, "http://test.winehq.org/hello.html"), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
|
||||
else
|
||||
ok(szStatusText == NULL, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
|
||||
break;
|
||||
case BINDSTATUS_ENCODING:
|
||||
CHECK_EXPECT(ReportProgress_ENCODING);
|
||||
|
@ -1346,6 +1355,7 @@ static HRESULT WINAPI ProtocolEmul_Start(IInternetProtocol *iface, LPCWSTR szUrl
|
|||
"GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08x\n", hres);
|
||||
ok(fetched == 1, "fetched = %d, expected 1\n", fetched);
|
||||
ok(!strcmp_ww(acc_mimeW, accept_mimes[0]), "unexpected mimes %s\n", wine_dbgstr_w(accept_mimes[0]));
|
||||
CoTaskMemFree(accept_mimes[0]);
|
||||
|
||||
hres = IInternetBindInfo_QueryInterface(pOIBindInfo, &IID_IServiceProvider,
|
||||
(void**)&service_provider);
|
||||
|
@ -1952,6 +1962,7 @@ static IClassFactory mimefilter_cf = { &MimeFilterCFVtbl };
|
|||
#define TEST_POST 0x10
|
||||
#define TEST_EMULATEPROT 0x20
|
||||
#define TEST_SHORT_READ 0x40
|
||||
#define TEST_REDIRECT 0x80
|
||||
|
||||
static void init_test(int prot, DWORD flags)
|
||||
{
|
||||
|
@ -1977,6 +1988,7 @@ static void init_test(int prot, DWORD flags)
|
|||
emulate_prot = (flags & TEST_EMULATEPROT) != 0;
|
||||
wait_for_switch = TRUE;
|
||||
short_read = (flags & TEST_SHORT_READ) != 0;
|
||||
test_redirect = (flags & TEST_REDIRECT) != 0;
|
||||
}
|
||||
|
||||
static void test_priority(IInternetProtocol *protocol)
|
||||
|
@ -2429,6 +2441,8 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags)
|
|||
SET_EXPECT(ReportProgress_FINDINGRESOURCE);
|
||||
SET_EXPECT(ReportProgress_CONNECTING);
|
||||
SET_EXPECT(ReportProgress_SENDINGREQUEST);
|
||||
if(test_redirect)
|
||||
SET_EXPECT(ReportProgress_REDIRECTING);
|
||||
SET_EXPECT(ReportProgress_PROXYDETECTING);
|
||||
if(prot == HTTP_TEST)
|
||||
SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
|
||||
|
@ -2516,6 +2530,9 @@ static void test_http_protocol(void)
|
|||
{'h','t','t','p',':','/','/','c','r','o','s','s','o','v','e','r','.',
|
||||
'c','o','d','e','w','e','a','v','e','r','s','.','c','o','m','/',
|
||||
'p','o','s','t','t','e','s','t','.','p','h','p',0};
|
||||
static const WCHAR redirect_url[] =
|
||||
{'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',
|
||||
't','e','s','t','r','e','d','i','r','e','c','t',0};
|
||||
|
||||
trace("Testing http protocol (not from urlmon)...\n");
|
||||
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
|
||||
|
@ -2538,6 +2555,10 @@ static void test_http_protocol(void)
|
|||
trace("Testing http protocol (direct read)...\n");
|
||||
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
|
||||
test_http_protocol_url(winehq_url, HTTP_TEST, TEST_DIRECT_READ);
|
||||
|
||||
trace("Testing http protocol (redirected)...\n");
|
||||
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
|
||||
test_http_protocol_url(redirect_url, HTTP_TEST, TEST_REDIRECT);
|
||||
}
|
||||
|
||||
static void test_https_protocol(void)
|
||||
|
|
|
@ -91,6 +91,15 @@ static struct secmgr_test {
|
|||
{url7, 3, S_OK, sizeof(secid7), secid7, S_OK}
|
||||
};
|
||||
|
||||
static int strcmp_w(const WCHAR *str1, const WCHAR *str2)
|
||||
{
|
||||
DWORD len1 = lstrlenW(str1);
|
||||
DWORD len2 = lstrlenW(str2);
|
||||
|
||||
if(len1!=len2) return 1;
|
||||
return memcmp(str1, str2, len1*sizeof(WCHAR));
|
||||
}
|
||||
|
||||
static void test_SecurityManager(void)
|
||||
{
|
||||
int i;
|
||||
|
@ -605,11 +614,69 @@ static void test_GetZoneAttributes(void)
|
|||
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
|
||||
}
|
||||
|
||||
static void test_InternetSecurityMarshalling(void)
|
||||
{
|
||||
IInternetSecurityManager *secmgr = NULL;
|
||||
IUnknown *unk;
|
||||
IStream *stream;
|
||||
HRESULT hres;
|
||||
|
||||
hres = CoInternetCreateSecurityManager(NULL, &secmgr, 0);
|
||||
if(FAILED(hres))
|
||||
return;
|
||||
|
||||
hres = IInternetSecurityManager_QueryInterface(secmgr, &IID_IUnknown, (void**)&unk);
|
||||
ok(hres == S_OK, "QueryInterface returned: %08x\n", hres);
|
||||
|
||||
hres = CreateStreamOnHGlobal(NULL, TRUE, &stream);
|
||||
ok(hres == S_OK, "CreateStreamOnHGlobal returned: %08x\n", hres);
|
||||
|
||||
hres = CoMarshalInterface(stream, &IID_IInternetSecurityManager, unk, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
|
||||
ok(hres == S_OK, "CoMarshalInterface returned: %08x\n", hres);
|
||||
|
||||
IStream_Release(stream);
|
||||
IUnknown_Release(unk);
|
||||
IInternetSecurityManager_Release(secmgr);
|
||||
}
|
||||
|
||||
static void test_InternetGetSecurityUrl(void)
|
||||
{
|
||||
const WCHAR url5_out[] = {'h','t','t','p',':','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
|
||||
const WCHAR url7_out[] = {'f','t','p',':','w','i','n','e','h','q','.','o','r','g',0};
|
||||
|
||||
const WCHAR *in[] = {url2, url3, url4, url5, url7, url8, url9, url10};
|
||||
const WCHAR *out_default[] = {url2, url3, url4, url5_out, url7_out, url8, url5_out, url10};
|
||||
const WCHAR *out_securl[] = {url2, url3, url4, url5, url7, url8, url9, url10};
|
||||
|
||||
WCHAR *sec;
|
||||
DWORD i;
|
||||
HRESULT hres;
|
||||
|
||||
for(i=0; i<sizeof(in)/sizeof(WCHAR*); i++) {
|
||||
hres = CoInternetGetSecurityUrl(in[i], &sec, PSU_DEFAULT, 0);
|
||||
ok(hres == S_OK, "(%d) CoInternetGetSecurityUrl returned: %08x\n", i, hres);
|
||||
if(hres == S_OK) {
|
||||
ok(!strcmp_w(sec, out_default[i]), "(%d) Got %s, expected %s\n",
|
||||
i, wine_dbgstr_w(sec), wine_dbgstr_w(out_default[i]));
|
||||
CoTaskMemFree(sec);
|
||||
}
|
||||
|
||||
hres = CoInternetGetSecurityUrl(in[i], &sec, PSU_SECURITY_URL_ONLY, 0);
|
||||
ok(hres == S_OK, "(%d) CoInternetGetSecurityUrl returned: %08x\n", i, hres);
|
||||
if(hres == S_OK) {
|
||||
ok(!strcmp_w(sec, out_securl[i]), "(%d) Got %s, expected %s\n",
|
||||
i, wine_dbgstr_w(sec), wine_dbgstr_w(out_securl[i]));
|
||||
CoTaskMemFree(sec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
START_TEST(sec_mgr)
|
||||
{
|
||||
OleInitialize(NULL);
|
||||
|
||||
test_InternetGetSecurityUrl();
|
||||
test_SecurityManager();
|
||||
test_polices();
|
||||
test_CoInternetCreateZoneManager();
|
||||
|
@ -617,6 +684,7 @@ START_TEST(sec_mgr)
|
|||
test_GetZoneActionPolicy();
|
||||
test_GetZoneAt();
|
||||
test_GetZoneAttributes();
|
||||
test_InternetSecurityMarshalling();
|
||||
|
||||
OleUninitialize();
|
||||
}
|
||||
|
|
|
@ -299,8 +299,11 @@ static void test_URLOpenBlockingStreamW(void)
|
|||
|
||||
hr = URLOpenBlockingStreamW(NULL, NULL, &pStream, 0, &BindStatusCallback);
|
||||
ok(hr == E_INVALIDARG, "URLOpenBlockingStreamW should have failed with E_INVALIDARG instead of 0x%08x\n", hr);
|
||||
hr = URLOpenBlockingStreamW(NULL, INDEX_HTML, NULL, 0, &BindStatusCallback);
|
||||
ok(hr == E_INVALIDARG, "URLOpenBlockingStreamW should have failed with E_INVALIDARG instead of 0x%08x\n", hr);
|
||||
if (0) /* crashes on Win2k */
|
||||
{
|
||||
hr = URLOpenBlockingStreamW(NULL, INDEX_HTML, NULL, 0, &BindStatusCallback);
|
||||
ok(hr == E_INVALIDARG, "URLOpenBlockingStreamW should have failed with E_INVALIDARG instead of 0x%08x\n", hr);
|
||||
}
|
||||
|
||||
SET_EXPECT(GetBindInfo);
|
||||
SET_EXPECT(QueryInterface_IServiceProvider);
|
||||
|
|
|
@ -100,6 +100,7 @@ DEFINE_EXPECT(GetBindInfoEx);
|
|||
DEFINE_EXPECT(OnStartBinding);
|
||||
DEFINE_EXPECT(OnProgress_FINDINGRESOURCE);
|
||||
DEFINE_EXPECT(OnProgress_CONNECTING);
|
||||
DEFINE_EXPECT(OnProgress_REDIRECTING);
|
||||
DEFINE_EXPECT(OnProgress_SENDINGREQUEST);
|
||||
DEFINE_EXPECT(OnProgress_MIMETYPEAVAILABLE);
|
||||
DEFINE_EXPECT(OnProgress_BEGINDOWNLOADDATA);
|
||||
|
@ -121,6 +122,7 @@ DEFINE_EXPECT(Obj_OnProgress_BEGINSYNCOPERATION);
|
|||
DEFINE_EXPECT(Obj_OnProgress_ENDSYNCOPERATION);
|
||||
DEFINE_EXPECT(Obj_OnProgress_FINDINGRESOURCE);
|
||||
DEFINE_EXPECT(Obj_OnProgress_CONNECTING);
|
||||
DEFINE_EXPECT(Obj_OnProgress_REDIRECTING);
|
||||
DEFINE_EXPECT(Obj_OnProgress_CACHEFILENAMEAVAILABLE);
|
||||
DEFINE_EXPECT(Start);
|
||||
DEFINE_EXPECT(Read);
|
||||
|
@ -181,6 +183,7 @@ static IBinding *current_binding;
|
|||
static HANDLE complete_event, complete_event2;
|
||||
static HRESULT binding_hres;
|
||||
static BOOL have_IHttpNegotiate2, use_bscex;
|
||||
static BOOL test_redirect;
|
||||
|
||||
static LPCWSTR urls[] = {
|
||||
WINE_ABOUT_URL,
|
||||
|
@ -380,13 +383,27 @@ static DWORD WINAPI thread_proc(PVOID arg)
|
|||
SET_EXPECT(OnProgress_SENDINGREQUEST);
|
||||
hres = IInternetProtocolSink_ReportProgress(protocol_sink,
|
||||
BINDSTATUS_SENDINGREQUEST, NULL);
|
||||
ok(hres == S_OK, "ReportProxgress failed: %08x\n", hres);
|
||||
ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
|
||||
WaitForSingleObject(complete_event, INFINITE);
|
||||
if(bind_to_object)
|
||||
CHECK_CALLED(Obj_OnProgress_SENDINGREQUEST);
|
||||
else
|
||||
CHECK_CALLED(OnProgress_SENDINGREQUEST);
|
||||
|
||||
if(test_redirect) {
|
||||
if(bind_to_object)
|
||||
SET_EXPECT(Obj_OnProgress_REDIRECTING);
|
||||
else
|
||||
SET_EXPECT(OnProgress_REDIRECTING);
|
||||
hres = IInternetProtocolSink_ReportProgress(protocol_sink, BINDSTATUS_REDIRECTING, WINE_ABOUT_URL);
|
||||
ok(hres == S_OK, "ReportProgress(BINDSTATUS_REFIRECTING) failed: %08x\n", hres);
|
||||
WaitForSingleObject(complete_event, INFINITE);
|
||||
if(bind_to_object)
|
||||
CHECK_CALLED(Obj_OnProgress_REDIRECTING);
|
||||
else
|
||||
CHECK_CALLED(OnProgress_REDIRECTING);
|
||||
}
|
||||
|
||||
test_switch_fail();
|
||||
|
||||
SET_EXPECT(Continue);
|
||||
|
@ -773,7 +790,7 @@ static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
|
|||
IHttpNegotiate_Release(http_negotiate);
|
||||
ok(hres == S_OK, "OnResponse failed: %08x\n", hres);
|
||||
|
||||
if(test_protocol == HTTPS_TEST) {
|
||||
if(test_protocol == HTTPS_TEST || test_redirect) {
|
||||
hres = IInternetProtocolSink_ReportProgress(protocol_sink, BINDSTATUS_ACCEPTRANGES, NULL);
|
||||
ok(hres == S_OK, "ReportProgress(BINDSTATUS_ACCEPTRANGES) failed: %08x\n", hres);
|
||||
}
|
||||
|
@ -1275,6 +1292,16 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
|
|||
if((bindf & BINDF_ASYNCHRONOUS) && emulate_protocol)
|
||||
SetEvent(complete_event);
|
||||
break;
|
||||
case BINDSTATUS_REDIRECTING:
|
||||
if(iface == &objbsc)
|
||||
CHECK_EXPECT(Obj_OnProgress_REDIRECTING);
|
||||
else
|
||||
CHECK_EXPECT(OnProgress_REDIRECTING);
|
||||
ok(!lstrcmpW(szStatusText, WINE_ABOUT_URL), "unexpected status text %s\n",
|
||||
wine_dbgstr_w(szStatusText));
|
||||
if(!bind_to_object || iface == &objbsc)
|
||||
SetEvent(complete_event);
|
||||
break;
|
||||
case BINDSTATUS_SENDINGREQUEST:
|
||||
if(iface == &objbsc)
|
||||
CHECK_EXPECT(Obj_OnProgress_SENDINGREQUEST);
|
||||
|
@ -1700,6 +1727,8 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
|
|||
SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
|
||||
SET_EXPECT(GetBindInfo);
|
||||
SET_EXPECT(OnStartBinding);
|
||||
if(test_redirect)
|
||||
SET_EXPECT(OnProgress_REDIRECTING);
|
||||
SET_EXPECT(OnProgress_BEGINDOWNLOADDATA);
|
||||
if(test_protocol == FILE_TEST)
|
||||
SET_EXPECT(OnProgress_CACHEFILENAMEAVAILABLE);
|
||||
|
@ -1716,6 +1745,8 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
|
|||
CLEAR_CALLED(QueryInterface_IBindStatusCallbackEx); /* IE 8 */
|
||||
CHECK_CALLED(GetBindInfo);
|
||||
CHECK_CALLED(OnStartBinding);
|
||||
if(test_redirect)
|
||||
CHECK_CALLED(OnProgress_REDIRECTING);
|
||||
CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
|
||||
if(test_protocol == FILE_TEST)
|
||||
CHECK_CALLED(OnProgress_CACHEFILENAMEAVAILABLE);
|
||||
|
@ -2184,9 +2215,11 @@ static BOOL test_RegisterBindStatusCallback(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#define BINDTEST_EMULATE 1
|
||||
#define BINDTEST_TOOBJECT 2
|
||||
#define BINDTEST_FILEDWLAPI 4
|
||||
#define BINDTEST_EMULATE 0x0001
|
||||
#define BINDTEST_TOOBJECT 0x0002
|
||||
#define BINDTEST_FILEDWLAPI 0x0004
|
||||
#define BINDTEST_HTTPRESPONSE 0x0008
|
||||
#define BINDTEST_REDIRECT 0x0010
|
||||
|
||||
static void init_bind_test(int protocol, DWORD flags, DWORD t)
|
||||
{
|
||||
|
@ -2201,9 +2234,14 @@ static void init_bind_test(int protocol, DWORD flags, DWORD t)
|
|||
bind_to_object = (flags & BINDTEST_TOOBJECT) != 0;
|
||||
tymed = t;
|
||||
filedwl_api = (flags & BINDTEST_FILEDWLAPI) != 0;
|
||||
if(flags & BINDTEST_HTTPRESPONSE)
|
||||
urls[HTTP_TEST] = SHORT_RESPONSE_URL;
|
||||
else
|
||||
urls[HTTP_TEST] = WINE_ABOUT_URL;
|
||||
test_redirect = (flags & BINDTEST_REDIRECT) != 0;
|
||||
}
|
||||
|
||||
static void test_BindToStorage(int protocol, BOOL emul, DWORD t)
|
||||
static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
|
||||
{
|
||||
IMoniker *mon;
|
||||
HRESULT hres;
|
||||
|
@ -2214,7 +2252,7 @@ static void test_BindToStorage(int protocol, BOOL emul, DWORD t)
|
|||
IUnknown *unk = (IUnknown*)0x00ff00ff;
|
||||
IBinding *bind;
|
||||
|
||||
init_bind_test(protocol, emul ? BINDTEST_EMULATE : 0, t);
|
||||
init_bind_test(protocol, flags, t);
|
||||
|
||||
SET_EXPECT(QueryInterface_IServiceProvider);
|
||||
hres = CreateAsyncBindCtx(0, (IBindStatusCallback*)&bsc, NULL, &bctx);
|
||||
|
@ -2396,7 +2434,7 @@ static void test_BindToStorage(int protocol, BOOL emul, DWORD t)
|
|||
http_is_first = FALSE;
|
||||
}
|
||||
|
||||
static void test_BindToObject(int protocol, BOOL emul)
|
||||
static void test_BindToObject(int protocol, DWORD flags)
|
||||
{
|
||||
IMoniker *mon;
|
||||
HRESULT hres;
|
||||
|
@ -2407,9 +2445,9 @@ static void test_BindToObject(int protocol, BOOL emul)
|
|||
IUnknown *unk = (IUnknown*)0x00ff00ff;
|
||||
IBinding *bind;
|
||||
|
||||
init_bind_test(protocol, BINDTEST_TOOBJECT | (emul ? BINDTEST_EMULATE : 0), TYMED_ISTREAM);
|
||||
init_bind_test(protocol, BINDTEST_TOOBJECT|flags, TYMED_ISTREAM);
|
||||
|
||||
if(emul)
|
||||
if(emulate_protocol)
|
||||
CoRegisterClassObject(&CLSID_HTMLDocument, (IUnknown *)&mime_cf,
|
||||
CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, ®id);
|
||||
|
||||
|
@ -2500,14 +2538,14 @@ static void test_BindToObject(int protocol, BOOL emul)
|
|||
}else {
|
||||
ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres);
|
||||
ok(unk != NULL, "unk == NULL\n");
|
||||
if(emul)
|
||||
if(emulate_protocol)
|
||||
ok(unk == (IUnknown*)&PersistMoniker, "unk != PersistMoniker\n");
|
||||
}
|
||||
if(unk)
|
||||
IUnknown_Release(unk);
|
||||
|
||||
while((bindf & BINDF_ASYNCHRONOUS) &&
|
||||
!((!emul || stopped_binding) && stopped_obj_binding) && GetMessage(&msg,NULL,0,0)) {
|
||||
!((!emulate_protocol || stopped_binding) && stopped_obj_binding) && GetMessage(&msg,NULL,0,0)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
@ -2571,7 +2609,7 @@ static void test_BindToObject(int protocol, BOOL emul)
|
|||
CHECK_CALLED(Obj_OnStopBinding);
|
||||
}
|
||||
|
||||
if(test_protocol != HTTP_TEST || emul || urls[test_protocol] == SHORT_RESPONSE_URL || !(bindf & BINDF_ASYNCHRONOUS)) {
|
||||
if(test_protocol != HTTP_TEST || emulate_protocol || !(bindf & BINDF_ASYNCHRONOUS)) {
|
||||
ok(IMoniker_Release(mon) == 0, "mon should be destroyed here\n");
|
||||
ok(IBindCtx_Release(bctx) == 0, "bctx should be destroyed here\n");
|
||||
}else {
|
||||
|
@ -2579,7 +2617,7 @@ static void test_BindToObject(int protocol, BOOL emul)
|
|||
IBindCtx_Release(bctx);
|
||||
}
|
||||
|
||||
if(emul)
|
||||
if(emulate_protocol)
|
||||
CoRevokeClassObject(regid);
|
||||
|
||||
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
|
||||
|
@ -2612,6 +2650,7 @@ static void test_URLDownloadToFile(DWORD prot, BOOL emul)
|
|||
SET_EXPECT(QueryInterface_IHttpNegotiate2);
|
||||
SET_EXPECT(GetRootSecurityId);
|
||||
SET_EXPECT(QueryInterface_IWindowForBindingUI);
|
||||
SET_EXPECT(OnProgress_CONNECTING);
|
||||
}
|
||||
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == FILE_TEST)
|
||||
SET_EXPECT(OnProgress_SENDINGREQUEST);
|
||||
|
@ -2655,6 +2694,7 @@ static void test_URLDownloadToFile(DWORD prot, BOOL emul)
|
|||
CHECK_CALLED(GetRootSecurityId);
|
||||
}
|
||||
CLEAR_CALLED(QueryInterface_IWindowForBindingUI);
|
||||
CLEAR_CALLED(OnProgress_CONNECTING);
|
||||
}
|
||||
if(test_protocol == FILE_TEST)
|
||||
CHECK_CALLED(OnProgress_SENDINGREQUEST);
|
||||
|
@ -2821,40 +2861,8 @@ static void test_StdURLMoniker(void)
|
|||
IMoniker_Release(mon);
|
||||
}
|
||||
|
||||
static void gecko_installer_workaround(BOOL disable)
|
||||
{
|
||||
HKEY hkey;
|
||||
DWORD res;
|
||||
|
||||
static BOOL has_url = FALSE;
|
||||
static char url[2048];
|
||||
|
||||
if(!disable && !has_url)
|
||||
return;
|
||||
|
||||
res = RegOpenKey(HKEY_CURRENT_USER, "Software\\Wine\\MSHTML", &hkey);
|
||||
if(res != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
if(disable) {
|
||||
DWORD type, size = sizeof(url);
|
||||
|
||||
res = RegQueryValueEx(hkey, "GeckoUrl", NULL, &type, (PVOID)url, &size);
|
||||
if(res == ERROR_SUCCESS && type == REG_SZ)
|
||||
has_url = TRUE;
|
||||
|
||||
RegDeleteValue(hkey, "GeckoUrl");
|
||||
}else {
|
||||
RegSetValueEx(hkey, "GeckoUrl", 0, REG_SZ, (PVOID)url, lstrlenA(url)+1);
|
||||
}
|
||||
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
START_TEST(url)
|
||||
{
|
||||
gecko_installer_workaround(TRUE);
|
||||
|
||||
complete_event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
complete_event2 = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
thread_id = GetCurrentThreadId();
|
||||
|
@ -2874,7 +2882,7 @@ START_TEST(url)
|
|||
test_BindToStorage_fail();
|
||||
|
||||
trace("synchronous http test (COM not initialised)...\n");
|
||||
test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
|
||||
test_BindToStorage(HTTP_TEST, 0, TYMED_ISTREAM);
|
||||
|
||||
CoInitialize(NULL);
|
||||
|
||||
|
@ -2882,95 +2890,100 @@ START_TEST(url)
|
|||
test_StdURLMoniker();
|
||||
|
||||
trace("synchronous http test...\n");
|
||||
test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
|
||||
test_BindToStorage(HTTP_TEST, 0, TYMED_ISTREAM);
|
||||
|
||||
trace("synchronous http test (to object)...\n");
|
||||
test_BindToObject(HTTP_TEST, FALSE);
|
||||
test_BindToObject(HTTP_TEST, 0);
|
||||
|
||||
trace("synchronous file test...\n");
|
||||
test_BindToStorage(FILE_TEST, FALSE, TYMED_ISTREAM);
|
||||
test_BindToStorage(FILE_TEST, 0, TYMED_ISTREAM);
|
||||
|
||||
trace("synchronous file test (to object)...\n");
|
||||
test_BindToObject(FILE_TEST, FALSE);
|
||||
test_BindToObject(FILE_TEST, 0);
|
||||
|
||||
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
|
||||
|
||||
trace("http test...\n");
|
||||
test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
|
||||
test_BindToStorage(HTTP_TEST, 0, TYMED_ISTREAM);
|
||||
|
||||
trace("http test (to file)...\n");
|
||||
test_BindToStorage(HTTP_TEST, FALSE, TYMED_FILE);
|
||||
test_BindToStorage(HTTP_TEST, 0, TYMED_FILE);
|
||||
|
||||
trace("http test (to object)...\n");
|
||||
test_BindToObject(HTTP_TEST, FALSE);
|
||||
test_BindToObject(HTTP_TEST, 0);
|
||||
|
||||
trace("http test (short response)...\n");
|
||||
http_is_first = TRUE;
|
||||
urls[HTTP_TEST] = SHORT_RESPONSE_URL;
|
||||
test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
|
||||
test_BindToStorage(HTTP_TEST, BINDTEST_HTTPRESPONSE, TYMED_ISTREAM);
|
||||
|
||||
trace("http test (short response, to object)...\n");
|
||||
test_BindToObject(HTTP_TEST, FALSE);
|
||||
test_BindToObject(HTTP_TEST, 0);
|
||||
|
||||
trace("emulated http test...\n");
|
||||
test_BindToStorage(HTTP_TEST, TRUE, TYMED_ISTREAM);
|
||||
test_BindToStorage(HTTP_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
|
||||
|
||||
trace("emulated http test (to object)...\n");
|
||||
test_BindToObject(HTTP_TEST, TRUE);
|
||||
test_BindToObject(HTTP_TEST, BINDTEST_EMULATE);
|
||||
|
||||
trace("emulated http test (to object, redirect)...\n");
|
||||
test_BindToObject(HTTP_TEST, BINDTEST_EMULATE|BINDTEST_REDIRECT);
|
||||
|
||||
trace("emulated http test (to file)...\n");
|
||||
test_BindToStorage(HTTP_TEST, TRUE, TYMED_FILE);
|
||||
test_BindToStorage(HTTP_TEST, BINDTEST_EMULATE, TYMED_FILE);
|
||||
|
||||
trace("emulated http test (redirect)...\n");
|
||||
test_BindToStorage(HTTP_TEST, BINDTEST_EMULATE|BINDTEST_REDIRECT, TYMED_ISTREAM);
|
||||
|
||||
trace("asynchronous https test...\n");
|
||||
test_BindToStorage(HTTPS_TEST, FALSE, TYMED_ISTREAM);
|
||||
test_BindToStorage(HTTPS_TEST, 0, TYMED_ISTREAM);
|
||||
|
||||
trace("emulated https test...\n");
|
||||
test_BindToStorage(HTTPS_TEST, TRUE, TYMED_ISTREAM);
|
||||
test_BindToStorage(HTTPS_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
|
||||
|
||||
trace("about test...\n");
|
||||
test_BindToStorage(ABOUT_TEST, FALSE, TYMED_ISTREAM);
|
||||
test_BindToStorage(ABOUT_TEST, 0, TYMED_ISTREAM);
|
||||
|
||||
trace("about test (to file)...\n");
|
||||
test_BindToStorage(ABOUT_TEST, FALSE, TYMED_FILE);
|
||||
test_BindToStorage(ABOUT_TEST, 0, TYMED_FILE);
|
||||
|
||||
trace("about test (to object)...\n");
|
||||
test_BindToObject(ABOUT_TEST, FALSE);
|
||||
test_BindToObject(ABOUT_TEST, 0);
|
||||
|
||||
trace("emulated about test...\n");
|
||||
test_BindToStorage(ABOUT_TEST, TRUE, TYMED_ISTREAM);
|
||||
test_BindToStorage(ABOUT_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
|
||||
|
||||
trace("emulated about test (to file)...\n");
|
||||
test_BindToStorage(ABOUT_TEST, TRUE, TYMED_FILE);
|
||||
test_BindToStorage(ABOUT_TEST, BINDTEST_EMULATE, TYMED_FILE);
|
||||
|
||||
trace("emulated about test (to object)...\n");
|
||||
test_BindToObject(ABOUT_TEST, TRUE);
|
||||
test_BindToObject(ABOUT_TEST, BINDTEST_EMULATE);
|
||||
|
||||
trace("file test...\n");
|
||||
test_BindToStorage(FILE_TEST, FALSE, TYMED_ISTREAM);
|
||||
test_BindToStorage(FILE_TEST, 0, TYMED_ISTREAM);
|
||||
|
||||
trace("file test (to file)...\n");
|
||||
test_BindToStorage(FILE_TEST, FALSE, TYMED_FILE);
|
||||
test_BindToStorage(FILE_TEST, 0, TYMED_FILE);
|
||||
|
||||
trace("file test (to object)...\n");
|
||||
test_BindToObject(FILE_TEST, FALSE);
|
||||
test_BindToObject(FILE_TEST, 0);
|
||||
|
||||
trace("emulated file test...\n");
|
||||
test_BindToStorage(FILE_TEST, TRUE, TYMED_ISTREAM);
|
||||
test_BindToStorage(FILE_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
|
||||
|
||||
trace("emulated file test (to file)...\n");
|
||||
test_BindToStorage(FILE_TEST, TRUE, TYMED_FILE);
|
||||
test_BindToStorage(FILE_TEST, BINDTEST_EMULATE, TYMED_FILE);
|
||||
|
||||
trace("emulated file test (to object)...\n");
|
||||
test_BindToObject(FILE_TEST, TRUE);
|
||||
test_BindToObject(FILE_TEST, BINDTEST_EMULATE);
|
||||
|
||||
trace("emulated its test...\n");
|
||||
test_BindToStorage(ITS_TEST, TRUE, TYMED_ISTREAM);
|
||||
test_BindToStorage(ITS_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
|
||||
|
||||
trace("emulated its test (to file)...\n");
|
||||
test_BindToStorage(ITS_TEST, TRUE, TYMED_FILE);
|
||||
test_BindToStorage(ITS_TEST, BINDTEST_EMULATE, TYMED_FILE);
|
||||
|
||||
trace("emulated mk test...\n");
|
||||
test_BindToStorage(MK_TEST, TRUE, TYMED_ISTREAM);
|
||||
test_BindToStorage(MK_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
|
||||
|
||||
trace("test URLDownloadToFile for file protocol...\n");
|
||||
test_URLDownloadToFile(FILE_TEST, FALSE);
|
||||
|
@ -2984,7 +2997,7 @@ START_TEST(url)
|
|||
bindf |= BINDF_NOWRITECACHE;
|
||||
|
||||
trace("ftp test...\n");
|
||||
test_BindToStorage(FTP_TEST, FALSE, TYMED_ISTREAM);
|
||||
test_BindToStorage(FTP_TEST, 0, TYMED_ISTREAM);
|
||||
|
||||
trace("test failures...\n");
|
||||
test_BindToStorage_fail();
|
||||
|
@ -2994,6 +3007,4 @@ START_TEST(url)
|
|||
CloseHandle(complete_event);
|
||||
CloseHandle(complete_event2);
|
||||
CoUninitialize();
|
||||
|
||||
gecko_installer_workaround(FALSE);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue