[PATCH] urlmon/tests: Add tests for CreateZoneEnumerator

Detlef Riekenberg wine.dev at web.de
Wed Jun 17 17:04:43 CDT 2009


---
 dlls/urlmon/tests/sec_mgr.c |   78 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 76 insertions(+), 2 deletions(-)

diff --git a/dlls/urlmon/tests/sec_mgr.c b/dlls/urlmon/tests/sec_mgr.c
index f90f5a5..b820fae 100644
--- a/dlls/urlmon/tests/sec_mgr.c
+++ b/dlls/urlmon/tests/sec_mgr.c
@@ -281,7 +281,80 @@ static void test_polices(void)
     IInternetZoneManager_Release(zonemgr);
 }
 
-static void test_ZoneManager(void)
+
+static void test_CreateZoneEnumerator(void)
+{
+    IInternetZoneManager *zonemgr = NULL;
+    HRESULT hr;
+    DWORD dwEnum;
+    DWORD dwEnum2;
+    DWORD dwCount;
+    DWORD dwCount2;
+
+    hr = CoInternetCreateZoneManager(NULL, &zonemgr, 0);
+    ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
+    if (FAILED(hr))
+        return;
+
+    dwEnum=0xdeadbeef;
+    hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, NULL, 0);
+    ok((hr == E_INVALIDARG) && (dwEnum == 0xdeadbeef),
+        "got 0x%x with 0x%x (expected E_INVALIDARG with 0xdeadbeef)\n", hr, dwEnum);
+
+    dwCount=0xdeadbeef;
+    hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, NULL, &dwCount, 0);
+    ok((hr == E_INVALIDARG) && (dwCount == 0xdeadbeef),
+        "got 0x%x and 0x%x (expected E_INVALIDARG and 0xdeadbeef)\n", hr, dwCount);
+
+    dwEnum=0xdeadbeef;
+    dwCount=0xdeadbeef;
+    hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, &dwCount, 0xffffffff);
+    ok((hr == E_INVALIDARG) && (dwEnum == 0xdeadbeef) && (dwCount == 0xdeadbeef),
+        "got 0x%x with 0x%x and 0x%x (expected E_INVALIDARG with 0xdeadbeef and 0xdeadbeef)\n",
+        hr, dwEnum, dwCount);
+
+    dwEnum=0xdeadbeef;
+    dwCount=0xdeadbeef;
+    hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, &dwCount, 1);
+    ok((hr == E_INVALIDARG) && (dwEnum == 0xdeadbeef) && (dwCount == 0xdeadbeef),
+        "got 0x%x with 0x%x and 0x%x (expected E_INVALIDARG with 0xdeadbeef and 0xdeadbeef)\n",
+        hr, dwEnum, dwCount);
+
+    dwEnum=0xdeadbeef;
+    dwCount=0xdeadbeef;
+    /* Normal use */
+    hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, &dwCount, 0);
+    todo_wine
+    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+
+    if (SUCCEEDED(hr)) {
+        dwEnum2=0xdeadbeef;
+        dwCount2=0xdeadbeef;
+        hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum2, &dwCount2, 0);
+        ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+        if (SUCCEEDED(hr)) {
+            /* native urlmon has an incrementing counter for dwEnum */
+            hr = IInternetZoneManager_DestroyZoneEnumerator(zonemgr, dwEnum2);
+            ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+        }
+
+        hr = IInternetZoneManager_DestroyZoneEnumerator(zonemgr, dwEnum);
+        ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+
+        if (0) {
+            /* Destroy the Enumerator twice is detected and handled in native urlmon */
+            hr = IInternetZoneManager_DestroyZoneEnumerator(zonemgr, dwEnum);
+            ok((hr == E_INVALIDARG), "got 0x%x (expected E_INVALIDARG)\n", hr);
+        }
+    }
+
+    /* ::Release succeed also, when a ::DestroyZoneEnumerator is missing */
+    hr = IInternetZoneManager_Release(zonemgr);
+    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+}
+
+
+static void test_GetZoneActionPolicy(void)
 {
     IInternetZoneManager *zonemgr = NULL;
     BYTE buf[32];
@@ -329,7 +402,8 @@ START_TEST(sec_mgr)
 
     test_SecurityManager();
     test_polices();
-    test_ZoneManager();
+    test_CreateZoneEnumerator();
+    test_GetZoneActionPolicy();
 
     OleUninitialize();
 }
-- 
1.5.4.3


--=-tlkP6WYFxca30OFLcp7V--




More information about the wine-patches mailing list