Piotr Caban : urlmon: Added tests for CoInternetGetSecurityUrl.

Alexandre Julliard julliard at winehq.org
Thu Dec 17 10:37:07 CST 2009


Module: wine
Branch: master
Commit: 5cc277c677275ebede22fa89ab0c2a02fd0ea92f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5cc277c677275ebede22fa89ab0c2a02fd0ea92f

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Dec 16 16:35:03 2009 +0100

urlmon: Added tests for CoInternetGetSecurityUrl.

---

 dlls/urlmon/tests/sec_mgr.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/dlls/urlmon/tests/sec_mgr.c b/dlls/urlmon/tests/sec_mgr.c
index 06df952..e441698 100644
--- a/dlls/urlmon/tests/sec_mgr.c
+++ b/dlls/urlmon/tests/sec_mgr.c
@@ -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();




More information about the wine-cvs mailing list