mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 10:41:12 +00:00
urlmon/tests: Add tests for the ZoneEnumerator.
This commit is contained in:
parent
9a7f221b13
commit
694bf576d0
1 changed files with 120 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright 2005-2006 Jacek Caban for CodeWeavers
|
||||
* Copyright 2009 Detlef Riekenberg
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -281,6 +282,74 @@ static void test_polices(void)
|
|||
IInternetZoneManager_Release(zonemgr);
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
/* 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;
|
||||
|
@ -321,6 +390,55 @@ static void test_GetZoneActionPolicy(void)
|
|||
IInternetZoneManager_Release(zonemgr);
|
||||
}
|
||||
|
||||
static void test_GetZoneAt(void)
|
||||
{
|
||||
IInternetZoneManager *zonemgr = NULL;
|
||||
HRESULT hr;
|
||||
DWORD dwEnum;
|
||||
DWORD dwCount;
|
||||
DWORD dwZone;
|
||||
DWORD i;
|
||||
|
||||
hr = CoInternetCreateZoneManager(NULL, &zonemgr, 0);
|
||||
ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
|
||||
if (FAILED(hr))
|
||||
return;
|
||||
|
||||
hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, &dwCount, 0);
|
||||
if (FAILED(hr))
|
||||
goto cleanup;
|
||||
|
||||
if (0) {
|
||||
/* this crashes with native urlmon */
|
||||
hr = IInternetZoneManager_GetZoneAt(zonemgr, dwEnum, 0, NULL);
|
||||
}
|
||||
|
||||
dwZone = 0xdeadbeef;
|
||||
hr = IInternetZoneManager_GetZoneAt(zonemgr, 0xdeadbeef, 0, &dwZone);
|
||||
ok(hr == E_INVALIDARG,
|
||||
"got 0x%x with 0x%x (expected E_INVALIDARG)\n", hr, dwZone);
|
||||
|
||||
for (i = 0; i < dwCount; i++)
|
||||
{
|
||||
dwZone = 0xdeadbeef;
|
||||
hr = IInternetZoneManager_GetZoneAt(zonemgr, dwEnum, i, &dwZone);
|
||||
ok(hr == S_OK, "#%d: got x%x with %d (expected S_OK)\n", i, hr, dwZone);
|
||||
}
|
||||
|
||||
dwZone = 0xdeadbeef;
|
||||
/* MSDN (index .. must be .. less than or equal to) is wrong */
|
||||
hr = IInternetZoneManager_GetZoneAt(zonemgr, dwEnum, dwCount, &dwZone);
|
||||
ok(hr == E_INVALIDARG,
|
||||
"got 0x%x with 0x%x (expected E_INVALIDARG)\n", hr, dwZone);
|
||||
|
||||
hr = IInternetZoneManager_DestroyZoneEnumerator(zonemgr, dwEnum);
|
||||
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
|
||||
|
||||
cleanup:
|
||||
hr = IInternetZoneManager_Release(zonemgr);
|
||||
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
|
||||
}
|
||||
|
||||
static void test_GetZoneAttributes(void)
|
||||
{
|
||||
IInternetZoneManager *zonemgr = NULL;
|
||||
|
@ -382,7 +500,9 @@ START_TEST(sec_mgr)
|
|||
|
||||
test_SecurityManager();
|
||||
test_polices();
|
||||
test_CreateZoneEnumerator();
|
||||
test_GetZoneActionPolicy();
|
||||
test_GetZoneAt();
|
||||
test_GetZoneAttributes();
|
||||
|
||||
OleUninitialize();
|
||||
|
|
Loading…
Reference in a new issue