urlmon: Added tests for CoInternetGetSecurityUrl.

oldstable
Piotr Caban 2009-12-16 16:35:03 +01:00 committed by Alexandre Julliard
parent fa2ec0f06c
commit 5cc277c677
1 changed files with 42 additions and 0 deletions

View File

@ -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;
@ -630,11 +639,44 @@ static void test_InternetSecurityMarshalling(void)
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();