Commit 18f932cd authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

urlmon/tests: Test uninitialized IUri object.

parent e5925d2a
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
#include "shlwapi.h" #include "shlwapi.h"
#include "wininet.h" #include "wininet.h"
#include "strsafe.h" #include "strsafe.h"
#include "initguid.h"
DEFINE_GUID(CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C);
#define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
#define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
...@@ -10799,6 +10802,98 @@ static void test_IPersistStream(void) ...@@ -10799,6 +10802,98 @@ static void test_IPersistStream(void)
} }
} }
static void test_UninitializedUri(void)
{
IUri *uri;
IUriBuilderFactory *ubf;
IPersistStream *ps;
IUriBuilder *ub;
BSTR bstr;
DWORD dword;
BOOL eq;
ULARGE_INTEGER ui;
HRESULT hr;
hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IUri, (void**)&uri);
if(FAILED(hr)) {
win_skip("Skipping uninitialized Uri tests.\n");
return;
}
hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr);
hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr);
hr = IUri_GetAbsoluteUri(uri, NULL);
ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetAbsoluteUri(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetAuthority(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetDisplayUri(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetDomain(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetExtension(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetFragment(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetHost(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetHost returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetHostType(uri, &dword);
ok(hr == E_UNEXPECTED, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetPassword(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetPassword(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetPathAndQuery(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetPort(uri, &dword);
ok(hr == E_UNEXPECTED, "GetPort returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetProperties(uri, &dword);
ok(hr == E_UNEXPECTED, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
ok(hr == E_UNEXPECTED, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetQuery(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetRawUri(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetScheme(uri, &dword);
ok(hr == E_UNEXPECTED, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetSchemeName(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetUserInfo(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetUserName(uri, &bstr);
ok(hr == E_UNEXPECTED, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_GetZone(uri, &dword);
ok(hr == E_UNEXPECTED, "GetZone returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUri_IsEqual(uri, uri, &eq);
ok(hr == E_UNEXPECTED, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr);
hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
ok(hr == S_OK, "CreateIUriBuilder returned %x, expected S_OK.\n", hr);
IUriBuilder_Release(ub);
hr = IPersistStream_GetSizeMax(ps, &ui);
ok(hr == S_OK, "GetSizeMax returned %x, expected S_OK.\n", hr);
ok(ui.u.LowPart == 34, "ui.LowPart = %d, expected 34.\n", ui.u.LowPart);
hr = IPersistStream_IsDirty(ps);
ok(hr == S_FALSE, "IsDirty returned %x, expected S_FALSE.\n", hr);
IPersistStream_Release(ps);
IUriBuilderFactory_Release(ubf);
IUri_Release(uri);
}
START_TEST(uri) { START_TEST(uri) {
HMODULE hurlmon; HMODULE hurlmon;
...@@ -10916,5 +11011,11 @@ START_TEST(uri) { ...@@ -10916,5 +11011,11 @@ START_TEST(uri) {
trace("test IPersistStream...\n"); trace("test IPersistStream...\n");
test_IPersistStream(); test_IPersistStream();
CoInitialize(NULL);
trace("test uninitialized Uri...\n");
test_UninitializedUri();
CoUninitialize();
unregister_protocols(); unregister_protocols();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment