ReactOS 0.4.15-dev-7918-g2a2556c
uri.c File Reference
#include <wine/test.h>
#include <stdarg.h>
#include <stddef.h>
#include "windef.h"
#include "winbase.h"
#include "urlmon.h"
#include "shlwapi.h"
#include "wininet.h"
#include "strsafe.h"
#include "initguid.h"
#include <wine/heap.h>
Include dependency graph for uri.c:

Go to the source code of this file.

Classes

struct  _uri_create_flag_test
 
struct  _uri_str_property
 
struct  _uri_dword_property
 
struct  _uri_properties
 
struct  _invalid_uri
 
struct  _uri_equality
 
struct  _uri_with_fragment
 
struct  _uri_builder_property
 
struct  _uri_builder_port
 
struct  _uri_builder_str_property
 
struct  _uri_builder_dword_property
 
struct  _uri_builder_test
 
struct  _uri_builder_remove_test
 
struct  _uri_combine_str_property
 
struct  _uri_combine_test
 
struct  _uri_parse_test
 
struct  custom_uri
 
struct  create_urlmon_test_t
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define WIN32_LEAN_AND_MEAN
 
#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_BUILDER_STR_PROPERTY_COUNT   7
 
#define DEFINE_EXPECT(func)    static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
 
#define SET_EXPECT(func)    expect_ ## func = TRUE
 
#define CHECK_EXPECT(func)
 
#define CHECK_EXPECT2(func)
 
#define CHECK_CALLED(func)
 
#define test_urlmon_display_name(a, b)   _test_urlmon_display_name(__LINE__,a,b)
 
#define test_display_uri(a, b)   _test_display_uri(__LINE__,a,b)
 

Typedefs

typedef struct _uri_create_flag_test uri_create_flag_test
 
typedef struct _uri_str_property uri_str_property
 
typedef struct _uri_dword_property uri_dword_property
 
typedef struct _uri_properties uri_properties
 
typedef struct _invalid_uri invalid_uri
 
typedef struct _uri_equality uri_equality
 
typedef struct _uri_with_fragment uri_with_fragment
 
typedef struct _uri_builder_property uri_builder_property
 
typedef struct _uri_builder_port uri_builder_port
 
typedef struct _uri_builder_str_property uri_builder_str_property
 
typedef struct _uri_builder_dword_property uri_builder_dword_property
 
typedef struct _uri_builder_test uri_builder_test
 
typedef struct _uri_builder_remove_test uri_builder_remove_test
 
typedef struct _uri_combine_str_property uri_combine_str_property
 
typedef struct _uri_combine_test uri_combine_test
 
typedef struct _uri_parse_test uri_parse_test
 

Functions

 DEFINE_GUID (CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D, 0x4C, 0xCE, 0xCD, 0x47, 0xC2, 0x43, 0x0C)
 
 DEFINE_EXPECT (CombineUrl)
 
 DEFINE_EXPECT (ParseUrl)
 
static HRESULT (WINAPI *pCreateUri)(LPCWSTR
 
static LPWSTR a2w (LPCSTR str)
 
static DWORD strcmp_aw (LPCSTR strA, LPCWSTR strB)
 
static ULONG get_refcnt (IUri *uri)
 
static void change_property (IUriBuilder *builder, const uri_builder_property *prop, DWORD test_index)
 
static void test_CreateUri_InvalidFlags (void)
 
static void test_CreateUri_InvalidArgs (void)
 
static void test_CreateUri_InvalidUri (void)
 
static void test_IUri_GetPropertyBSTR (void)
 
static void test_IUri_GetPropertyDWORD (void)
 
static void test_IUri_GetStrProperties (void)
 
static void test_IUri_GetDwordProperties (void)
 
static void test_IUri_GetPropertyLength (void)
 
static DWORD compute_expected_props (uri_properties *test, DWORD *mask)
 
static void test_IUri_GetProperties (void)
 
static void test_IUri_HasProperty (void)
 
static struct custom_uriimpl_from_IUri (IUri *iface)
 
static HRESULT WINAPI custom_uri_QueryInterface (IUri *iface, REFIID iid, void **out)
 
static ULONG WINAPI custom_uri_AddRef (IUri *iface)
 
static ULONG WINAPI custom_uri_Release (IUri *iface)
 
static HRESULT WINAPI custom_uri_GetPropertyBSTR (IUri *iface, Uri_PROPERTY property, BSTR *value, DWORD flags)
 
static HRESULT WINAPI custom_uri_GetPropertyLength (IUri *iface, Uri_PROPERTY property, DWORD *length, DWORD flags)
 
static HRESULT WINAPI custom_uri_GetPropertyDWORD (IUri *iface, Uri_PROPERTY property, DWORD *value, DWORD flags)
 
static HRESULT WINAPI custom_uri_HasProperty (IUri *iface, Uri_PROPERTY property, BOOL *has_property)
 
static HRESULT WINAPI custom_uri_GetAbsoluteUri (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetAuthority (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetDisplayUri (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetDomain (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetExtension (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetFragment (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetHost (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetPassword (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetPath (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetPathAndQuery (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetQuery (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetRawUri (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetSchemeName (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetUserInfo (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetUserName (IUri *iface, BSTR *value)
 
static HRESULT WINAPI custom_uri_GetHostType (IUri *iface, DWORD *value)
 
static HRESULT WINAPI custom_uri_GetPort (IUri *iface, DWORD *value)
 
static HRESULT WINAPI custom_uri_GetScheme (IUri *iface, DWORD *value)
 
static HRESULT WINAPI custom_uri_GetZone (IUri *iface, DWORD *value)
 
static HRESULT WINAPI custom_uri_GetProperties (IUri *iface, DWORD *flags)
 
static HRESULT WINAPI custom_uri_IsEqual (IUri *iface, IUri *pUri, BOOL *is_equal)
 
static void test_IUri_IsEqual (void)
 
static void test_CreateUriWithFragment_InvalidArgs (void)
 
static void test_CreateUriWithFragment_InvalidFlags (void)
 
static void test_CreateUriWithFragment (void)
 
static void test_CreateIUriBuilder (void)
 
static void test_IUriBuilder_CreateUri (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_CreateUriSimple (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_CreateUriWithFlags (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_CreateInvalidArgs (void)
 
static void test_IUriBuilder_GetInvalidArgs (void)
 
static void test_IUriBuilder_GetFragment (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetHost (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetPassword (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetPath (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetPort (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetQuery (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetSchemeName (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder_GetUserName (IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
 
static void test_IUriBuilder (void)
 
static void test_IUriBuilder_HasBeenModified (void)
 
static void test_IUriBuilder_IUriProperty (void)
 
static void test_IUriBuilder_RemoveProperties (void)
 
static void test_IUriBuilder_Misc (void)
 
static void test_IUriBuilderFactory (void)
 
static void test_CoInternetCombineIUri (void)
 
static HRESULT WINAPI InternetProtocolInfo_QueryInterface (IInternetProtocolInfo *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI InternetProtocolInfo_AddRef (IInternetProtocolInfo *iface)
 
static ULONG WINAPI InternetProtocolInfo_Release (IInternetProtocolInfo *iface)
 
static HRESULT WINAPI InternetProtocolInfo_ParseUrl (IInternetProtocolInfo *iface, LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
 
static HRESULT WINAPI InternetProtocolInfo_CombineUrl (IInternetProtocolInfo *iface, LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
 
static HRESULT WINAPI InternetProtocolInfo_CompareUrl (IInternetProtocolInfo *iface, LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
 
static HRESULT WINAPI InternetProtocolInfo_QueryInfo (IInternetProtocolInfo *iface, LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
 
static HRESULT WINAPI ClassFactory_QueryInterface (IClassFactory *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ClassFactory_AddRef (IClassFactory *iface)
 
static ULONG WINAPI ClassFactory_Release (IClassFactory *iface)
 
static HRESULT WINAPI ClassFactory_CreateInstance (IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
 
static HRESULT WINAPI ClassFactory_LockServer (IClassFactory *iface, BOOL dolock)
 
static void register_protocols (void)
 
static void unregister_protocols (void)
 
static void test_CoInternetCombineIUri_Pluggable (void)
 
static void test_CoInternetCombineUrlEx (void)
 
static void test_CoInternetCombineUrlEx_Pluggable (void)
 
static void test_CoInternetParseIUri_InvalidArgs (void)
 
static void test_CoInternetParseIUri (void)
 
static void test_CoInternetParseIUri_Pluggable (void)
 
static void _test_urlmon_display_name (unsigned line, IMoniker *mon, const char *exurl)
 
static void _test_display_uri (unsigned line, IMoniker *mon, const char *exurl)
 
static void test_CreateURLMoniker (void)
 
static int add_default_flags (DWORD flags)
 
static void test_IPersistStream (void)
 
static void test_UninitializedUri (void)
 
 START_TEST (uri)
 

Variables

static DWORD
 
static DWORD_PTR
 
static IUri **static LPCWSTR
 
static PARSEACTION
 
static LPWSTR
 
static const WCHAR http_urlW []
 
static const WCHAR http_url_fragW []
 
static const WCHAR combine_baseW []
 
static const WCHAR combine_relativeW [] = {'?','t','e','s','t',0}
 
static const WCHAR combine_resultW [] = {'z','i','p',':','t','e','s','t',0}
 
static const WCHAR winetestW [] = {'w','i','n','e','t','e','s','t',0}
 
static const WCHAR parse_urlW [] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0}
 
static const WCHAR parse_resultW [] = {'z','i','p',':','t','e','s','t',0}
 
static PARSEACTION parse_action
 
static DWORD parse_flags
 
static const uri_create_flag_test invalid_flag_tests []
 
static const uri_properties uri_tests []
 
static const invalid_uri invalid_uri_tests []
 
static const uri_equality equality_tests []
 
static const uri_with_fragment uri_fragment_tests []
 
static const uri_builder_test uri_builder_tests []
 
static const uri_builder_remove_test uri_builder_remove_tests []
 
static const uri_combine_test uri_combine_tests []
 
static const uri_parse_test uri_parse_tests []
 
static const IUriVtbl custom_uri_vtbl
 
static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
 
static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl }
 
static const IClassFactoryVtbl ClassFactoryVtbl
 
static IClassFactory protocol_cf = { &ClassFactoryVtbl }
 
static const create_urlmon_test_t create_urlmon_tests []
 

Macro Definition Documentation

◆ CHECK_CALLED

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
#define FALSE
Definition: types.h:117
GLenum func
Definition: glext.h:6028
#define expect_(expected, got, precision)
Definition: font.c:29

Definition at line 63 of file uri.c.

◆ CHECK_EXPECT

#define CHECK_EXPECT (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
expect_ ## func = FALSE; \
called_ ## func = TRUE; \
}while(0)
#define TRUE
Definition: types.h:120

Definition at line 50 of file uri.c.

◆ CHECK_EXPECT2

#define CHECK_EXPECT2 (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)

Definition at line 57 of file uri.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file uri.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 26 of file uri.c.

◆ DEFINE_EXPECT

#define DEFINE_EXPECT (   func)     static BOOL expect_ ## func = FALSE, called_ ## func = FALSE

Definition at line 44 of file uri.c.

◆ SET_EXPECT

#define SET_EXPECT (   func)     expect_ ## func = TRUE

Definition at line 47 of file uri.c.

◆ test_display_uri

#define test_display_uri (   a,
  b 
)    _test_display_uri(__LINE__,a,b)

Definition at line 11212 of file uri.c.

◆ test_urlmon_display_name

#define test_urlmon_display_name (   a,
  b 
)    _test_urlmon_display_name(__LINE__,a,b)

Definition at line 11198 of file uri.c.

◆ URI_BUILDER_STR_PROPERTY_COUNT

#define URI_BUILDER_STR_PROPERTY_COUNT   7

Definition at line 42 of file uri.c.

◆ URI_DWORD_PROPERTY_COUNT

#define URI_DWORD_PROPERTY_COUNT   (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1

Definition at line 41 of file uri.c.

◆ URI_STR_PROPERTY_COUNT

#define URI_STR_PROPERTY_COUNT   Uri_PROPERTY_STRING_LAST+1

Definition at line 40 of file uri.c.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 27 of file uri.c.

Typedef Documentation

◆ invalid_uri

◆ uri_builder_dword_property

◆ uri_builder_port

◆ uri_builder_property

◆ uri_builder_remove_test

◆ uri_builder_str_property

◆ uri_builder_test

◆ uri_combine_str_property

◆ uri_combine_test

◆ uri_create_flag_test

◆ uri_dword_property

◆ uri_equality

◆ uri_parse_test

◆ uri_properties

◆ uri_str_property

◆ uri_with_fragment

Function Documentation

◆ _test_display_uri()

static void _test_display_uri ( unsigned  line,
IMoniker mon,
const char exurl 
)
static

Definition at line 11213 of file uri.c.

11214{
11215 IUriContainer *uri_container;
11216 IUri *uri;
11217 BSTR display_uri;
11218 HRESULT hres;
11219
11220 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
11221 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
11222
11223 uri = NULL;
11224 hres = IUriContainer_GetIUri(uri_container, &uri);
11225 IUriContainer_Release(uri_container);
11226 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
11227 ok(uri != NULL, "uri == NULL\n");
11228
11229 hres = IUri_GetDisplayUri(uri, &display_uri);
11230 IUri_Release(uri);
11231 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
11232 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
11233 wine_dbgstr_w(display_uri), exurl);
11234 SysFreeString(display_uri);
11235}
#define ok(value,...)
Definition: atltest.h:57
#define ok_(x1, x2)
Definition: atltest.h:61
#define NULL
Definition: types.h:112
OLECHAR * BSTR
Definition: compat.h:2293
#define S_OK
Definition: intsafe.h:52
#define wine_dbgstr_w
Definition: kernel32.h:34
HRESULT hres
Definition: protocol.c:465
const char * uri
Definition: sec_mgr.c:1588
static DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB)
Definition: uri.c:7700
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
Definition: parser.c:49

◆ _test_urlmon_display_name()

static void _test_urlmon_display_name ( unsigned  line,
IMoniker mon,
const char exurl 
)
static

Definition at line 11199 of file uri.c.

11200{
11201 WCHAR *display_name;
11202 HRESULT hres;
11203
11204 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
11205 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
11206 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
11207 wine_dbgstr_w(display_name), exurl);
11208
11209 CoTaskMemFree(display_name);
11210}
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ a2w()

◆ add_default_flags()

static int add_default_flags ( DWORD  flags)
static

Definition at line 11315 of file uri.c.

11315 {
11316 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
11317 flags |= Uri_CREATE_CANONICALIZE;
11318 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
11319 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
11320 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
11321 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
11322 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
11323 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
11324 if(!(flags & Uri_CREATE_IE_SETTINGS))
11325 flags |= Uri_CREATE_NO_IE_SETTINGS;
11326
11327 return flags;
11328}
GLbitfield flags
Definition: glext.h:7161

Referenced by test_IPersistStream().

◆ change_property()

static void change_property ( IUriBuilder builder,
const uri_builder_property prop,
DWORD  test_index 
)
static

Definition at line 7712 of file uri.c.

7713 {
7714 HRESULT hr;
7715 LPWSTR valueW;
7716
7717 valueW = a2w(prop->value);
7718 switch(prop->property) {
7719 case Uri_PROPERTY_FRAGMENT:
7720 hr = IUriBuilder_SetFragment(builder, valueW);
7721 todo_wine_if(prop->todo) {
7722 ok(hr == prop->expected,
7723 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7724 hr, prop->expected, test_index);
7725 }
7726 break;
7727 case Uri_PROPERTY_HOST:
7728 hr = IUriBuilder_SetHost(builder, valueW);
7729 todo_wine_if(prop->todo) {
7730 ok(hr == prop->expected,
7731 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7732 hr, prop->expected, test_index);
7733 }
7734 break;
7735 case Uri_PROPERTY_PASSWORD:
7736 hr = IUriBuilder_SetPassword(builder, valueW);
7737 todo_wine_if(prop->todo) {
7738 ok(hr == prop->expected,
7739 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7740 hr, prop->expected, test_index);
7741 }
7742 break;
7743 case Uri_PROPERTY_PATH:
7744 hr = IUriBuilder_SetPath(builder, valueW);
7745 todo_wine_if(prop->todo) {
7746 ok(hr == prop->expected,
7747 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7748 hr, prop->expected, test_index);
7749 }
7750 break;
7751 case Uri_PROPERTY_QUERY:
7752 hr = IUriBuilder_SetQuery(builder, valueW);
7753 todo_wine_if(prop->todo) {
7754 ok(hr == prop->expected,
7755 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7756 hr, prop->expected, test_index);
7757 }
7758 break;
7759 case Uri_PROPERTY_SCHEME_NAME:
7760 hr = IUriBuilder_SetSchemeName(builder, valueW);
7761 todo_wine_if(prop->todo) {
7762 ok(hr == prop->expected,
7763 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7764 hr, prop->expected, test_index);
7765 }
7766 break;
7767 case Uri_PROPERTY_USER_NAME:
7768 hr = IUriBuilder_SetUserName(builder, valueW);
7769 todo_wine_if(prop->todo) {
7770 ok(hr == prop->expected,
7771 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7772 hr, prop->expected, test_index);
7773 }
7774 break;
7775 default:
7776 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
7777 }
7778
7780}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define trace
Definition: atltest.h:70
static const WCHAR valueW[]
Definition: object.c:48
#define todo_wine_if(is_todo)
Definition: custom.c:76
static LPWSTR a2w(LPCSTR str)
Definition: uri.c:7688
HRESULT hr
Definition: shlfolder.c:183
const char * value
Definition: uri.c:5307
Uri_PROPERTY property
Definition: uri.c:5309
HRESULT expected
Definition: uri.c:5310

Referenced by test_IUriBuilder().

◆ ClassFactory_AddRef()

static ULONG WINAPI ClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 10726 of file uri.c.

10727{
10728 return 2;
10729}

◆ ClassFactory_CreateInstance()

static HRESULT WINAPI ClassFactory_CreateInstance ( IClassFactory iface,
IUnknown pOuter,
REFIID  riid,
void **  ppv 
)
static

Definition at line 10736 of file uri.c.

10738{
10739 ok(0, "unexpected call\n");
10740 return E_NOTIMPL;
10741}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ClassFactory_LockServer()

static HRESULT WINAPI ClassFactory_LockServer ( IClassFactory iface,
BOOL  dolock 
)
static

Definition at line 10743 of file uri.c.

10744{
10745 ok(0, "unexpected call\n");
10746 return S_OK;
10747}

◆ ClassFactory_QueryInterface()

static HRESULT WINAPI ClassFactory_QueryInterface ( IClassFactory iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 10715 of file uri.c.

10716{
10717 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10718 *ppv = &protocol_info;
10719 return S_OK;
10720 }
10721
10722 ok(0, "unexpected call\n");
10723 return E_NOINTERFACE;
10724}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static IInternetProtocolInfo protocol_info
Definition: uri.c:10713
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ ClassFactory_Release()

static ULONG WINAPI ClassFactory_Release ( IClassFactory iface)
static

Definition at line 10731 of file uri.c.

10732{
10733 return 1;
10734}

◆ compute_expected_props()

static DWORD compute_expected_props ( uri_properties test,
DWORD mask 
)
static

Definition at line 8393 of file uri.c.

8394{
8395 DWORD ret = 0, i;
8396
8397 *mask = 0;
8398
8399 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
8400 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
8401 ret |= 1<<i;
8402 if(test->str_props[i-Uri_PROPERTY_STRING_START].value2 == NULL ||
8403 test->str_props[i-Uri_PROPERTY_STRING_START].expected ==
8404 test->str_props[i-Uri_PROPERTY_STRING_START].expected2)
8405 *mask |= 1<<i;
8406 }
8407
8408 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
8409 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
8410 ret |= 1<<i;
8411 *mask |= 1<<i;
8412 }
8413
8414 return ret;
8415}
GLenum GLint GLuint mask
Definition: glext.h:6028
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define test
Definition: rosglue.h:37

Referenced by test_IUri_GetProperties(), and test_IUri_HasProperty().

◆ custom_uri_AddRef()

static ULONG WINAPI custom_uri_AddRef ( IUri iface)
static

Definition at line 8542 of file uri.c.

8543{
8544 struct custom_uri *uri = impl_from_IUri(iface);
8545 return IUri_AddRef(uri->uri);
8546}
static Uri * impl_from_IUri(IUri *iface)
Definition: uri.c:4206

◆ custom_uri_GetAbsoluteUri()

static HRESULT WINAPI custom_uri_GetAbsoluteUri ( IUri iface,
BSTR value 
)
static

Definition at line 8578 of file uri.c.

8579{
8580 struct custom_uri *uri = impl_from_IUri(iface);
8581 return IUri_GetAbsoluteUri(uri->uri, value);
8582}
Definition: pdh_main.c:94

◆ custom_uri_GetAuthority()

static HRESULT WINAPI custom_uri_GetAuthority ( IUri iface,
BSTR value 
)
static

Definition at line 8584 of file uri.c.

8585{
8586 struct custom_uri *uri = impl_from_IUri(iface);
8587 return IUri_GetAbsoluteUri(uri->uri, value);
8588}

◆ custom_uri_GetDisplayUri()

static HRESULT WINAPI custom_uri_GetDisplayUri ( IUri iface,
BSTR value 
)
static

Definition at line 8590 of file uri.c.

8591{
8592 struct custom_uri *uri = impl_from_IUri(iface);
8593 return IUri_GetAbsoluteUri(uri->uri, value);
8594}

◆ custom_uri_GetDomain()

static HRESULT WINAPI custom_uri_GetDomain ( IUri iface,
BSTR value 
)
static

Definition at line 8596 of file uri.c.

8597{
8598 struct custom_uri *uri = impl_from_IUri(iface);
8599 return IUri_GetAbsoluteUri(uri->uri, value);
8600}

◆ custom_uri_GetExtension()

static HRESULT WINAPI custom_uri_GetExtension ( IUri iface,
BSTR value 
)
static

Definition at line 8602 of file uri.c.

8603{
8604 struct custom_uri *uri = impl_from_IUri(iface);
8605 return IUri_GetAbsoluteUri(uri->uri, value);
8606}

◆ custom_uri_GetFragment()

static HRESULT WINAPI custom_uri_GetFragment ( IUri iface,
BSTR value 
)
static

Definition at line 8608 of file uri.c.

8609{
8610 struct custom_uri *uri = impl_from_IUri(iface);
8611 return IUri_GetAbsoluteUri(uri->uri, value);
8612}

◆ custom_uri_GetHost()

static HRESULT WINAPI custom_uri_GetHost ( IUri iface,
BSTR value 
)
static

Definition at line 8614 of file uri.c.

8615{
8616 struct custom_uri *uri = impl_from_IUri(iface);
8617 return IUri_GetAbsoluteUri(uri->uri, value);
8618}

◆ custom_uri_GetHostType()

static HRESULT WINAPI custom_uri_GetHostType ( IUri iface,
DWORD value 
)
static

Definition at line 8668 of file uri.c.

8669{
8670 struct custom_uri *uri = impl_from_IUri(iface);
8671 return IUri_GetHostType(uri->uri, value);
8672}

◆ custom_uri_GetPassword()

static HRESULT WINAPI custom_uri_GetPassword ( IUri iface,
BSTR value 
)
static

Definition at line 8620 of file uri.c.

8621{
8622 struct custom_uri *uri = impl_from_IUri(iface);
8623 return IUri_GetAbsoluteUri(uri->uri, value);
8624}

◆ custom_uri_GetPath()

static HRESULT WINAPI custom_uri_GetPath ( IUri iface,
BSTR value 
)
static

Definition at line 8626 of file uri.c.

8627{
8628 struct custom_uri *uri = impl_from_IUri(iface);
8629 return IUri_GetAbsoluteUri(uri->uri, value);
8630}

◆ custom_uri_GetPathAndQuery()

static HRESULT WINAPI custom_uri_GetPathAndQuery ( IUri iface,
BSTR value 
)
static

Definition at line 8632 of file uri.c.

8633{
8634 struct custom_uri *uri = impl_from_IUri(iface);
8635 return IUri_GetAbsoluteUri(uri->uri, value);
8636}

◆ custom_uri_GetPort()

static HRESULT WINAPI custom_uri_GetPort ( IUri iface,
DWORD value 
)
static

Definition at line 8674 of file uri.c.

8675{
8676 struct custom_uri *uri = impl_from_IUri(iface);
8677 return IUri_GetPort(uri->uri, value);
8678}

◆ custom_uri_GetProperties()

static HRESULT WINAPI custom_uri_GetProperties ( IUri iface,
DWORD flags 
)
static

Definition at line 8692 of file uri.c.

8693{
8694 struct custom_uri *uri = impl_from_IUri(iface);
8695 return IUri_GetProperties(uri->uri, flags);
8696}

◆ custom_uri_GetPropertyBSTR()

static HRESULT WINAPI custom_uri_GetPropertyBSTR ( IUri iface,
Uri_PROPERTY  property,
BSTR value,
DWORD  flags 
)
static

Definition at line 8554 of file uri.c.

8555{
8556 struct custom_uri *uri = impl_from_IUri(iface);
8557 return IUri_GetPropertyBSTR(uri->uri, property, value, flags);
8558}

◆ custom_uri_GetPropertyDWORD()

static HRESULT WINAPI custom_uri_GetPropertyDWORD ( IUri iface,
Uri_PROPERTY  property,
DWORD value,
DWORD  flags 
)
static

Definition at line 8566 of file uri.c.

8567{
8568 struct custom_uri *uri = impl_from_IUri(iface);
8569 return IUri_GetPropertyDWORD(uri->uri, property, value, flags);
8570}

◆ custom_uri_GetPropertyLength()

static HRESULT WINAPI custom_uri_GetPropertyLength ( IUri iface,
Uri_PROPERTY  property,
DWORD length,
DWORD  flags 
)
static

Definition at line 8560 of file uri.c.

8561{
8562 struct custom_uri *uri = impl_from_IUri(iface);
8563 return IUri_GetPropertyLength(uri->uri, property, length, flags);
8564}
GLuint GLsizei GLsizei * length
Definition: glext.h:6040

◆ custom_uri_GetQuery()

static HRESULT WINAPI custom_uri_GetQuery ( IUri iface,
BSTR value 
)
static

Definition at line 8638 of file uri.c.

8639{
8640 struct custom_uri *uri = impl_from_IUri(iface);
8641 return IUri_GetAbsoluteUri(uri->uri, value);
8642}

◆ custom_uri_GetRawUri()

static HRESULT WINAPI custom_uri_GetRawUri ( IUri iface,
BSTR value 
)
static

Definition at line 8644 of file uri.c.

8645{
8646 struct custom_uri *uri = impl_from_IUri(iface);
8647 return IUri_GetAbsoluteUri(uri->uri, value);
8648}

◆ custom_uri_GetScheme()

static HRESULT WINAPI custom_uri_GetScheme ( IUri iface,
DWORD value 
)
static

Definition at line 8680 of file uri.c.

8681{
8682 struct custom_uri *uri = impl_from_IUri(iface);
8683 return IUri_GetScheme(uri->uri, value);
8684}

◆ custom_uri_GetSchemeName()

static HRESULT WINAPI custom_uri_GetSchemeName ( IUri iface,
BSTR value 
)
static

Definition at line 8650 of file uri.c.

8651{
8652 struct custom_uri *uri = impl_from_IUri(iface);
8653 return IUri_GetSchemeName(uri->uri, value);
8654}

◆ custom_uri_GetUserInfo()

static HRESULT WINAPI custom_uri_GetUserInfo ( IUri iface,
BSTR value 
)
static

Definition at line 8656 of file uri.c.

8657{
8658 struct custom_uri *uri = impl_from_IUri(iface);
8659 return IUri_GetUserInfo(uri->uri, value);
8660}

◆ custom_uri_GetUserName()

static HRESULT WINAPI custom_uri_GetUserName ( IUri iface,
BSTR value 
)
static

Definition at line 8662 of file uri.c.

8663{
8664 struct custom_uri *uri = impl_from_IUri(iface);
8665 return IUri_GetUserName(uri->uri, value);
8666}

◆ custom_uri_GetZone()

static HRESULT WINAPI custom_uri_GetZone ( IUri iface,
DWORD value 
)
static

Definition at line 8686 of file uri.c.

8687{
8688 struct custom_uri *uri = impl_from_IUri(iface);
8689 return IUri_GetZone(uri->uri, value);
8690}

◆ custom_uri_HasProperty()

static HRESULT WINAPI custom_uri_HasProperty ( IUri iface,
Uri_PROPERTY  property,
BOOL has_property 
)
static

Definition at line 8572 of file uri.c.

8573{
8574 struct custom_uri *uri = impl_from_IUri(iface);
8575 return IUri_HasProperty(uri->uri, property, has_property);
8576}

◆ custom_uri_IsEqual()

static HRESULT WINAPI custom_uri_IsEqual ( IUri iface,
IUri pUri,
BOOL is_equal 
)
static

Definition at line 8698 of file uri.c.

8699{
8700 struct custom_uri *uri = impl_from_IUri(iface);
8701 return IUri_IsEqual(uri->uri, pUri, is_equal);
8702}

◆ custom_uri_QueryInterface()

static HRESULT WINAPI custom_uri_QueryInterface ( IUri iface,
REFIID  iid,
void **  out 
)
static

Definition at line 8529 of file uri.c.

8530{
8531 if (IsEqualIID(iid, &IID_IUri) || IsEqualIID(iid, &IID_IUnknown))
8532 {
8533 *out = iface;
8534 IUri_AddRef(iface);
8535 return S_OK;
8536 }
8537
8538 *out = NULL;
8539 return E_NOINTERFACE;
8540}
const GUID IID_IUnknown
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static FILE * out
Definition: regtests2xml.c:44

◆ custom_uri_Release()

static ULONG WINAPI custom_uri_Release ( IUri iface)
static

Definition at line 8548 of file uri.c.

8549{
8550 struct custom_uri *uri = impl_from_IUri(iface);
8551 return IUri_Release(uri->uri);
8552}

◆ DEFINE_EXPECT() [1/2]

DEFINE_EXPECT ( CombineUrl  )

◆ DEFINE_EXPECT() [2/2]

DEFINE_EXPECT ( ParseUrl  )

◆ DEFINE_GUID()

DEFINE_GUID ( CLSID_CUri  ,
0xDF2FCE13  ,
0x25EC  ,
0x45BB  ,
0x9D  ,
0x4C  ,
0xCE  ,
0xCD  ,
0x47  ,
0xC2  ,
0x43  ,
0x0C   
)

◆ get_refcnt()

static ULONG get_refcnt ( IUri uri)
inlinestatic

Definition at line 7707 of file uri.c.

7707 {
7708 IUri_AddRef(uri);
7709 return IUri_Release(uri);
7710}

Referenced by test_CreateIUriBuilder(), and test_IUriBuilder_IUriProperty().

◆ HRESULT()

static HRESULT ( WINAPI pCreateUri)
static

◆ impl_from_IUri()

static struct custom_uri * impl_from_IUri ( IUri iface)
inlinestatic

Definition at line 8524 of file uri.c.

8525{
8526 return CONTAINING_RECORD(iface, struct custom_uri, IUri_iface);
8527}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

◆ InternetProtocolInfo_AddRef()

static ULONG WINAPI InternetProtocolInfo_AddRef ( IInternetProtocolInfo iface)
static

Definition at line 10642 of file uri.c.

10643{
10644 return 2;
10645}

◆ InternetProtocolInfo_CombineUrl()

static HRESULT WINAPI InternetProtocolInfo_CombineUrl ( IInternetProtocolInfo iface,
LPCWSTR  pwzBaseUrl,
LPCWSTR  pwzRelativeUrl,
DWORD  dwCombineFlags,
LPWSTR  pwzResult,
DWORD  cchResult,
DWORD pcchResult,
DWORD  dwReserved 
)
static

Definition at line 10669 of file uri.c.

10672{
10673 CHECK_EXPECT(CombineUrl);
10674 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
10676 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
10679 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
10680 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
10681
10682 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
10683 *pcchResult = lstrlenW(combine_resultW);
10684
10685 return S_OK;
10686}
#define lstrlenW
Definition: compat.h:750
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1418
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const WCHAR combine_relativeW[]
Definition: uri.c:89
#define CHECK_EXPECT(func)
Definition: uri.c:50
static const WCHAR combine_resultW[]
Definition: uri.c:90
static const WCHAR combine_baseW[]
Definition: uri.c:87
#define URL_DONT_SIMPLIFY
Definition: shlwapi.h:1214
#define URL_FILE_USE_PATHURL
Definition: shlwapi.h:1226
#define URL_DONT_UNESCAPE_EXTRA_INFO
Definition: shlwapi.h:1218

◆ InternetProtocolInfo_CompareUrl()

static HRESULT WINAPI InternetProtocolInfo_CompareUrl ( IInternetProtocolInfo iface,
LPCWSTR  pwzUrl1,
LPCWSTR  pwzUrl2,
DWORD  dwCompareFlags 
)
static

Definition at line 10688 of file uri.c.

10690{
10691 ok(0, "unexpected call\n");
10692 return E_NOTIMPL;
10693}

◆ InternetProtocolInfo_ParseUrl()

static HRESULT WINAPI InternetProtocolInfo_ParseUrl ( IInternetProtocolInfo iface,
LPCWSTR  pwzUrl,
PARSEACTION  ParseAction,
DWORD  dwParseFlags,
LPWSTR  pwzResult,
DWORD  cchResult,
DWORD pcchResult,
DWORD  dwReserved 
)
static

Definition at line 10652 of file uri.c.

10655{
10656 CHECK_EXPECT(ParseUrl);
10657 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
10659 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
10660 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
10661 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
10662
10663 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
10664 *pcchResult = lstrlenW(parse_resultW);
10665
10666 return S_OK;
10667}
static const WCHAR parse_resultW[]
Definition: uri.c:95
static PARSEACTION parse_action
Definition: uri.c:97
static const WCHAR parse_urlW[]
Definition: uri.c:94
static DWORD parse_flags
Definition: uri.c:98

◆ InternetProtocolInfo_QueryInfo()

static HRESULT WINAPI InternetProtocolInfo_QueryInfo ( IInternetProtocolInfo iface,
LPCWSTR  pwzUrl,
QUERYOPTION  OueryOption,
DWORD  dwQueryFlags,
LPVOID  pBuffer,
DWORD  cbBuffer,
DWORD pcbBuf,
DWORD  dwReserved 
)
static

Definition at line 10695 of file uri.c.

10698{
10699 ok(0, "unexpected call\n");
10700 return E_NOTIMPL;
10701}

◆ InternetProtocolInfo_QueryInterface()

static HRESULT WINAPI InternetProtocolInfo_QueryInterface ( IInternetProtocolInfo iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 10635 of file uri.c.

10637{
10638 ok(0, "unexpected call\n");
10639 return E_NOINTERFACE;
10640}

◆ InternetProtocolInfo_Release()

static ULONG WINAPI InternetProtocolInfo_Release ( IInternetProtocolInfo iface)
static

Definition at line 10647 of file uri.c.

10648{
10649 return 1;
10650}

◆ register_protocols()

static void register_protocols ( void  )
static

Definition at line 10759 of file uri.c.

10760{
10762 HRESULT hres;
10763
10764 hres = pCoInternetGetSession(0, &session, 0);
10765 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10766 if(FAILED(hres))
10767 return;
10768
10769 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10770 winetestW, 0, NULL, 0);
10771 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10772
10773 IInternetSession_Release(session);
10774}
#define FAILED(hr)
Definition: intsafe.h:51
static const WCHAR winetestW[]
Definition: uri.c:92
static IClassFactory protocol_cf
Definition: uri.c:10757
#define IID_NULL
Definition: guiddef.h:98

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( uri  )

Definition at line 11653 of file uri.c.

11653 {
11654 HMODULE hurlmon;
11655
11656 hurlmon = GetModuleHandleA("urlmon.dll");
11657 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
11658 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
11659 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
11660 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
11661 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
11662 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
11663 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
11664 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
11665 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
11666
11667 if(!pCreateUri) {
11668 win_skip("CreateUri is not present, skipping tests.\n");
11669 return;
11670 }
11671
11672 trace("test CreateUri invalid flags...\n");
11674
11675 trace("test CreateUri invalid args...\n");
11677
11678 trace("test CreateUri invalid URIs...\n");
11680
11681 trace("test IUri_GetPropertyBSTR...\n");
11683
11684 trace("test IUri_GetPropertyDWORD...\n");
11686
11687 trace("test IUri_GetStrProperties...\n");
11689
11690 trace("test IUri_GetDwordProperties...\n");
11692
11693 trace("test IUri_GetPropertyLength...\n");
11695
11696 trace("test IUri_GetProperties...\n");
11698
11699 trace("test IUri_HasProperty...\n");
11701
11702 trace("test IUri_IsEqual...\n");
11704
11705 trace("test CreateUriWithFragment invalid args...\n");
11707
11708 trace("test CreateUriWithFragment invalid flags...\n");
11710
11711 trace("test CreateUriWithFragment...\n");
11713
11714 trace("test CreateIUriBuilder...\n");
11716
11717 trace("test IUriBuilder_CreateInvalidArgs...\n");
11719
11720 trace("test IUriBuilder...\n");
11722
11723 trace("test IUriBuilder_GetInvalidArgs...\n");
11725
11726 trace("test IUriBuilder_HasBeenModified...\n");
11728
11729 trace("test IUriBuilder_IUriProperty...\n");
11731
11732 trace("test IUriBuilder_RemoveProperties...\n");
11734
11735 trace("test IUriBuilder miscellaneous...\n");
11737
11738 trace("test IUriBuilderFactory...\n");
11740
11741 trace("test CoInternetCombineIUri...\n");
11743
11744 trace("test CoInternetCombineUrlEx...\n");
11746
11747 trace("test CoInternetParseIUri Invalid Args...\n");
11749
11750 trace("test CoInternetParseIUri...\n");
11752
11754
11755 trace("test CoInternetCombineIUri pluggable...\n");
11757
11758 trace("test CoInternetCombineUrlEx Pluggable...\n");
11760
11761 trace("test CoInternetParseIUri pluggable...\n");
11763
11764 trace("test CreateURLMoniker...\n");
11766
11768
11769 trace("test IPersistStream...\n");
11771
11772 trace("test uninitialized Uri...\n");
11774
11777}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
static void test_IUriBuilder_CreateInvalidArgs(void)
Definition: uri.c:9072
static void test_CreateIUriBuilder(void)
Definition: uri.c:8885
static void test_CoInternetCombineUrlEx_Pluggable(void)
Definition: uri.c:10921
static void test_CreateUri_InvalidUri(void)
Definition: uri.c:7825
static void test_IUriBuilder_HasBeenModified(void)
Definition: uri.c:10099
static void test_IUri_HasProperty(void)
Definition: uri.c:8466
static void test_IUriBuilder_RemoveProperties(void)
Definition: uri.c:10342
static void test_CoInternetParseIUri_Pluggable(void)
Definition: uri.c:11084
static void unregister_protocols(void)
Definition: uri.c:10776
static void test_IUri_GetProperties(void)
Definition: uri.c:8417
static void test_CoInternetParseIUri(void)
Definition: uri.c:11044
static void test_CreateURLMoniker(void)
Definition: uri.c:11237
static void test_CreateUriWithFragment_InvalidArgs(void)
Definition: uri.c:8813
static void test_CoInternetCombineIUri_Pluggable(void)
Definition: uri.c:10791
static void test_IUriBuilder_Misc(void)
Definition: uri.c:10426
static void test_CoInternetCombineIUri(void)
Definition: uri.c:10541
static void test_CreateUri_InvalidFlags(void)
Definition: uri.c:7786
static void test_IUri_GetPropertyBSTR(void)
Definition: uri.c:7845
static void test_IUri_GetDwordProperties(void)
Definition: uri.c:8237
static void test_IUri_GetPropertyDWORD(void)
Definition: uri.c:7921
static void test_CoInternetParseIUri_InvalidArgs(void)
Definition: uri.c:10953
static void test_IUriBuilder_IUriProperty(void)
Definition: uri.c:10205
static void register_protocols(void)
Definition: uri.c:10759
static void test_UninitializedUri(void)
Definition: uri.c:11561
static void test_IUri_GetStrProperties(void)
Definition: uri.c:7976
static void test_IUriBuilder_GetInvalidArgs(void)
Definition: uri.c:9164
static void test_CreateUriWithFragment(void)
Definition: uri.c:8847
static void test_IUriBuilderFactory(void)
Definition: uri.c:10454
static void test_IPersistStream(void)
Definition: uri.c:11330
static void test_IUri_IsEqual(void)
Definition: uri.c:8736
static void test_IUri_GetPropertyLength(void)
Definition: uri.c:8326
static void test_IUriBuilder(void)
Definition: uri.c:10019
static void test_CreateUriWithFragment_InvalidFlags(void)
Definition: uri.c:8833
static void test_CreateUri_InvalidArgs(void)
Definition: uri.c:7800
static void test_CoInternetCombineUrlEx(void)
Definition: uri.c:10830
#define win_skip
Definition: test.h:160

◆ strcmp_aw()

◆ test_CoInternetCombineIUri()

static void test_CoInternetCombineIUri ( void  )
static

Definition at line 10541 of file uri.c.

10541 {
10542 HRESULT hr;
10543 IUri *base, *relative, *result;
10544 DWORD i;
10545
10546 base = NULL;
10547 hr = pCreateUri(http_urlW, 0, 0, &base);
10548 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10549 if(SUCCEEDED(hr)) {
10550 result = (void*) 0xdeadbeef;
10551 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
10552 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10553 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10554 }
10555
10556 relative = NULL;
10557 hr = pCreateUri(http_urlW, 0, 0, &relative);
10558 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10559 if(SUCCEEDED(hr)) {
10560 result = (void*) 0xdeadbeef;
10561 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
10562 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10563 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10564 }
10565
10566 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
10567 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10568
10569 if(base) IUri_Release(base);
10570 if(relative) IUri_Release(relative);
10571
10572 for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) {
10573 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10574
10575 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10576 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10577 if(SUCCEEDED(hr)) {
10578 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10579
10580 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
10581 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10582 if(SUCCEEDED(hr)) {
10583 result = NULL;
10584
10585 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
10588 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10590 if(SUCCEEDED(hr)) {
10591 DWORD j;
10592
10593 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) {
10595 BSTR received;
10596
10597 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10598 todo_wine_if(prop.todo) {
10599 ok(hr == prop.expected,
10600 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10601 hr, prop.expected, i, j);
10602 ok(!strcmp_aw(prop.value, received) ||
10604 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10605 prop.value, wine_dbgstr_w(received), i, j);
10606 }
10608 }
10609
10610 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) {
10613
10614 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10615 todo_wine_if(prop.todo) {
10616 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10617 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10618 hr, prop.expected, i, j);
10619 if(!prop.broken_combine_hres || hr != S_FALSE)
10620 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10621 prop.value, received, i, j);
10622 }
10623 }
10624 }
10625 if(result) IUri_Release(result);
10626 }
10627 if(relative) IUri_Release(relative);
10628 heap_free(relativeW);
10629 }
10630 if(base) IUri_Release(base);
10632 }
10633}
static WCHAR baseW[MAX_PATH]
Definition: FindFiles.c:24
#define broken(x)
Definition: _sntprintf.h:21
#define ARRAY_SIZE(A)
Definition: main.h:33
#define E_INVALIDARG
Definition: ddrawi.h:101
r received
Definition: btrfs.c:3005
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define SUCCEEDED(hr)
Definition: intsafe.h:50
BOOL todo
Definition: filedlg.c:313
BOOL expected
Definition: store.c:2063
static const uri_combine_test uri_combine_tests[]
Definition: uri.c:6441
static const WCHAR http_urlW[]
Definition: uri.c:82
const char * broken_value
Definition: uri.c:6424
const char * value
Definition: uri.c:6421
uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT]
Definition: uri.c:6437
uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT]
Definition: uri.c:6438
HRESULT expected
Definition: uri.c:125
BOOL broken_combine_hres
Definition: uri.c:127
#define S_FALSE
Definition: winerror.h:2357

Referenced by START_TEST().

◆ test_CoInternetCombineIUri_Pluggable()

static void test_CoInternetCombineIUri_Pluggable ( void  )
static

Definition at line 10791 of file uri.c.

10791 {
10792 HRESULT hr;
10793 IUri *base = NULL;
10794
10795 hr = pCreateUri(combine_baseW, 0, 0, &base);
10796 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10797 if(SUCCEEDED(hr)) {
10798 IUri *relative = NULL;
10799
10800 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10801 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10802 if(SUCCEEDED(hr)) {
10803 IUri *result = NULL;
10804
10805 SET_EXPECT(CombineUrl);
10806
10808 &result, 0);
10809 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10810
10811 CHECK_CALLED(CombineUrl);
10812
10813 if(SUCCEEDED(hr)) {
10814 BSTR received = NULL;
10815 hr = IUri_GetAbsoluteUri(result, &received);
10816 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10817 if(SUCCEEDED(hr)) {
10818 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10820 }
10822 }
10823 if(result) IUri_Release(result);
10824 }
10825 if(relative) IUri_Release(relative);
10826 }
10827 if(base) IUri_Release(base);
10828}
#define SET_EXPECT(func)
Definition: uri.c:47
#define CHECK_CALLED(func)
Definition: uri.c:63

Referenced by START_TEST().

◆ test_CoInternetCombineUrlEx()

static void test_CoInternetCombineUrlEx ( void  )
static

Definition at line 10830 of file uri.c.

10830 {
10831 HRESULT hr;
10832 IUri *base, *result;
10833 DWORD i;
10834
10835 base = NULL;
10836 hr = pCreateUri(http_urlW, 0, 0, &base);
10837 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10838 if(SUCCEEDED(hr)) {
10839 result = (void*) 0xdeadbeef;
10840 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10841 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10842 hr, E_UNEXPECTED);
10843 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10844 }
10845
10846 result = (void*) 0xdeadbeef;
10847 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10848 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10849 hr, E_INVALIDARG);
10850 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10851
10852 result = (void*) 0xdeadbeef;
10853 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10854 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10855 hr, E_UNEXPECTED);
10856 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10857
10858 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10859 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10860 hr, E_POINTER);
10861 if(base) IUri_Release(base);
10862
10863 for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) {
10864 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10865
10866 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10867 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10868 if(SUCCEEDED(hr)) {
10869 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10870
10871 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10872 &result, 0);
10875 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10877 if(SUCCEEDED(hr)) {
10878 DWORD j;
10879
10880 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) {
10882 BSTR received;
10883 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10884
10885 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10886 todo_wine_if(prop.todo) {
10887 ok(hr == prop.expected,
10888 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10889 hr, prop.expected, i, j);
10892 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10894 }
10896 }
10897
10898 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) {
10901
10902 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10903 todo_wine_if(prop.todo) {
10904 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10905 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10906 hr, prop.expected, i, j);
10907 if(!prop.broken_combine_hres || hr != S_FALSE)
10908 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10909 prop.value, received, i, j);
10910 }
10911 }
10912 }
10913 if(result) IUri_Release(result);
10914 heap_free(relativeW);
10915 }
10916 if(base) IUri_Release(base);
10918 }
10919}
const char * value_ex
Definition: uri.c:6425
#define E_UNEXPECTED
Definition: winerror.h:2456
#define E_POINTER
Definition: winerror.h:2365
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by START_TEST().

◆ test_CoInternetCombineUrlEx_Pluggable()

static void test_CoInternetCombineUrlEx_Pluggable ( void  )
static

Definition at line 10921 of file uri.c.

10921 {
10922 HRESULT hr;
10923 IUri *base = NULL;
10924
10925 hr = pCreateUri(combine_baseW, 0, 0, &base);
10926 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10927 if(SUCCEEDED(hr)) {
10928 IUri *result = NULL;
10929
10930 SET_EXPECT(CombineUrl);
10931
10933 &result, 0);
10934 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10935
10936 CHECK_CALLED(CombineUrl);
10937
10938 if(SUCCEEDED(hr)) {
10939 BSTR received = NULL;
10940 hr = IUri_GetAbsoluteUri(result, &received);
10941 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10942 if(SUCCEEDED(hr)) {
10943 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10945 }
10947 }
10948 if(result) IUri_Release(result);
10949 }
10950 if(base) IUri_Release(base);
10951}

Referenced by START_TEST().

◆ test_CoInternetParseIUri()

static void test_CoInternetParseIUri ( void  )
static

Definition at line 11044 of file uri.c.

11044 {
11045 DWORD i;
11046
11047 for(i = 0; i < ARRAY_SIZE(uri_parse_tests); ++i) {
11048 HRESULT hr;
11049 IUri *uri;
11050 LPWSTR uriW;
11052
11053 uriW = a2w(test.uri);
11054 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
11055 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
11056 if(SUCCEEDED(hr)) {
11058 DWORD result_len = -1;
11059
11060 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
11061 todo_wine_if(test.todo)
11062 ok(hr == test.expected,
11063 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
11064 hr, test.expected, i);
11065 if(SUCCEEDED(hr)) {
11066 DWORD len = lstrlenA(test.property);
11067 ok(!strcmp_aw(test.property, result) || (test.property2 && !strcmp_aw(test.property2, result)),
11068 "Error: Expected %s but got %s instead on uri_parse_tests[%d] - %s.\n",
11069 test.property, wine_dbgstr_w(result), i, wine_dbgstr_w(uriW));
11070 ok(len == result_len || (test.property2 && lstrlenA(test.property2) == result_len),
11071 "Error: Expected %d, but got %d instead on uri_parse_tests[%d] - %s.\n",
11072 len, result_len, i, wine_dbgstr_w(uriW));
11073 } else {
11074 ok(!result_len,
11075 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
11076 result_len, i);
11077 }
11078 }
11079 if(uri) IUri_Release(uri);
11080 heap_free(uriW);
11081 }
11082}
BOOL Error
Definition: chkdsk.c:66
HRESULT WINAPI CoInternetParseIUri(IUri *pIUri, PARSEACTION ParseAction, DWORD dwFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD_PTR dwReserved)
Definition: uri.c:7247
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble n
Definition: glext.h:7729
#define d
Definition: ke_i.h:81
if(dx< 0)
Definition: linetemp.h:194
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static const uri_parse_test uri_parse_tests[]
Definition: uri.c:7612

Referenced by START_TEST().

◆ test_CoInternetParseIUri_InvalidArgs()

static void test_CoInternetParseIUri_InvalidArgs ( void  )
static

Definition at line 10953 of file uri.c.

10953 {
10954 HRESULT hr;
10955 IUri *uri = NULL;
10956 WCHAR tmp[3];
10957 WCHAR *longurl, *copy;
10958 DWORD result = -1;
10959 DWORD i, len;
10960
10961 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10962 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10963 hr, E_INVALIDARG);
10964 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10965
10966 hr = pCreateUri(http_urlW, 0, 0, &uri);
10967 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10968 if(SUCCEEDED(hr)) {
10969 DWORD expected_len;
10970
10971 result = -1;
10972 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10973 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10974 hr, E_INVALIDARG);
10975 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10976
10977 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10978 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10979 hr, E_POINTER);
10980
10981 result = -1;
10982 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10983 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10984 hr, E_FAIL);
10985 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10986
10987 result = -1;
10988 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10989 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10990 hr, E_FAIL);
10991 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10992
10993 result = -1;
10994 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10995 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10996 hr, E_FAIL);
10997 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10998
10999 result = -1;
11000 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
11001 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11002 hr, E_FAIL);
11003 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11004
11005 expected_len = lstrlenW(http_urlW);
11006 result = -1;
11007 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
11009 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11011 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
11012 expected_len, result);
11013 }
11014 if(uri) IUri_Release(uri);
11015
11016 /* a long url that causes a crash on Wine */
11018 longurl = heap_alloc((len+1)*sizeof(WCHAR));
11019 memcpy(longurl, http_urlW, sizeof(http_urlW));
11020 for(i = ARRAY_SIZE(http_urlW)-1; i < len; i++)
11021 longurl[i] = 'x';
11022 longurl[len] = 0;
11023
11024 copy = heap_alloc((len+1)*sizeof(WCHAR));
11025 memcpy(copy, longurl, (len+1)*sizeof(WCHAR));
11026
11027 hr = pCreateUri(longurl, 0, 0, &uri);
11028 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
11029 if(SUCCEEDED(hr)) {
11030 result = -1;
11031 memset(longurl, 0xcc, len*sizeof(WCHAR));
11032 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, longurl, len+1, &result, 0);
11033 ok(SUCCEEDED(hr), "Error: CoInternetParseIUri returned 0x%08x.\n", hr);
11034 ok(!lstrcmpW(longurl, copy), "Error: expected long url '%s' but was '%s'.\n",
11035 wine_dbgstr_w(copy), wine_dbgstr_w(longurl));
11036 ok(result == len, "Error: Expected 'result' to be %d, but was %d instead.\n",
11037 len, result);
11038 }
11039 heap_free(longurl);
11040 heap_free(copy);
11041 if(uri) IUri_Release(uri);
11042}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
#define E_FAIL
Definition: ddrawi.h:102
#define memset(x, y, z)
Definition: compat.h:39
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103

Referenced by START_TEST().

◆ test_CoInternetParseIUri_Pluggable()

static void test_CoInternetParseIUri_Pluggable ( void  )
static

Definition at line 11084 of file uri.c.

11084 {
11085 HRESULT hr;
11086 IUri *uri = NULL;
11087
11088 hr = pCreateUri(parse_urlW, 0, 0, &uri);
11089 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
11090 if(SUCCEEDED(hr)) {
11091 WCHAR result[200];
11092 DWORD result_len;
11093
11094 SET_EXPECT(ParseUrl);
11095
11096 parse_action = PARSE_CANONICALIZE;
11098
11099 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
11100 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
11101
11102 CHECK_CALLED(ParseUrl);
11103
11104 if(SUCCEEDED(hr)) {
11105 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
11106 lstrlenW(parse_resultW), result_len);
11107 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
11109 }
11110 }
11111 if(uri) IUri_Release(uri);
11112}
#define URL_ESCAPE_UNSAFE
Definition: shlwapi.h:1211
#define URL_UNESCAPE
Definition: shlwapi.h:1212

Referenced by START_TEST().

◆ test_CreateIUriBuilder()

static void test_CreateIUriBuilder ( void  )
static

Definition at line 8885 of file uri.c.

8885 {
8886 HRESULT hr;
8887 IUriBuilder *builder = NULL;
8888 IUri *uri;
8889
8890 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
8891 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8892 hr, E_POINTER);
8893
8894 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8895 hr = pCreateUri(http_urlW, 0, 0, &uri);
8896 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8897 if(SUCCEEDED(hr)) {
8898 ULONG cur_count, orig_count;
8899
8900 orig_count = get_refcnt(uri);
8901 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8902 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8903 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
8904
8905 cur_count = get_refcnt(uri);
8906 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
8907
8908 if(builder) IUriBuilder_Release(builder);
8909 cur_count = get_refcnt(uri);
8910 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
8911 }
8912 if(uri) IUri_Release(uri);
8913}
static ULONG get_refcnt(IUri *uri)
Definition: uri.c:7707
uint32_t ULONG
Definition: typedefs.h:59

Referenced by START_TEST().

◆ test_CreateUri_InvalidArgs()

static void test_CreateUri_InvalidArgs ( void  )
static

Definition at line 7800 of file uri.c.

7800 {
7801 HRESULT hr;
7802 IUri *uri = (void*) 0xdeadbeef;
7803
7804 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
7805 static const WCHAR emptyW[] = {0};
7806
7807 hr = pCreateUri(http_urlW, 0, 0, NULL);
7808 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7809
7810 hr = pCreateUri(NULL, 0, 0, &uri);
7811 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7812 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7813
7814 uri = (void*) 0xdeadbeef;
7815 hr = pCreateUri(invalidW, 0, 0, &uri);
7816 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7817 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7818
7819 uri = (void*) 0xdeadbeef;
7820 hr = pCreateUri(emptyW, 0, 0, &uri);
7821 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7822 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7823}
static const WCHAR emptyW[]
Definition: navigate.c:40
static const WCHAR invalidW[]
Definition: locale.c:46

Referenced by START_TEST().

◆ test_CreateUri_InvalidFlags()

static void test_CreateUri_InvalidFlags ( void  )
static

Definition at line 7786 of file uri.c.

7786 {
7787 DWORD i;
7788
7789 for(i = 0; i < ARRAY_SIZE(invalid_flag_tests); ++i) {
7790 HRESULT hr;
7791 IUri *uri = (void*) 0xdeadbeef;
7792
7793 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
7794 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
7796 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
7797 }
7798}
static const uri_create_flag_test invalid_flag_tests[]
Definition: uri.c:105

Referenced by START_TEST().

◆ test_CreateUri_InvalidUri()

static void test_CreateUri_InvalidUri ( void  )
static

Definition at line 7825 of file uri.c.

7825 {
7826 DWORD i;
7827
7828 for(i = 0; i < ARRAY_SIZE(invalid_uri_tests); ++i) {
7830 IUri *uri = NULL;
7831 LPWSTR uriW;
7832 HRESULT hr;
7833
7834 uriW = a2w(test.uri);
7835 hr = pCreateUri(uriW, test.flags, 0, &uri);
7836 todo_wine_if(test.todo)
7837 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7838 hr, E_INVALIDARG, i);
7839 if(uri) IUri_Release(uri);
7840
7841 heap_free(uriW);
7842 }
7843}
HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IUri **ppURI)
Definition: uri.c:5700
static const invalid_uri invalid_uri_tests[]
Definition: uri.c:5071

Referenced by START_TEST().

◆ test_CreateUriWithFragment()

static void test_CreateUriWithFragment ( void  )
static

Definition at line 8847 of file uri.c.

8847 {
8848 DWORD i;
8849
8850 for(i = 0; i < ARRAY_SIZE(uri_fragment_tests); ++i) {
8851 HRESULT hr;
8852 IUri *uri = NULL;
8853 LPWSTR uriW, fragW;
8855
8856 uriW = a2w(test.uri);
8857 fragW = a2w(test.fragment);
8858
8859 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
8860 todo_wine_if(test.expected_todo)
8861 ok(hr == test.create_expected,
8862 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8863 hr, test.create_expected, i);
8864
8865 if(SUCCEEDED(hr)) {
8866 BSTR received = NULL;
8867
8868 hr = IUri_GetAbsoluteUri(uri, &received);
8869 todo_wine_if(test.expected_todo) {
8870 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8871 hr, S_OK, i);
8872 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8873 test.expected_uri, wine_dbgstr_w(received), i);
8874 }
8875
8877 }
8878
8879 if(uri) IUri_Release(uri);
8880 heap_free(uriW);
8881 heap_free(fragW);
8882 }
8883}
HRESULT WINAPI CreateUriWithFragment(LPCWSTR pwzURI, LPCWSTR pwzFragment, DWORD dwFlags, DWORD_PTR dwReserved, IUri **ppURI)
Definition: uri.c:5795
static const uri_with_fragment uri_fragment_tests[]
Definition: uri.c:5285

Referenced by START_TEST().

◆ test_CreateUriWithFragment_InvalidArgs()

static void test_CreateUriWithFragment_InvalidArgs ( void  )
static

Definition at line 8813 of file uri.c.

8813 {
8814 HRESULT hr;
8815 IUri *uri = (void*) 0xdeadbeef;
8816 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
8817
8818 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
8819 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8820 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8821
8822 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
8823 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8824
8825 /* Original URI can't already contain a fragment component. */
8826 uri = (void*) 0xdeadbeef;
8827 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
8828 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8829 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8830}
static const WCHAR http_url_fragW[]
Definition: uri.c:84

Referenced by START_TEST().

◆ test_CreateUriWithFragment_InvalidFlags()

static void test_CreateUriWithFragment_InvalidFlags ( void  )
static

Definition at line 8833 of file uri.c.

8833 {
8834 DWORD i;
8835
8836 for(i = 0; i < ARRAY_SIZE(invalid_flag_tests); ++i) {
8837 HRESULT hr;
8838 IUri *uri = (void*) 0xdeadbeef;
8839
8840 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
8841 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8843 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8844 }
8845}

Referenced by START_TEST().

◆ test_CreateURLMoniker()

static void test_CreateURLMoniker ( void  )
static

Definition at line 11237 of file uri.c.

11238{
11240 IMoniker *mon, *base_mon;
11241 WCHAR *url, *base_url;
11242 IUri *uri, *base_uri;
11243 HRESULT hres;
11244
11246 url = a2w(test->url);
11247 base_url = a2w(test->base_url);
11248
11249 if(base_url) {
11250 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
11251 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11252
11253 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
11254 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11255 }else {
11256 base_uri = NULL;
11257 base_mon = NULL;
11258 }
11259
11260 hres = CreateURLMoniker(base_mon, url, &mon);
11261 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11262 test_urlmon_display_name(mon, test->legacy_url);
11263 test_display_uri(mon, test->legacy_url);
11264 IMoniker_Release(mon);
11265
11266 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
11267 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11268 test_urlmon_display_name(mon, test->legacy_url);
11269 test_display_uri(mon, test->legacy_url);
11270 IMoniker_Release(mon);
11271
11272 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
11273 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11274 test_urlmon_display_name(mon, test->uniform_url);
11275 test_display_uri(mon, test->uniform_url);
11276 IMoniker_Release(mon);
11277
11278 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
11279 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11280 test_urlmon_display_name(mon, test->no_canon_url);
11281 test_display_uri(mon, test->no_canon_url);
11282 IMoniker_Release(mon);
11283
11284 hres = pCreateUri(url, test->uri_flags, 0, &uri);
11285 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11286
11287 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
11288 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11289 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
11290 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
11291 IMoniker_Release(mon);
11292
11293 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
11294 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11295 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
11296 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
11297 IMoniker_Release(mon);
11298
11299 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
11300 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11301 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
11302 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
11303 IMoniker_Release(mon);
11304
11305 IUri_Release(uri);
11306 heap_free(url);
11308 if(base_uri)
11309 IUri_Release(base_uri);
11310 if(base_mon)
11311 IMoniker_Release(base_mon);
11312 }
11313}
static const WCHAR url[]
Definition: encode.c:1432
const char * base_url
Definition: mimeole.c:1466
#define test_urlmon_display_name(a, b)
Definition: uri.c:11198
#define test_display_uri(a, b)
Definition: uri.c:11212
static const create_urlmon_test_t create_urlmon_tests[]
Definition: uri.c:11125
HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
Definition: umon.c:732

Referenced by START_TEST(), and test_create().

◆ test_IPersistStream()

static void test_IPersistStream ( void  )
static

Definition at line 11330 of file uri.c.

11331{
11332 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
11333
11334 props_order[Uri_PROPERTY_RAW_URI] = 1;
11335 props_order[Uri_PROPERTY_FRAGMENT] = 2;
11336 props_order[Uri_PROPERTY_HOST] = 3;
11337 props_order[Uri_PROPERTY_PASSWORD] = 4;
11338 props_order[Uri_PROPERTY_PATH] = 5;
11339 props_order[Uri_PROPERTY_PORT] = 6;
11340 props_order[Uri_PROPERTY_QUERY] = 7;
11341 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
11342 props_order[Uri_PROPERTY_USER_NAME] = 9;
11343
11344 for(i = 0; i < ARRAY_SIZE(uri_tests); i++) {
11345 const uri_properties *test = uri_tests+i;
11346 LPWSTR uriW;
11347 IUri *uri;
11348 IPersistStream *persist_stream;
11349 IStream *stream;
11350 IMarshal *marshal;
11351 DWORD props, props_no, dw_data[6];
11352 WCHAR str_data[1024];
11354 LARGE_INTEGER no_off;
11355 CLSID curi;
11356 BSTR raw_uri;
11357 HRESULT hr;
11358
11359 if(test->create_todo || test->create_expected!=S_OK)
11360 continue;
11361
11362 uriW = a2w(test->uri);
11363 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
11364 ok(hr == S_OK, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i, hr);
11365
11366 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11367 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11368
11370 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x.\n", hr);
11371 hr = IPersistStream_IsDirty(persist_stream);
11372 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11373 hr = IPersistStream_Save(persist_stream, stream, FALSE);
11374 ok(hr == S_OK, "%d) Save failed 0x%08x, expected S_OK.\n", i, hr);
11375 hr = IPersistStream_IsDirty(persist_stream);
11376 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11377 no_off.QuadPart = 0;
11378 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11379 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11380 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11381 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11382 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
11383 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i, hr);
11384 ok(U(size).LowPart+2 == U(max_size).LowPart,
11385 "%d) Written data size is %d, max_size %d.\n",
11386 i, U(size).LowPart, U(max_size).LowPart);
11387
11388 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
11389 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11390 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11391 i, dw_data[0]-2, U(size).LowPart);
11392 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
11393 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11394 ok(dw_data[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[0]);
11395 ok(dw_data[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[1]);
11396 ok(dw_data[2] == add_default_flags(test->create_flags),
11397 "%d) Incorrect value %x, expected %x (creation flags).\n",
11398 i, dw_data[2], add_default_flags(test->create_flags));
11399 ok(dw_data[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[3]);
11400 ok(dw_data[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[4]);
11401 ok(dw_data[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[5]);
11402
11403 props_no = 0;
11404 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
11405 if(!props_order[props])
11406 continue;
11407
11408 if(props <= Uri_PROPERTY_STRING_LAST) {
11409 if(test->str_props[props].expected == S_OK)
11410 props_no++;
11411 } else {
11412 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
11413 props_no++;
11414 }
11415 }
11416 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
11417 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
11418 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
11419 props_no = 1;
11420
11421 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
11422 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11423 ok(props == props_no, "%d) Properties no is %d, expected %d.\n", i, props, props_no);
11424
11425 dw_data[2] = 0;
11426 dw_data[3] = -1;
11427 while(props) {
11428 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
11429 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11430 props--;
11431 ok(dw_data[2]<props_order[dw_data[0]],
11432 "%d) Incorrect properties order (%d, %d)\n",
11433 i, dw_data[0], dw_data[3]);
11434 dw_data[2] = props_order[dw_data[0]];
11435 dw_data[3] = dw_data[0];
11436
11437 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
11438 const uri_str_property *prop = test->str_props+dw_data[0];
11439 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
11440 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11441 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
11442 "%d) Expected %s but got %s (%d).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
11443 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
11444 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
11445 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %d (%d)\n", i, dw_data[1], dw_data[0]);
11446 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
11447 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11448 ok(prop->value == dw_data[1], "%d) Expected %d but got %d (%d).\n", i, prop->value, dw_data[1], dw_data[0]);
11449 } else {
11450 ok(FALSE, "%d) Incorrect property type (%d)\n", i, dw_data[0]);
11451 break;
11452 }
11453 }
11454 ok(props == 0, "%d) Not all properties were processed %d. Next property type: %d\n",
11455 i, props, dw_data[0]);
11456
11457 IUri_Release(uri);
11458
11459 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11460 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11461 hr = IPersistStream_GetClassID(persist_stream, &curi);
11462 ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
11463 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
11464 IPersistStream_Release(persist_stream);
11465
11466 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11467 &IID_IUri, (void**)&uri);
11468 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11469 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11470 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11471 hr = IPersistStream_Load(persist_stream, stream);
11472 ok(hr == S_OK, "%d) Load failed 0x%08x, expected S_OK.\n", i, hr);
11473 hr = IUri_GetRawUri(uri, &raw_uri);
11474 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11475 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11476 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11477 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11478 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11479 wine_dbgstr_w(raw_uri));
11480 SysFreeString(raw_uri);
11481 IPersistStream_Release(persist_stream);
11482
11483 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11484 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
11485 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11486 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11487 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11488 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
11489 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11490 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11491 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
11492 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11493 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11494 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
11495 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11496 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11497 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
11498 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11499 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11500 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
11501 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11502 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11503 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
11504 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11505 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11506 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
11507 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11508 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11509 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
11510 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i, hr);
11511 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
11512
11513 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11514 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11515 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11516 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11517 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
11518 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11519 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11520 i, dw_data[0]-2, U(size).LowPart);
11521 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
11522 i, dw_data[1]);
11523 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11524 i, dw_data[2], dw_data[0]-8);
11525 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
11526 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
11527 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
11528 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
11529 U(max_size).LowPart += 3*sizeof(DWORD);
11530 ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11531 i, dw_data[2], U(max_size).LowPart);
11532 IMarshal_Release(marshal);
11533 IUri_Release(uri);
11534
11535 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11536 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11537 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11538 &IID_IUri, (void**)&uri);
11539 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11540 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11541 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11542 IUri_Release(uri);
11543 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
11544 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11545 hr = IUri_GetRawUri(uri, &raw_uri);
11546 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11547 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11548 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11549 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11550 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11551 wine_dbgstr_w(raw_uri));
11552 SysFreeString(raw_uri);
11553
11554 IMarshal_Release(marshal);
11555 IStream_Release(stream);
11556 IUri_Release(uri);
11557 heap_free(uriW);
11558 }
11559}
#define U(x)
Definition: wordpad.c:45
static INT max_size
Definition: history.c:51
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
GLsizeiptr size
Definition: glext.h:5919
static const uri_properties uri_tests[]
Definition: uri.c:140
static int add_default_flags(DWORD flags)
Definition: uri.c:11315
#define DWORD
Definition: nt_native.h:44
const GUID IID_IPersistStream
Definition: proxy.cpp:13
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
@ URL_SCHEME_HTTPS
Definition: shlwapi.h:1157
@ URL_SCHEME_FTP
Definition: shlwapi.h:1147
@ URL_SCHEME_HTTP
Definition: shlwapi.h:1148
const char * value
Definition: uri.c:115
const char * broken_value
Definition: uri.c:118
char * value
Definition: compiler.c:67
Definition: parse.h:23
LONGLONG QuadPart
Definition: typedefs.h:114
static const WCHAR props[]
Definition: wbemdisp.c:288

Referenced by START_TEST().

◆ test_IUri_GetDwordProperties()

static void test_IUri_GetDwordProperties ( void  )
static

Definition at line 8237 of file uri.c.

8237 {
8238 IUri *uri = NULL;
8239 HRESULT hr;
8240 DWORD i;
8241
8242 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
8243 hr = pCreateUri(http_urlW, 0, 0, &uri);
8244 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8245 if(SUCCEEDED(hr)) {
8246 hr = IUri_GetHostType(uri, NULL);
8247 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8248
8249 hr = IUri_GetPort(uri, NULL);
8250 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8251
8252 hr = IUri_GetScheme(uri, NULL);
8253 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8254
8255 hr = IUri_GetZone(uri, NULL);
8256 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8257 }
8258 if(uri) IUri_Release(uri);
8259
8260 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8262 LPWSTR uriW;
8263 uri = NULL;
8264
8265 uriW = a2w(test.uri);
8266 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8267 todo_wine_if(test.create_todo)
8268 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8269 hr, test.create_expected, i);
8270
8271 if(SUCCEEDED(hr)) {
8272 uri_dword_property prop;
8274
8275 /* Assign an insane value so tests don't accidentally pass when
8276 * they shouldn't!
8277 */
8278 received = -9999999;
8279
8280 /* GetHostType() tests. */
8281 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
8282 hr = IUri_GetHostType(uri, &received);
8283 todo_wine_if(prop.todo) {
8284 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8285 hr, prop.expected, i);
8286 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8287 }
8288 received = -9999999;
8289
8290 /* GetPort() tests. */
8291 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
8292 hr = IUri_GetPort(uri, &received);
8293 todo_wine_if(prop.todo) {
8294 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8295 hr, prop.expected, i);
8296 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8297 }
8298 received = -9999999;
8299
8300 /* GetScheme() tests. */
8301 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
8302 hr = IUri_GetScheme(uri, &received);
8303 todo_wine_if(prop.todo) {
8304 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8305 hr, prop.expected, i);
8306 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8307 }
8308 received = -9999999;
8309
8310 /* GetZone() tests. */
8311 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
8312 hr = IUri_GetZone(uri, &received);
8313 todo_wine_if(prop.todo) {
8314 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8315 hr, prop.expected, i);
8316 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8317 }
8318 }
8319
8320 if(uri) IUri_Release(uri);
8321
8322 heap_free(uriW);
8323 }
8324}

Referenced by START_TEST().

◆ test_IUri_GetProperties()

static void test_IUri_GetProperties ( void  )
static

Definition at line 8417 of file uri.c.

8417 {
8418 IUri *uri = NULL;
8419 HRESULT hr;
8420 DWORD i;
8421
8422 hr = pCreateUri(http_urlW, 0, 0, &uri);
8423 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8424 if(SUCCEEDED(hr)) {
8425 hr = IUri_GetProperties(uri, NULL);
8426 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8427 }
8428 if(uri) IUri_Release(uri);
8429
8430 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8432 LPWSTR uriW;
8433 uri = NULL;
8434
8435 uriW = a2w(test.uri);
8436 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8437 todo_wine_if(test.create_todo)
8438 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8439
8440 if(SUCCEEDED(hr)) {
8441 DWORD received = 0, expected_props, mask;
8442 DWORD j;
8443
8444 hr = IUri_GetProperties(uri, &received);
8445 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8446
8447 expected_props = compute_expected_props(&test, &mask);
8448
8449 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8450 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8451 if(mask & (1 << j)) {
8452 if(expected_props & (1 << j))
8453 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
8454 else
8455 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
8456 }
8457 }
8458 }
8459
8460 if(uri) IUri_Release(uri);
8461
8462 heap_free(uriW);
8463 }
8464}
static DWORD compute_expected_props(uri_properties *test, DWORD *mask)
Definition: uri.c:8393

Referenced by START_TEST().

◆ test_IUri_GetPropertyBSTR()

static void test_IUri_GetPropertyBSTR ( void  )
static

Definition at line 7845 of file uri.c.

7845 {
7846 IUri *uri = NULL;
7847 HRESULT hr;
7848 DWORD i;
7849
7850 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7851 hr = pCreateUri(http_urlW, 0, 0, &uri);
7852 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7853 if(SUCCEEDED(hr)) {
7854 BSTR received = NULL;
7855
7856 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
7857 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7858
7859 /* Make sure it handles an invalid Uri_PROPERTY correctly. */
7860 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
7861 ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08x, expected E_INVALIDARG or S_OK.\n", hr);
7862 if(SUCCEEDED(hr)) {
7863 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7864 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7866 }else {
7867 ok(!received, "received = %s\n", wine_dbgstr_w(received));
7868 }
7869
7870 /* Make sure it handles the ZONE property correctly. */
7871 received = NULL;
7872 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
7873 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
7874 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7875 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7877 }
7878 if(uri) IUri_Release(uri);
7879
7880 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
7882 LPWSTR uriW;
7883 uri = NULL;
7884
7885 uriW = a2w(test.uri);
7886 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7887 todo_wine_if(test.create_todo)
7888 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7889 hr, test.create_expected, i);
7890
7891 if(SUCCEEDED(hr)) {
7892 DWORD j;
7893
7894 /* Checks all the string properties of the uri. */
7895 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7896 BSTR received = NULL;
7897 uri_str_property prop = test.str_props[j];
7898
7899 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
7900 todo_wine_if(prop.todo) {
7901 ok(hr == prop.expected ||
7902 (prop.value2 && hr == prop.expected2),
7903 "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7904 hr, prop.expected, i, j);
7905 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)) ||
7907 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7908 prop.value, wine_dbgstr_w(received), i, j);
7909 }
7910
7912 }
7913 }
7914
7915 if(uri) IUri_Release(uri);
7916
7917 heap_free(uriW);
7918 }
7919}
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
@ Failed
Definition: arc.h:79
HRESULT expected2
Definition: uri.c:120
const char * value2
Definition: uri.c:119
HRESULT expected
Definition: uri.c:116

Referenced by START_TEST().

◆ test_IUri_GetPropertyDWORD()

static void test_IUri_GetPropertyDWORD ( void  )
static

Definition at line 7921 of file uri.c.

7921 {
7922 IUri *uri = NULL;
7923 HRESULT hr;
7924 DWORD i;
7925
7926 hr = pCreateUri(http_urlW, 0, 0, &uri);
7927 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7928 if(SUCCEEDED(hr)) {
7929 DWORD received = 0xdeadbeef;
7930
7931 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
7932 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7933
7934 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
7935 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7936 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
7937 }
7938 if(uri) IUri_Release(uri);
7939
7940 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
7942 LPWSTR uriW;
7943 uri = NULL;
7944
7945 uriW = a2w(test.uri);
7946 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7947 todo_wine_if(test.create_todo)
7948 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7949 hr, test.create_expected, i);
7950
7951 if(SUCCEEDED(hr)) {
7952 DWORD j;
7953
7954 /* Checks all the DWORD properties of the uri. */
7955 for(j = 0; j < ARRAY_SIZE(test.dword_props); ++j) {
7957 uri_dword_property prop = test.dword_props[j];
7958
7959 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
7960 todo_wine_if(prop.todo) {
7961 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7962 hr, prop.expected, i, j);
7963 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7964 prop.value, received, i, j);
7965 }
7966 }
7967 }
7968
7969 if(uri) IUri_Release(uri);
7970
7971 heap_free(uriW);
7972 }
7973}

Referenced by START_TEST().

◆ test_IUri_GetPropertyLength()

static void test_IUri_GetPropertyLength ( void  )
static

Definition at line 8326 of file uri.c.

8326 {
8327 IUri *uri = NULL;
8328 HRESULT hr;
8329 DWORD i;
8330
8331 /* Make sure it handles invalid args correctly. */
8332 hr = pCreateUri(http_urlW, 0, 0, &uri);
8333 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8334 if(SUCCEEDED(hr)) {
8335 DWORD received = 0xdeadbeef;
8336
8337 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
8338 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8339
8340 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
8341 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8342 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
8343 }
8344 if(uri) IUri_Release(uri);
8345
8346 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8348 LPWSTR uriW;
8349 uri = NULL;
8350
8351 uriW = a2w(test.uri);
8352 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8353 todo_wine_if(test.create_todo)
8354 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
8355 hr, test.create_expected, i);
8356
8357 if(SUCCEEDED(hr)) {
8358 DWORD j;
8359
8360 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
8361 DWORD expectedLen, receivedLen;
8362 uri_str_property prop = test.str_props[j];
8363 LPWSTR expectedValueW;
8364
8365 expectedLen = lstrlenA(prop.value);
8366 /* Value may be unicode encoded */
8367 expectedValueW = a2w(prop.value);
8368 expectedLen = lstrlenW(expectedValueW);
8369 heap_free(expectedValueW);
8370
8371 /* This won't be necessary once GetPropertyLength is implemented. */
8372 receivedLen = -1;
8373
8374 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
8375 todo_wine_if(prop.todo) {
8376 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
8377 "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8378 hr, prop.expected, i, j);
8379 ok(receivedLen == expectedLen || (prop.value2 && receivedLen == lstrlenA(prop.value2)) ||
8380 broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8381 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8382 expectedLen, receivedLen, i, j);
8383 }
8384 }
8385 }
8386
8387 if(uri) IUri_Release(uri);
8388
8389 heap_free(uriW);
8390 }
8391}

Referenced by START_TEST().

◆ test_IUri_GetStrProperties()

static void test_IUri_GetStrProperties ( void  )
static

Definition at line 7976 of file uri.c.

7976 {
7977 IUri *uri = NULL;
7978 HRESULT hr;
7979 DWORD i;
7980
7981 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7982 hr = pCreateUri(http_urlW, 0, 0, &uri);
7983 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7984 if(SUCCEEDED(hr)) {
7985 hr = IUri_GetAbsoluteUri(uri, NULL);
7986 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7987
7988 hr = IUri_GetAuthority(uri, NULL);
7989 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7990
7991 hr = IUri_GetDisplayUri(uri, NULL);
7992 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7993
7994 hr = IUri_GetDomain(uri, NULL);
7995 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7996
7997 hr = IUri_GetExtension(uri, NULL);
7998 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7999
8000 hr = IUri_GetFragment(uri, NULL);
8001 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8002
8003 hr = IUri_GetHost(uri, NULL);
8004 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8005
8006 hr = IUri_GetPassword(uri, NULL);
8007 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8008
8009 hr = IUri_GetPath(uri, NULL);
8010 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8011
8012 hr = IUri_GetPathAndQuery(uri, NULL);
8013 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8014
8015 hr = IUri_GetQuery(uri, NULL);
8016 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8017
8018 hr = IUri_GetRawUri(uri, NULL);
8019 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8020
8021 hr = IUri_GetSchemeName(uri, NULL);
8022 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8023
8024 hr = IUri_GetUserInfo(uri, NULL);
8025 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8026
8027 hr = IUri_GetUserName(uri, NULL);
8028 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8029 }
8030 if(uri) IUri_Release(uri);
8031
8032 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8034 LPWSTR uriW;
8035 uri = NULL;
8036
8037 uriW = a2w(test.uri);
8038 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8039 todo_wine_if(test.create_todo)
8040 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8041 hr, test.create_expected, i);
8042
8043 if(SUCCEEDED(hr)) {
8044 uri_str_property prop;
8045 BSTR received = NULL;
8046
8047 /* GetAbsoluteUri() tests. */
8048 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
8049 hr = IUri_GetAbsoluteUri(uri, &received);
8050 todo_wine_if(prop.todo) {
8051 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8052 hr, prop.expected, i);
8054 "Error: Expected %s but got %s on uri_tests[%d].\n",
8055 prop.value, wine_dbgstr_w(received), i);
8056 }
8058 received = NULL;
8059
8060 /* GetAuthority() tests. */
8061 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
8062 hr = IUri_GetAuthority(uri, &received);
8063 todo_wine_if(prop.todo) {
8064 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8065 hr, prop.expected, i);
8066 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8067 prop.value, wine_dbgstr_w(received), i);
8068 }
8070 received = NULL;
8071
8072 /* GetDisplayUri() tests. */
8073 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
8074 hr = IUri_GetDisplayUri(uri, &received);
8075 todo_wine_if(prop.todo) {
8076 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8077 hr, prop.expected, i);
8079 "Error: Expected %s but got %s on uri_tests[%d].\n",
8080 prop.value, wine_dbgstr_w(received), i);
8081 }
8083 received = NULL;
8084
8085 /* GetDomain() tests. */
8086 prop = test.str_props[Uri_PROPERTY_DOMAIN];
8087 hr = IUri_GetDomain(uri, &received);
8088 todo_wine_if(prop.todo) {
8089 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
8090 "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8091 hr, prop.expected, i);
8092 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)),
8093 "Error: Expected %s but got %s on uri_tests[%d].\n",
8094 prop.value, wine_dbgstr_w(received), i);
8095 }
8097 received = NULL;
8098
8099 /* GetExtension() tests. */
8100 prop = test.str_props[Uri_PROPERTY_EXTENSION];
8101 hr = IUri_GetExtension(uri, &received);
8102 todo_wine_if(prop.todo) {
8103 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8104 hr, prop.expected, i);
8105 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8106 prop.value, wine_dbgstr_w(received), i);
8107 }
8109 received = NULL;
8110
8111 /* GetFragment() tests. */
8112 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
8113 hr = IUri_GetFragment(uri, &received);
8114 todo_wine_if(prop.todo) {
8115 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8116 hr, prop.expected, i);
8117 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8118 prop.value, wine_dbgstr_w(received), i);
8119 }
8121 received = NULL;
8122
8123 /* GetHost() tests. */
8124 prop = test.str_props[Uri_PROPERTY_HOST];
8125 hr = IUri_GetHost(uri, &received);
8126 todo_wine_if(prop.todo) {
8127 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8128 hr, prop.expected, i);
8129 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8130 prop.value, wine_dbgstr_w(received), i);
8131 }
8133 received = NULL;
8134
8135 /* GetPassword() tests. */
8136 prop = test.str_props[Uri_PROPERTY_PASSWORD];
8137 hr = IUri_GetPassword(uri, &received);
8138 todo_wine_if(prop.todo) {
8139 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8140 hr, prop.expected, i);
8141 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8142 prop.value, wine_dbgstr_w(received), i);
8143 }
8145 received = NULL;
8146
8147 /* GetPath() tests. */
8148 prop = test.str_props[Uri_PROPERTY_PATH];
8149 hr = IUri_GetPath(uri, &received);
8150 todo_wine_if(prop.todo) {
8151 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8152 hr, prop.expected, i);
8153 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8154 prop.value, wine_dbgstr_w(received), i);
8155 }
8157 received = NULL;
8158
8159 /* GetPathAndQuery() tests. */
8160 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
8161 hr = IUri_GetPathAndQuery(uri, &received);
8162 todo_wine_if(prop.todo) {
8163 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8164 hr, prop.expected, i);
8165 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8166 prop.value, wine_dbgstr_w(received), i);
8167 }
8169 received = NULL;
8170
8171 /* GetQuery() tests. */
8172 prop = test.str_props[Uri_PROPERTY_QUERY];
8173 hr = IUri_GetQuery(uri, &received);
8174 todo_wine_if(prop.todo) {
8175 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8176 hr, prop.expected, i);
8177 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8178 prop.value, wine_dbgstr_w(received), i);
8179 }
8181 received = NULL;
8182
8183 /* GetRawUri() tests. */
8184 prop = test.str_props[Uri_PROPERTY_RAW_URI];
8185 hr = IUri_GetRawUri(uri, &received);
8186 todo_wine_if(prop.todo) {
8187 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8188 hr, prop.expected, i);
8189 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8190 prop.value, wine_dbgstr_w(received), i);
8191 }
8193 received = NULL;
8194
8195 /* GetSchemeName() tests. */
8196 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
8197 hr = IUri_GetSchemeName(uri, &received);
8198 todo_wine_if(prop.todo) {
8199 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8200 hr, prop.expected, i);
8201 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8202 prop.value, wine_dbgstr_w(received), i);
8203 }
8205 received = NULL;
8206
8207 /* GetUserInfo() tests. */
8208 prop = test.str_props[Uri_PROPERTY_USER_INFO];
8209 hr = IUri_GetUserInfo(uri, &received);
8210 todo_wine_if(prop.todo) {
8211 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8212 hr, prop.expected, i);
8213 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8214 prop.value, wine_dbgstr_w(received), i);
8215 }
8217 received = NULL;
8218
8219 /* GetUserName() tests. */
8220 prop = test.str_props[Uri_PROPERTY_USER_NAME];
8221 hr = IUri_GetUserName(uri, &received);
8222 todo_wine_if(prop.todo) {
8223 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8224 hr, prop.expected, i);
8225 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8226 prop.value, wine_dbgstr_w(received), i);
8227 }
8229 }
8230
8231 if(uri) IUri_Release(uri);
8232
8233 heap_free(uriW);
8234 }
8235}

Referenced by START_TEST().

◆ test_IUri_HasProperty()

static void test_IUri_HasProperty ( void  )
static

Definition at line 8466 of file uri.c.

8466 {
8467 IUri *uri = NULL;
8468 HRESULT hr;
8469 DWORD i;
8470
8471 hr = pCreateUri(http_urlW, 0, 0, &uri);
8472 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8473 if(SUCCEEDED(hr)) {
8474 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
8475 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8476 }
8477 if(uri) IUri_Release(uri);
8478
8479 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8481 LPWSTR uriW;
8482 uri = NULL;
8483
8484 uriW = a2w(test.uri);
8485
8486 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8487 todo_wine_if(test.create_todo)
8488 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8489
8490 if(SUCCEEDED(hr)) {
8491 DWORD expected_props, j, mask;
8492
8493 expected_props = compute_expected_props(&test, &mask);
8494
8495 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8496 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8497 BOOL received = -1;
8498
8499 hr = IUri_HasProperty(uri, j, &received);
8500 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
8501 hr, S_OK, j, i);
8502
8503 if(mask & (1 << j)) {
8504 if(expected_props & (1 << j)) {
8505 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
8506 } else {
8507 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
8508 }
8509 }
8510 }
8511 }
8512
8513 if(uri) IUri_Release(uri);
8514
8515 heap_free(uriW);
8516 }
8517}
unsigned int BOOL
Definition: ntddk_ex.h:94

Referenced by START_TEST().

◆ test_IUri_IsEqual()

static void test_IUri_IsEqual ( void  )
static

Definition at line 8736 of file uri.c.

8736 {
8737 struct custom_uri custom_uri;
8738 IUri *uriA, *uriB;
8739 BOOL equal;
8740 HRESULT hres;
8741 DWORD i;
8742
8743 uriA = uriB = NULL;
8744
8745 /* Make sure IsEqual handles invalid args correctly. */
8746 hres = pCreateUri(http_urlW, 0, 0, &uriA);
8747 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8748 hres = pCreateUri(http_urlW, 0, 0, &uriB);
8749 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8750
8751 equal = -1;
8752 hres = IUri_IsEqual(uriA, NULL, &equal);
8753 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8754 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
8755
8756 hres = IUri_IsEqual(uriA, uriB, NULL);
8757 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
8758
8759 equal = FALSE;
8760 hres = IUri_IsEqual(uriA, uriA, &equal);
8761 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8762 ok(equal, "Error: Expected equal URIs.\n");
8763
8764 equal = FALSE;
8765 hres = IUri_IsEqual(uriA, uriB, &equal);
8766 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8767 ok(equal, "Error: Expected equal URIs.\n");
8768
8769 IUri_Release(uriA);
8770 IUri_Release(uriB);
8771
8773
8774 for(i = 0; i < ARRAY_SIZE(equality_tests); ++i) {
8776 LPWSTR uriA_W, uriB_W;
8777
8778 uriA = uriB = NULL;
8779
8780 uriA_W = a2w(test.a);
8781 uriB_W = a2w(test.b);
8782
8783 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
8784 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
8785
8786 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
8787 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
8788
8789 equal = -1;
8790 hres = IUri_IsEqual(uriA, uriB, &equal);
8791 todo_wine_if(test.todo) {
8792 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8793 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8794 }
8795
8796 custom_uri.uri = uriB;
8797
8798 equal = -1;
8799 hres = IUri_IsEqual(uriA, &custom_uri.IUri_iface, &equal);
8800 todo_wine {
8801 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8802 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8803 }
8804
8805 if(uriA) IUri_Release(uriA);
8806 if(uriB) IUri_Release(uriB);
8807
8808 heap_free(uriA_W);
8809 heap_free(uriB_W);
8810 }
8811}
#define todo_wine
Definition: custom.c:79
static const uri_equality equality_tests[]
Definition: uri.c:5143
static const IUriVtbl custom_uri_vtbl
Definition: uri.c:8704
#define equal(x, y)
Definition: reader.cc:56
IUri IUri_iface
Definition: uri.c:8520
IUri * uri
Definition: uri.c:8521

Referenced by START_TEST().

◆ test_IUriBuilder()

static void test_IUriBuilder ( void  )
static

Definition at line 10019 of file uri.c.

10019 {
10020 HRESULT hr;
10021 IUriBuilder *builder;
10022 DWORD i;
10023
10024 for(i = 0; i < ARRAY_SIZE(uri_builder_tests); ++i) {
10025 IUri *uri = NULL;
10027 LPWSTR uriW = NULL;
10028
10029 if(test.uri) {
10030 uriW = a2w(test.uri);
10031 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10032 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10033 hr, S_OK, i);
10034 if(FAILED(hr)) continue;
10035 }
10036 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10037 todo_wine_if(test.create_builder_todo)
10038 ok(hr == test.create_builder_expected,
10039 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10040 hr, test.create_builder_expected, i);
10041 if(SUCCEEDED(hr)) {
10042 DWORD j;
10043 BOOL modified = FALSE, received = FALSE;
10044
10045 /* Perform all the string property changes. */
10046 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
10047 uri_builder_property prop = test.properties[j];
10048 if(prop.change) {
10049 change_property(builder, &prop, i);
10050 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
10051 prop.property != Uri_PROPERTY_HOST)
10052 modified = TRUE;
10053 else if(prop.value && *prop.value)
10054 modified = TRUE;
10055 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
10056 /* Host name property can't be NULL, but it can be empty. */
10057 modified = TRUE;
10058 }
10059 }
10060
10061 if(test.port_prop.change) {
10062 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
10063 modified = TRUE;
10064 todo_wine_if(test.port_prop.todo)
10065 ok(hr == test.port_prop.expected,
10066 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10067 hr, test.port_prop.expected, i);
10068 }
10069
10070 hr = IUriBuilder_HasBeenModified(builder, &received);
10071 ok(hr == S_OK,
10072 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10073 hr, S_OK, i);
10074 if(SUCCEEDED(hr))
10075 ok(received == modified,
10076 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
10077 modified, received, i);
10078
10079 /* Test the "Get*" functions. */
10081 test_IUriBuilder_GetHost(builder, &test, i);
10083 test_IUriBuilder_GetPath(builder, &test, i);
10084 test_IUriBuilder_GetPort(builder, &test, i);
10085 test_IUriBuilder_GetQuery(builder, &test, i);
10088
10089 test_IUriBuilder_CreateUri(builder, &test, i);
10092 }
10093 if(builder) IUriBuilder_Release(builder);
10094 if(uri) IUri_Release(uri);
10095 heap_free(uriW);
10096 }
10097}
BOOLEAN Expected
HRESULT WINAPI CreateIUriBuilder(IUri *pIUri, DWORD dwFlags, DWORD_PTR dwReserved, IUriBuilder **ppIUriBuilder)
Definition: uri.c:6353
#define URI_BUILDER_STR_PROPERTY_COUNT
Definition: uri.c:42
static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9019
static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:8915
static void change_property(IUriBuilder *builder, const uri_builder_property *prop, DWORD test_index)
Definition: uri.c:7712
static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9923
static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9666
static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9381
static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9476
static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9571
static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9733
static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9828
static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9286
static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:8967
static const uri_builder_test uri_builder_tests[]
Definition: uri.c:5362

Referenced by START_TEST().

◆ test_IUriBuilder_CreateInvalidArgs()

static void test_IUriBuilder_CreateInvalidArgs ( void  )
static

Definition at line 9072 of file uri.c.

9072 {
9073 IUriBuilder *builder;
9074 HRESULT hr;
9075
9076 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9077 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9078 if(SUCCEEDED(hr)) {
9079 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
9080
9081 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
9082 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
9083 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
9084
9085 uri = (void*) 0xdeadbeef;
9086 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9087 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
9088 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
9089
9090 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
9091 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9092 hr, E_POINTER);
9093
9094 uri = (void*) 0xdeadbeef;
9095 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9096 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9097 hr, E_NOTIMPL);
9098 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
9099
9100 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
9101 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9102 hr, E_POINTER);
9103
9104 uri = (void*) 0xdeadbeef;
9105 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
9106 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9107 hr, E_NOTIMPL);
9108 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9109
9110 hr = pCreateUri(http_urlW, 0, 0, &test);
9111 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9112 if(SUCCEEDED(hr)) {
9113 hr = IUriBuilder_SetIUri(builder, test);
9114 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9115
9116 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
9117 uri = NULL;
9118 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9119 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9120 ok(uri != NULL, "Error: The uri was NULL.\n");
9121 if(uri) IUri_Release(uri);
9122
9123 uri = NULL;
9124 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9125 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9126 hr, S_OK);
9127 ok(uri != NULL, "Error: uri was NULL.\n");
9128 if(uri) IUri_Release(uri);
9129
9130 uri = NULL;
9131 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
9132 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9133 hr, S_OK);
9134 ok(uri != NULL, "Error: uri was NULL.\n");
9135 if(uri) IUri_Release(uri);
9136
9137 hr = IUriBuilder_SetFragment(builder, NULL);
9138 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9139
9140 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
9141 uri = (void*) 0xdeadbeef;
9142 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9143 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9144 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
9145
9146 uri = (void*) 0xdeadbeef;
9147 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9148 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9149 hr, S_OK);
9150 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9151
9152 uri = (void*) 0xdeadbeef;
9153 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
9154 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9155 hr, E_NOTIMPL);
9156 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9157 }
9158 if(test) IUri_Release(test);
9159 }
9160 if(builder) IUriBuilder_Release(builder);
9161}

Referenced by START_TEST().

◆ test_IUriBuilder_CreateUri()

static void test_IUriBuilder_CreateUri ( IUriBuilder builder,
const uri_builder_test test,
DWORD  test_index 
)
static

Definition at line 8915 of file uri.c.

8916 {
8917 HRESULT hr;
8918 IUri *uri = NULL;
8919
8920 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
8921 todo_wine_if(test->uri_todo)
8922 ok(hr == test->uri_hres,
8923 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8924 hr, test->uri_hres, test_index);
8925
8926 if(SUCCEEDED(hr)) {
8927 DWORD i;
8928
8929 for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) {
8930 uri_builder_str_property prop = test->expected_str_props[i];
8931 BSTR received = NULL;
8932
8933 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8934 todo_wine_if(prop.todo)
8935 ok(hr == prop.result,
8936 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8937 hr, prop.result, test_index, i);
8938 if(SUCCEEDED(hr)) {
8939 todo_wine_if(prop.todo)
8940 ok(!strcmp_aw(prop.expected, received),
8941 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8942 prop.expected, wine_dbgstr_w(received), test_index, i);
8943 }
8945 }
8946
8947 for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) {
8948 uri_builder_dword_property prop = test->expected_dword_props[i];
8949 DWORD received = -2;
8950
8951 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8952 todo_wine_if(prop.todo)
8953 ok(hr == prop.result,
8954 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8955 hr, prop.result, test_index, i);
8956 if(SUCCEEDED(hr)) {
8957 todo_wine_if(prop.todo)
8958 ok(received == prop.expected,
8959 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8960 prop.expected, received, test_index, i);
8961 }
8962 }
8963 }
8964 if(uri) IUri_Release(uri);
8965}
GLdouble s
Definition: gl.h:2039
#define for
Definition: utility.h:88

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_CreateUriSimple()

static void test_IUriBuilder_CreateUriSimple ( IUriBuilder builder,
const uri_builder_test test,
DWORD  test_index 
)
static

Definition at line 8967 of file uri.c.

8968 {
8969 HRESULT hr;
8970 IUri *uri = NULL;
8971
8972 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
8973 todo_wine_if(test->uri_simple_todo)
8974 ok(hr == test->uri_simple_hres,
8975 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8976 hr, test->uri_simple_hres, test_index);
8977
8978 if(SUCCEEDED(hr)) {
8979 DWORD i;
8980
8981 for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) {
8982 uri_builder_str_property prop = test->expected_str_props[i];
8983 BSTR received = NULL;
8984
8985 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8986 todo_wine_if(prop.todo)
8987 ok(hr == prop.result,
8988 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8989 hr, prop.result, test_index, i);
8990 if(SUCCEEDED(hr)) {
8991 todo_wine_if(prop.todo)
8992 ok(!strcmp_aw(prop.expected, received),
8993 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8994 prop.expected, wine_dbgstr_w(received), test_index, i);
8995 }
8997 }
8998
8999 for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) {
9000 uri_builder_dword_property prop = test->expected_dword_props[i];
9001 DWORD received = -2;
9002
9003 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
9004 todo_wine_if(prop.todo)
9005 ok(hr == prop.result,
9006 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
9007 hr, prop.result, test_index, i);
9008 if(SUCCEEDED(hr)) {
9009 todo_wine_if(prop.todo)
9010 ok(received == prop.expected,
9011 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
9012 prop.expected, received, test_index, i);
9013 }
9014 }
9015 }
9016 if(uri) IUri_Release(uri);
9017}

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_CreateUriWithFlags()

static void test_IUriBuilder_CreateUriWithFlags ( IUriBuilder builder,
const uri_builder_test test,
DWORD  test_index 
)
static

Definition at line 9019 of file uri.c.

9020 {
9021 HRESULT hr;
9022 IUri *uri = NULL;
9023
9024 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
9025 test->uri_with_encode_flags, 0, &uri);
9026 todo_wine_if(test->uri_with_todo)
9027 ok(hr == test->uri_with_hres,
9028 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9029 hr, test->uri_with_hres, test_index);
9030
9031 if(SUCCEEDED(hr)) {
9032 DWORD i;
9033
9034 for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) {
9035 uri_builder_str_property prop = test->expected_str_props[i];
9036 BSTR received = NULL;
9037
9038 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
9039 todo_wine_if(prop.todo)
9040 ok(hr == prop.result,
9041 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
9042 hr, prop.result, test_index, i);
9043 if(SUCCEEDED(hr)) {
9044 todo_wine_if(prop.todo)
9045 ok(!strcmp_aw(prop.expected, received),
9046 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
9047 prop.expected, wine_dbgstr_w(received), test_index, i);
9048 }
9050 }
9051
9052 for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) {
9053 uri_builder_dword_property prop = test->expected_dword_props[i];
9054 DWORD received = -2;
9055
9056 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
9057 todo_wine_if(prop.todo)
9058 ok(hr == prop.result,
9059 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
9060 hr, prop.result, test_index, i);
9061 if(SUCCEEDED(hr)) {
9062 todo_wine_if(prop.todo)
9063 ok(received == prop.expected,
9064 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
9065 prop.expected, received, test_index, i);
9066 }
9067 }
9068 }
9069 if(uri) IUri_Release(uri);
9070}

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_GetFragment()

static void test_IUriBuilder_GetFragment ( IUriBuilder builder,
const uri_builder_test test,
DWORD  test_index 
)
static

Definition at line 9286 of file uri.c.

9287 {
9288 HRESULT hr;
9289 DWORD i;
9291 DWORD len = -1;
9292 const uri_builder_property *prop = NULL;
9293
9294 /* Check if the property was set earlier. */
9295 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9296 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
9297 prop = &(test->properties[i]);
9298 }
9299
9300 if(prop) {
9301 /* Use expected_value unless it's NULL, then use value. */
9302 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9303 DWORD expected_len = expected ? strlen(expected) : 0;
9304 hr = IUriBuilder_GetFragment(builder, &len, &received);
9305 todo_wine_if(prop->todo) {
9306 ok(hr == (expected ? S_OK : S_FALSE),
9307 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9308 hr, (expected ? S_OK : S_FALSE), test_index);
9309 if(SUCCEEDED(hr)) {
9310 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9311 expected, wine_dbgstr_w(received), test_index);
9312 ok(expected_len == len,
9313 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9314 expected_len, len, test_index);
9315 }
9316 }
9317 } else {
9318 /* The property wasn't set earlier, so it should return whatever
9319 * the base IUri contains (if anything).
9320 */
9321 IUri *uri = NULL;
9322 hr = IUriBuilder_GetIUri(builder, &uri);
9323 ok(hr == S_OK,
9324 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9325 hr, S_OK, test_index);
9326 if(SUCCEEDED(hr)) {
9327 if(!uri) {
9328 received = (void*) 0xdeadbeef;
9329 len = -1;
9330
9331 hr = IUriBuilder_GetFragment(builder, &len, &received);
9332 ok(hr == S_FALSE,
9333 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9334 hr, S_FALSE, test_index);
9335 if(SUCCEEDED(hr)) {
9336 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9337 len, test_index);
9338 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9339 received, test_index);
9340 }
9341 } else {
9342 BOOL has_prop = FALSE;
9343 BSTR expected = NULL;
9344
9345 hr = IUri_GetFragment(uri, &expected);
9346 ok(SUCCEEDED(hr),
9347 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9348 hr, test_index);
9349 has_prop = hr == S_OK;
9350
9351 hr = IUriBuilder_GetFragment(builder, &len, &received);
9352 if(has_prop) {
9353 ok(hr == S_OK,
9354 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9355 hr, S_OK, test_index);
9356 if(SUCCEEDED(hr)) {
9358 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9360 ok(lstrlenW(expected) == len,
9361 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9362 lstrlenW(expected), len, test_index);
9363 }
9364 } else {
9365 ok(hr == S_FALSE,
9366 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9367 hr, S_FALSE, test_index);
9368 if(SUCCEEDED(hr)) {
9369 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9370 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9371 len, test_index);
9372 }
9373 }
9375 }
9376 }
9377 if(uri) IUri_Release(uri);
9378 }
9379}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
const char * expected_value
Definition: uri.c:5308
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_GetHost()

static void test_IUriBuilder_GetHost ( IUriBuilder builder,
const uri_builder_test test,
DWORD  test_index 
)
static

Definition at line 9381 of file uri.c.

9382 {
9383 HRESULT hr;
9384 DWORD i;
9386 DWORD len = -1;
9387 const uri_builder_property *prop = NULL;
9388
9389 /* Check if the property was set earlier. */
9390 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9391 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
9392 prop = &(test->properties[i]);
9393 }
9394
9395 if(prop) {
9396 /* Use expected_value unless it's NULL, then use value. */
9397 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9398 DWORD expected_len = expected ? strlen(expected) : 0;
9399 hr = IUriBuilder_GetHost(builder, &len, &received);
9400 todo_wine_if(prop->todo) {
9401 ok(hr == (expected ? S_OK : S_FALSE),
9402 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9403 hr, (expected ? S_OK : S_FALSE), test_index);
9404 if(SUCCEEDED(hr)) {
9405 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9406 expected, wine_dbgstr_w(received), test_index);
9407 ok(expected_len == len,
9408 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9409 expected_len, len, test_index);
9410 }
9411 }
9412 } else {
9413 /* The property wasn't set earlier, so it should return whatever
9414 * the base IUri contains (if anything).
9415 */
9416 IUri *uri = NULL;
9417 hr = IUriBuilder_GetIUri(builder, &uri);
9418 ok(hr == S_OK,
9419 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9420 hr, S_OK, test_index);
9421 if(SUCCEEDED(hr)) {
9422 if(!uri) {
9423 received = (void*) 0xdeadbeef;
9424 len = -1;
9425
9426 hr = IUriBuilder_GetHost(builder, &len, &received);
9427 ok(hr == S_FALSE,
9428 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9429 hr, S_FALSE, test_index);
9430 if(SUCCEEDED(hr)) {
9431 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9432 len, test_index);
9433 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9434 received, test_index);
9435 }
9436 } else {
9437 BOOL has_prop = FALSE;
9438 BSTR expected = NULL;
9439
9440 hr = IUri_GetHost(uri, &expected);
9441 ok(SUCCEEDED(hr),
9442 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9443 hr, test_index);
9444 has_prop = hr == S_OK;
9445
9446 hr = IUriBuilder_GetHost(builder, &len, &received);
9447 if(has_prop) {
9448 ok(hr == S_OK,
9449 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9450 hr, S_OK, test_index);
9451 if(SUCCEEDED(hr)) {
9453 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9455 ok(lstrlenW(expected) == len,
9456 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9457 lstrlenW(expected), len, test_index);
9458 }
9459 } else {
9460 ok(hr == S_FALSE,
9461 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9462 hr, S_FALSE, test_index);
9463 if(SUCCEEDED(hr)) {
9464 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9465 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9466 len, test_index);
9467 }
9468 }
9470 }
9471 }
9472 if(uri) IUri_Release(uri);
9473 }
9474}

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_GetInvalidArgs()

static void test_IUriBuilder_GetInvalidArgs ( void  )
static

Definition at line 9164 of file uri.c.

9164 {
9165 IUriBuilder *builder = NULL;
9166 HRESULT hr;
9167
9168 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9169 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9170 if(SUCCEEDED(hr)) {
9171 LPCWSTR received = (void*) 0xdeadbeef;
9172 DWORD len = -1, port = -1;
9173 BOOL set = -1;
9174
9175 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
9176 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9177 hr, E_POINTER);
9178 hr = IUriBuilder_GetFragment(builder, NULL, &received);
9179 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9180 hr, E_POINTER);
9181 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9182 hr = IUriBuilder_GetFragment(builder, &len, NULL);
9183 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9184 hr, E_POINTER);
9185 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9186
9187 hr = IUriBuilder_GetHost(builder, NULL, NULL);
9188 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9189 hr, E_POINTER);
9190 received = (void*) 0xdeadbeef;
9191 hr = IUriBuilder_GetHost(builder, NULL, &received);
9192 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9193 hr, E_POINTER);
9194 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9195 len = -1;
9196 hr = IUriBuilder_GetHost(builder, &len, NULL);
9197 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9198 hr, E_POINTER);
9199 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9200
9201 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
9202 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9203 hr, E_POINTER);
9204 received = (void*) 0xdeadbeef;
9205 hr = IUriBuilder_GetPassword(builder, NULL, &received);
9206 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9207 hr, E_POINTER);
9208 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9209 len = -1;
9210 hr = IUriBuilder_GetPassword(builder, &len, NULL);
9211 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9212 hr, E_POINTER);
9213 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9214
9215 hr = IUriBuilder_GetPath(builder, NULL, NULL);
9216 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9217 hr, E_POINTER);
9218 received = (void*) 0xdeadbeef;
9219 hr = IUriBuilder_GetPath(builder, NULL, &received);
9220 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9221 hr, E_POINTER);
9222 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9223 len = -1;
9224 hr = IUriBuilder_GetPath(builder, &len, NULL);
9225 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9226 hr, E_POINTER);
9227 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9228
9229 hr = IUriBuilder_GetPort(builder, NULL, NULL);
9230 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9231 hr, E_POINTER);
9232 hr = IUriBuilder_GetPort(builder, NULL, &port);
9233 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9234 hr, E_POINTER);
9235 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
9236 hr = IUriBuilder_GetPort(builder, &set, NULL);
9237 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9238 hr, E_POINTER);
9239 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
9240
9241 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
9242 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9243 hr, E_POINTER);
9244 received = (void*) 0xdeadbeef;
9245 hr = IUriBuilder_GetQuery(builder, NULL, &received);
9246 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9247 hr, E_POINTER);
9248 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9249 len = -1;
9250 hr = IUriBuilder_GetQuery(builder, &len, NULL);
9251 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9252 hr, E_POINTER);
9253 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9254
9255 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
9256 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9257 hr, E_POINTER);
9258 received = (void*) 0xdeadbeef;
9259 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
9260 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9261 hr, E_POINTER);
9262 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9263 len = -1;
9264 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
9265 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9266 hr, E_POINTER);
9267 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9268
9269 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
9270 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9271 hr, E_POINTER);
9272 received = (void*) 0xdeadbeef;
9273 hr = IUriBuilder_GetUserName(builder, NULL, &received);
9274 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9275 hr, E_POINTER);
9276 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9277 len = -1;
9278 hr = IUriBuilder_GetUserName(builder, &len, NULL);
9279 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9280 hr, E_POINTER);
9281 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9282 }
9283 if(builder) IUriBuilder_Release(builder);
9284}
Definition: _set.h:50
USHORT port
Definition: uri.c:228

Referenced by START_TEST().

◆ test_IUriBuilder_GetPassword()

static void test_IUriBuilder_GetPassword ( IUriBuilder builder,
const uri_builder_test test,
DWORD  test_index 
)
static

Definition at line 9476 of file uri.c.

9477 {
9478 HRESULT hr;
9479 DWORD i;
9481 DWORD len = -1;
9482 const uri_builder_property *prop = NULL;
9483
9484 /* Check if the property was set earlier. */
9485 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9486 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
9487 prop = &(test->properties[i]);
9488 }
9489
9490 if(prop) {
9491 /* Use expected_value unless it's NULL, then use value. */
9492 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9493 DWORD expected_len = expected ? strlen(expected) : 0;
9494 hr = IUriBuilder_GetPassword(builder, &len, &received);
9495 todo_wine_if(prop->todo) {
9496 ok(hr == (expected ? S_OK : S_FALSE),
9497 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9498 hr, (expected ? S_OK : S_FALSE), test_index);
9499 if(SUCCEEDED(hr)) {
9500 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9501 expected, wine_dbgstr_w(received), test_index);
9502 ok(expected_len == len,
9503 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9504 expected_len, len, test_index);
9505 }
9506 }
9507 } else {
9508 /* The property wasn't set earlier, so it should return whatever
9509 * the base IUri contains (if anything).
9510 */
9511 IUri *uri = NULL;
9512 hr = IUriBuilder_GetIUri(builder, &uri);
9513 ok(hr == S_OK,
9514 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9515 hr, S_OK, test_index);
9516 if(SUCCEEDED(hr)) {
9517 if(!uri) {
9518 received = (void*) 0xdeadbeef;
9519 len = -1;
9520
9521 hr = IUriBuilder_GetPassword(builder, &len, &received);
9522 ok(hr == S_FALSE,
9523 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9524 hr, S_FALSE, test_index);
9525 if(SUCCEEDED(hr)) {
9526 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9527 len, test_index);
9528 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9529 received, test_index);
9530 }
9531 } else {
9532 BOOL has_prop = FALSE;
9533 BSTR expected = NULL;
9534
9535 hr = IUri_GetPassword(uri, &expected);
9536 ok(SUCCEEDED(hr),
9537 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9538 hr, test_index);
9539 has_prop = hr == S_OK;
9540
9541 hr = IUriBuilder_GetPassword(builder, &len, &received);
9542 if(has_prop) {
9543 ok(hr == S_OK,
9544 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9545 hr, S_OK, test_index);
9546 if(SUCCEEDED(hr)) {
9548 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9550 ok(lstrlenW(expected) == len,
9551 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9552 lstrlenW(expected), len, test_index);
9553 }
9554 } else {
9555 ok(hr == S_FALSE,
9556 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9557 hr, S_FALSE, test_index);
9558 if(SUCCEEDED(hr)) {
9559 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9560 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9561 len, test_index);
9562 }
9563 }
9565 }
9566 }
9567 if(uri) IUri_Release(uri);
9568 }
9569}

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_GetPath()

static void test_IUriBuilder_GetPath ( IUriBuilder builder,
const uri_builder_test test,
DWORD  test_index 
)
static

Definition at line 9571 of file uri.c.

9572 {
9573 HRESULT hr;
9574 DWORD i;
9576 DWORD len = -1;
9577 const uri_builder_property *prop = NULL;
9578
9579 /* Check if the property was set earlier. */
9580 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9581 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
9582 prop = &(test->properties[i]);
9583 }
9584
9585 if(prop) {
9586 /* Use expected_value unless it's NULL, then use value. */
9587 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9588 DWORD expected_len = expected ? strlen(expected) : 0;
9589 hr = IUriBuilder_GetPath(builder, &len, &received);
9590 todo_wine_if(prop->todo) {
9591 ok(hr == (expected ? S_OK : S_FALSE),
9592 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9593 hr, (expected ? S_OK : S_FALSE), test_index);
9594 if(SUCCEEDED(hr)) {
9595 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9596 expected, wine_dbgstr_w(received), test_index);
9597 ok(expected_len == len,
9598 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9599 expected_len, len, test_index);
9600 }
9601 }
9602 } else {
9603 /* The property wasn't set earlier, so it should return whatever
9604 * the base IUri contains (if anything).
9605 */
9606 IUri *uri = NULL;
9607 hr = IUriBuilder_GetIUri(builder, &uri);
9608 ok(hr == S_OK,
9609 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9610 hr, S_OK, test_index);
9611 if(SUCCEEDED(hr)) {
9612 if(!uri) {
9613 received = (void*) 0xdeadbeef;
9614 len = -1;
9615
9616 hr = IUriBuilder_GetPath(builder, &len, &received);
9617 ok(hr == S_FALSE,
9618 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9619 hr, S_FALSE, test_index);
9620 if(SUCCEEDED(hr)) {
9621 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9622 len, test_index);
9623 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9624 received, test_index);
9625 }
9626 } else {
9627 BOOL has_prop = FALSE;
9628 BSTR expected = NULL;
9629
9630 hr = IUri_GetPath(uri, &expected);
9631 ok(SUCCEEDED(hr),
9632 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9633 hr, test_index);
9634 has_prop = hr == S_OK;
9635
9636 hr = IUriBuilder_GetPath(builder, &len, &received);
9637 if(has_prop) {
9638 ok(hr == S_OK,
9639 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9640 hr, S_OK, test_index);
9641 if(SUCCEEDED(hr)) {
9643 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9645 ok(lstrlenW(expected) == len,
9646 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9647 lstrlenW(expected), len, test_index);
9648 }
9649 } else {
9650 ok(hr == S_FALSE,
9651 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9652 hr, S_FALSE, test_index);
9653 if(SUCCEEDED(hr)) {
9654 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9655 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9656 len, test_index);
9657 }
9658 }
9660 }
9661 }
9662 if(uri) IUri_Release(uri);
9663 }
9664}

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_GetPort()

static void test_IUriBuilder_GetPort ( IUriBuilder builder,
const uri_builder_test test,
DWORD  test_index 
)
static

Definition at line 9666 of file uri.c.

9667 {
9668 HRESULT hr;
9669 BOOL has_port = FALSE;
9670 DWORD received = -1;
9671
9672 if(test->port_prop.change) {
9673 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9674 todo_wine_if(test->port_prop.todo) {
9675 ok(hr == S_OK,
9676 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9677 hr, S_OK, test_index);
9678 if(SUCCEEDED(hr)) {
9679 ok(has_port == test->port_prop.set,
9680 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9681 test->port_prop.set, has_port, test_index);
9682 ok(received == test->port_prop.value,
9683 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9684 test->port_prop.value, received, test_index);
9685 }
9686 }
9687 } else {
9688 IUri *uri = NULL;
9689
9690 hr = IUriBuilder_GetIUri(builder, &uri);
9691 ok(hr == S_OK,
9692 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9693 hr, S_OK, test_index);
9694 if(SUCCEEDED(hr)) {
9695 if(!uri) {
9696 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9697 ok(hr == S_OK,
9698 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9699 hr, S_OK, test_index);
9700 if(SUCCEEDED(hr)) {
9701 ok(has_port == FALSE,
9702 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9703 has_port, test_index);
9704 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9705 received, test_index);
9706 }
9707 } else {
9709
9710 hr = IUri_GetPort(uri, &expected);
9711 ok(SUCCEEDED(hr),
9712 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9713 hr, test_index);
9714
9715 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9716 ok(hr == S_OK,
9717 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9718 hr, S_OK, test_index);
9719 if(SUCCEEDED(hr)) {
9720 ok(!has_port,
9721 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9722 test_index);
9723 ok(received == expected,
9724 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9725 expected, received, test_index);
9726 }
9727 }
9728 }
9729 if(uri) IUri_Release(uri);
9730 }
9731}

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_GetQuery()

static void test_IUriBuilder_GetQuery ( IUriBuilder builder,
const uri_builder_test test,
DWORD  test_index 
)
static

Definition at line 9733 of file uri.c.

9734 {
9735 HRESULT hr;
9736 DWORD i;
9738 DWORD len = -1;
9739 const uri_builder_property *prop = NULL;
9740
9741 /* Check if the property was set earlier. */
9742 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9743 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
9744 prop = &(test->properties[i]);
9745 }
9746
9747 if(prop) {
9748 /* Use expected_value unless it's NULL, then use value. */
9749 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9750 DWORD expected_len = expected ? strlen(expected) : 0;
9751 hr = IUriBuilder_GetQuery(builder, &len, &received);
9752 todo_wine_if(prop->todo) {
9753 ok(hr == (expected ? S_OK : S_FALSE),
9754 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9755 hr, (expected ? S_OK : S_FALSE), test_index);
9756 if(SUCCEEDED(hr)) {
9757 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9758 expected, wine_dbgstr_w(received), test_index);
9759 ok(expected_len == len,
9760 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9761 expected_len, len, test_index);
9762 }
9763 }
9764 } else {
9765 /* The property wasn't set earlier, so it should return whatever
9766 * the base IUri contains (if anything).
9767 */
9768 IUri *uri = NULL;
9769 hr = IUriBuilder_GetIUri(builder, &uri);
9770 ok(hr == S_OK,
9771 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9772 hr, S_OK, test_index);
9773 if(SUCCEEDED(hr)) {
9774 if(!uri) {
9775 received = (void*) 0xdeadbeef;
9776 len = -1;
9777
9778 hr = IUriBuilder_GetQuery(builder, &len, &received);
9779 ok(hr == S_FALSE,
9780 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9781 hr, S_FALSE, test_index);
9782 if(SUCCEEDED(hr)) {
9783 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9784 len, test_index);
9785 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9786 received, test_index);
9787 }
9788 } else {
9789 BOOL has_prop = FALSE;
9790 BSTR expected = NULL;
9791
9792 hr = IUri_GetQuery(uri, &expected);
9793 ok(SUCCEEDED(hr),
9794 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9795 hr, test_index);
9796 has_prop = hr == S_OK;
9797
9798 hr = IUriBuilder_GetQuery(builder, &len, &received);
9799 if(has_prop) {
9800 ok(hr == S_OK,
9801 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9802 hr, S_OK, test_index);
9803 if(SUCCEEDED(hr)) {
9805 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9807 ok(lstrlenW(expected) == len,
9808 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9809 lstrlenW(expected), len, test_index);
9810 }
9811 } else {
9812 ok(hr == S_FALSE,
9813 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9814 hr, S_FALSE, test_index);
9815 if(SUCCEEDED(hr)) {
9816 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9817 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9818 len, test_index);
9819 }
9820 }
9822 }
9823 }
9824 if(uri) IUri_Release(uri);
9825 }
9826}

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_GetSchemeName()

static void test_IUriBuilder_GetSchemeName ( IUriBuilder builder,
const uri_builder_test test,
DWORD  test_index 
)
static

Definition at line 9828 of file uri.c.

9829 {
9830 HRESULT hr;
9831 DWORD i;
9833 DWORD len = -1;
9834 const uri_builder_property *prop = NULL;
9835
9836 /* Check if the property was set earlier. */
9837 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9838 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9839 prop = &(test->properties[i]);
9840 }
9841
9842 if(prop) {
9843 /* Use expected_value unless it's NULL, then use value. */
9844 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9845 DWORD expected_len = expected ? strlen(expected) : 0;
9846 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9847 todo_wine_if(prop->todo) {
9848 ok(hr == (expected ? S_OK : S_FALSE),
9849 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9850 hr, (expected ? S_OK : S_FALSE), test_index);
9851 if(SUCCEEDED(hr)) {
9852 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9853 expected, wine_dbgstr_w(received), test_index);
9854 ok(expected_len == len,
9855 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9856 expected_len, len, test_index);
9857 }
9858 }
9859 } else {
9860 /* The property wasn't set earlier, so it should return whatever
9861 * the base IUri contains (if anything).
9862 */
9863 IUri *uri = NULL;
9864 hr = IUriBuilder_GetIUri(builder, &uri);
9865 ok(hr == S_OK,
9866 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9867 hr, S_OK, test_index);
9868 if(SUCCEEDED(hr)) {
9869 if(!uri) {
9870 received = (void*) 0xdeadbeef;
9871 len = -1;
9872
9873 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9874 ok(hr == S_FALSE,
9875 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9876 hr, S_FALSE, test_index);
9877 if(SUCCEEDED(hr)) {
9878 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9879 len, test_index);
9880 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9881 received, test_index);
9882 }
9883 } else {
9884 BOOL has_prop = FALSE;
9885 BSTR expected = NULL;
9886
9887 hr = IUri_GetSchemeName(uri, &expected);
9888 ok(SUCCEEDED(hr),
9889 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9890 hr, test_index);
9891 has_prop = hr == S_OK;
9892
9893 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9894 if(has_prop) {
9895 ok(hr == S_OK,
9896 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9897 hr, S_OK, test_index);
9898 if(SUCCEEDED(hr)) {
9900 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9902 ok(lstrlenW(expected) == len,
9903 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9904 lstrlenW(expected), len, test_index);
9905 }
9906 } else {
9907 ok(hr == S_FALSE,
9908 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9909 hr, S_FALSE, test_index);
9910 if(SUCCEEDED(hr)) {
9911 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9912 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9913 len, test_index);
9914 }
9915 }
9917 }
9918 }
9919 if(uri) IUri_Release(uri);
9920 }
9921}

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_GetUserName()

static void test_IUriBuilder_GetUserName ( IUriBuilder builder,
const uri_builder_test test,
DWORD  test_index 
)
static

Definition at line 9923 of file uri.c.

9924 {
9925 HRESULT hr;
9926 DWORD i;
9928 DWORD len = -1;
9929 const uri_builder_property *prop = NULL;
9930
9931 /* Check if the property was set earlier. */
9932 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9933 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9934 prop = &(test->properties[i]);
9935 }
9936
9937 if(prop && prop->value && *prop->value) {
9938 /* Use expected_value unless it's NULL, then use value. */
9939 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9940 DWORD expected_len = expected ? strlen(expected) : 0;
9941 hr = IUriBuilder_GetUserName(builder, &len, &received);
9942 todo_wine_if(prop->todo) {
9943 ok(hr == (expected ? S_OK : S_FALSE),
9944 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9945 hr, (expected ? S_OK : S_FALSE), test_index);
9946 if(SUCCEEDED(hr)) {
9947 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9948 expected, wine_dbgstr_w(received), test_index);
9949 ok(expected_len == len,
9950 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9951 expected_len, len, test_index);
9952 }
9953 }
9954 } else {
9955 /* The property wasn't set earlier, so it should return whatever
9956 * the base IUri contains (if anything).
9957 */
9958 IUri *uri = NULL;
9959 hr = IUriBuilder_GetIUri(builder, &uri);
9960 ok(hr == S_OK,
9961 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9962 hr, S_OK, test_index);
9963 if(SUCCEEDED(hr)) {
9964 if(!uri) {
9965 received = (void*) 0xdeadbeef;
9966 len = -1;
9967
9968 hr = IUriBuilder_GetUserName(builder, &len, &received);
9969 ok(hr == S_FALSE,
9970 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9971 hr, S_FALSE, test_index);
9972 if(SUCCEEDED(hr)) {
9973 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9974 len, test_index);
9975 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9976 received, test_index);
9977 }
9978 } else {
9979 BSTR expected = NULL;
9980 BOOL has_prop = FALSE;
9981
9982 hr = IUri_GetUserName(uri, &expected);
9983 ok(SUCCEEDED(hr),
9984 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9985 hr, test_index);
9986 has_prop = hr == S_OK;
9987
9988 hr = IUriBuilder_GetUserName(builder, &len, &received);
9989 if(has_prop) {
9990 ok(hr == S_OK,
9991 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9992 hr, S_OK, test_index);
9993 if(SUCCEEDED(hr)) {
9995 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9997 ok(lstrlenW(expected) == len,
9998 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9999 lstrlenW(expected), len, test_index);
10000 }
10001 } else {
10002 ok(hr == S_FALSE,
10003 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10004 hr, S_FALSE, test_index);
10005 if(SUCCEEDED(hr)) {
10006 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
10007 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
10008 len, test_index);
10009 }
10010 }
10012 }
10013 }
10014 if(uri) IUri_Release(uri);
10015 }
10016}

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_HasBeenModified()

static void test_IUriBuilder_HasBeenModified ( void  )
static

Definition at line 10099 of file uri.c.

10099 {
10100 HRESULT hr;
10101 IUriBuilder *builder = NULL;
10102
10103 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10104 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10105 if(SUCCEEDED(hr)) {
10106 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
10107 IUri *uri = NULL;
10108 BOOL received;
10109
10110 hr = IUriBuilder_HasBeenModified(builder, NULL);
10111 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10112 hr, E_POINTER);
10113
10114 hr = IUriBuilder_SetHost(builder, hostW);
10115 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
10116 hr, S_OK);
10117
10118 hr = IUriBuilder_HasBeenModified(builder, &received);
10119 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10120 hr, S_OK);
10121 if(SUCCEEDED(hr))
10122 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10123
10124 hr = pCreateUri(http_urlW, 0, 0, &uri);
10125 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10126 if(SUCCEEDED(hr)) {
10127 LPCWSTR prop;
10128 DWORD len = -1;
10129
10130 hr = IUriBuilder_SetIUri(builder, uri);
10131 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
10132 hr, S_OK);
10133
10134 hr = IUriBuilder_HasBeenModified(builder, &received);
10135 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10136 hr, S_OK);
10137 if(SUCCEEDED(hr))
10138 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
10139
10140 /* Test what happens with you call SetIUri with the same IUri again. */
10141 hr = IUriBuilder_SetHost(builder, hostW);
10142 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10143
10144 hr = IUriBuilder_HasBeenModified(builder, &received);
10145 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10146 hr, S_OK);
10147 if(SUCCEEDED(hr))
10148 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10149
10150 hr = IUriBuilder_SetIUri(builder, uri);
10151 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10152
10153 /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
10154 * reset any of the changes that were made to the IUriBuilder.
10155 */
10156 hr = IUriBuilder_HasBeenModified(builder, &received);
10157 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10158 if(SUCCEEDED(hr))
10159 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10160
10161 hr = IUriBuilder_GetHost(builder, &len, &prop);
10162 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10163 if(SUCCEEDED(hr)) {
10164 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
10166 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
10167 lstrlenW(hostW), len);
10168 }
10169
10170 hr = IUriBuilder_SetIUri(builder, NULL);
10171 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10172
10173 hr = IUriBuilder_SetHost(builder, hostW);
10174 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10175 hr = IUriBuilder_HasBeenModified(builder, &received);
10176 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10177 hr, S_OK);
10178 if(SUCCEEDED(hr))
10179 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10180
10181 hr = IUriBuilder_SetIUri(builder, NULL);
10182 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
10183
10184 hr = IUriBuilder_HasBeenModified(builder, &received);
10185 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10186 hr, S_OK);
10187 if(SUCCEEDED(hr))
10188 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10189
10190 hr = IUriBuilder_GetHost(builder, &len, &prop);
10191 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10192 if(SUCCEEDED(hr)) {
10193 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
10195 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
10196 lstrlenW(hostW), len);
10197 }
10198 }
10199 if(uri) IUri_Release(uri);
10200 }
10201 if(builder) IUriBuilder_Release(builder);
10202}
static const WCHAR hostW[]
Definition: protocol.c:140

Referenced by START_TEST().

◆ test_IUriBuilder_IUriProperty()

static void test_IUriBuilder_IUriProperty ( void  )
static

Definition at line 10205 of file uri.c.

10205 {
10206 IUriBuilder *builder = NULL;
10207 HRESULT hr;
10208
10209 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10210 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10211 if(SUCCEEDED(hr)) {
10212 IUri *uri = NULL;
10213
10214 hr = IUriBuilder_GetIUri(builder, NULL);
10215 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
10216 hr, E_POINTER);
10217
10218 hr = pCreateUri(http_urlW, 0, 0, &uri);
10219 if(SUCCEEDED(hr)) {
10220 IUri *test = NULL;
10221 ULONG cur_count, orig_count;
10222
10223 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
10224 orig_count = get_refcnt(uri);
10225 hr = IUriBuilder_SetIUri(builder, uri);
10226 cur_count = get_refcnt(uri);
10227 if(SUCCEEDED(hr))
10228 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10229 orig_count+1, cur_count);
10230
10231 hr = IUriBuilder_SetIUri(builder, NULL);
10232 cur_count = get_refcnt(uri);
10233 if(SUCCEEDED(hr))
10234 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10235 orig_count, cur_count);
10236
10237 /* CreateUri* functions will return back the same IUri if nothing has changed. */
10238 hr = IUriBuilder_SetIUri(builder, uri);
10239 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10240 orig_count = get_refcnt(uri);
10241
10242 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
10243 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10244 if(SUCCEEDED(hr)) {
10245 cur_count = get_refcnt(uri);
10246 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10247 orig_count+1, cur_count);
10248 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
10249 uri, test);
10250 }
10251 if(test) IUri_Release(test);
10252
10253 test = NULL;
10254 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
10255 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10256 if(SUCCEEDED(hr)) {
10257 cur_count = get_refcnt(uri);
10258 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10259 orig_count+1, cur_count);
10260 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10261 }
10262 if(test) IUri_Release(test);
10263
10264 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10265 * the base IUri.
10266 */
10267 test = NULL;
10268 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
10269 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10270 if(SUCCEEDED(hr))
10271 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10272
10273 if(test) IUri_Release(test);
10274
10275 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10276 * explicitly set (because it's a default flag).
10277 */
10278 test = NULL;
10279 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
10280 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10281 if(SUCCEEDED(hr)) {
10282 cur_count = get_refcnt(uri);
10283 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10284 orig_count+1, cur_count);
10285 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10286 }
10287 if(test) IUri_Release(test);
10288
10289 test = NULL;
10290 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
10291 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10292 if(SUCCEEDED(hr)) {
10293 cur_count = get_refcnt(uri);
10294 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10295 orig_count+1, cur_count);
10296 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10297 }
10298 if(test) IUri_Release(test);
10299
10300 test = NULL;
10301 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
10302 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
10303 hr, S_OK);
10304 if(SUCCEEDED(hr)) {
10305 cur_count = get_refcnt(uri);
10306 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10307 orig_count+1, cur_count);
10308 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10309 }
10310 if(test) IUri_Release(test);
10311
10312 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10313 * the base IUri.
10314 */
10315 test = NULL;
10316 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
10317 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10318 if(SUCCEEDED(hr))
10319 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10320
10321 if(test) IUri_Release(test);
10322
10323 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10324 * explicitly set (because it's a default flag).
10325 */
10326 test = NULL;
10327 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
10328 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10329 if(SUCCEEDED(hr)) {
10330 cur_count = get_refcnt(uri);
10331 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10332 orig_count+1, cur_count);
10333 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10334 }
10335 if(test) IUri_Release(test);
10336 }
10337 if(uri) IUri_Release(uri);
10338 }
10339 if(builder) IUriBuilder_Release(builder);
10340}

Referenced by START_TEST().

◆ test_IUriBuilder_Misc()

static void test_IUriBuilder_Misc ( void  )
static

Definition at line 10426 of file uri.c.

10426 {
10427 HRESULT hr;
10428 IUri *uri;
10429
10430 hr = pCreateUri(http_urlW, 0, 0, &uri);
10431 if(SUCCEEDED(hr)) {
10432 IUriBuilder *builder;
10433
10434 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10435 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10436 if(SUCCEEDED(hr)) {
10437 BOOL has = -1;
10438 DWORD port = -1;
10439
10440 hr = IUriBuilder_GetPort(builder, &has, &port);
10441 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10442 if(SUCCEEDED(hr)) {
10443 /* 'has' will be set to FALSE, even though uri had a port. */
10444 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
10445 /* Still sets 'port' to 80. */
10446 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
10447 }
10448 }
10449 if(builder) IUriBuilder_Release(builder);
10450 }
10451 if(uri) IUri_Release(uri);
10452}

Referenced by START_TEST().

◆ test_IUriBuilder_RemoveProperties()

static void test_IUriBuilder_RemoveProperties ( void  )
static

Definition at line 10342 of file uri.c.

10342 {
10343 IUriBuilder *builder = NULL;
10344 HRESULT hr;
10345 DWORD i;
10346
10347 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10348 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10349 if(SUCCEEDED(hr)) {
10350 /* Properties that can't be removed. */
10351 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
10352 Uri_HAS_SCHEME|Uri_HAS_ZONE;
10353
10354 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
10355 hr = IUriBuilder_RemoveProperties(builder, i << 1);
10356 if((i << 1) & invalid) {
10357 ok(hr == E_INVALIDARG,
10358 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10359 hr, E_INVALIDARG, i);
10360 } else {
10361 ok(hr == S_OK,
10362 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10363 hr, S_OK, i);
10364 }
10365 }
10366
10367 /* Also doesn't accept anything that's outside the range of the
10368 * Uri_HAS flags.
10369 */
10370 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
10371 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
10372 hr, E_INVALIDARG);
10373 }
10374 if(builder) IUriBuilder_Release(builder);
10375
10376 for(i = 0; i < ARRAY_SIZE(uri_builder_remove_tests); ++i) {
10378 IUri *uri = NULL;
10379 LPWSTR uriW;
10380
10381 uriW = a2w(test.uri);
10382 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10383 if(SUCCEEDED(hr)) {
10384 builder = NULL;
10385
10386 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10387 todo_wine_if(test.create_builder_todo)
10388 ok(hr == test.create_builder_expected,
10389 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10390 hr, test.create_builder_expected, i);
10391
10392 if(SUCCEEDED(hr)) {
10393 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
10394 todo_wine_if(test.remove_todo)
10395 ok(hr == test.remove_expected,
10396 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10397 hr, test.remove_expected, i);
10398 if(SUCCEEDED(hr)) {
10399 IUri *result = NULL;
10400
10401 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
10402 todo_wine_if(test.expected_todo)
10403 ok(hr == test.expected_hres,
10404 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10405 hr, test.expected_hres, i);
10406 if(SUCCEEDED(hr)) {
10407 BSTR received = NULL;
10408
10409 hr = IUri_GetAbsoluteUri(result, &received);
10410 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10411 ok(!strcmp_aw(test.expected_uri, received),
10412 "Error: Expected %s but got %s instead on test %d.\n",
10413 test.expected_uri, wine_dbgstr_w(received), i);
10415 }
10416 if(result) IUri_Release(result);
10417 }
10418 }
10419 if(builder) IUriBuilder_Release(builder);
10420 }
10421 if(uri) IUri_Release(uri);
10422 heap_free(uriW);
10423 }
10424}
static const WCHAR invalid[]
Definition: assoc.c:39
static const uri_builder_remove_test uri_builder_remove_tests[]
Definition: uri.c:6378

Referenced by START_TEST().

◆ test_IUriBuilderFactory()

static void test_IUriBuilderFactory ( void  )
static

Definition at line 10454 of file uri.c.

10454 {
10455 HRESULT hr;
10456 IUri *uri;
10458 IUriBuilder *builder;
10459
10460 hr = pCreateUri(http_urlW, 0, 0, &uri);
10461 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10462 if(SUCCEEDED(hr)) {
10463 factory = NULL;
10464 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
10465 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
10466 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
10467
10468 if(SUCCEEDED(hr)) {
10469 builder = (void*) 0xdeadbeef;
10470 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
10471 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10472 hr, E_INVALIDARG);
10473 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10474
10475 builder = (void*) 0xdeadbeef;
10476 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
10477 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10478 hr, E_INVALIDARG);
10479 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10480
10481 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
10482 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10483 hr, E_POINTER);
10484
10485 builder = NULL;
10486 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
10487 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10488 hr, S_OK);
10489 if(SUCCEEDED(hr)) {
10490 IUri *tmp = (void*) 0xdeadbeef;
10492 DWORD result_len;
10493
10494 hr = IUriBuilder_GetIUri(builder, &tmp);
10495 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
10496 hr, S_OK);
10497 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
10498
10499 hr = IUriBuilder_GetHost(builder, &result_len, &result);
10500 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
10501 hr, S_FALSE);
10502 }
10503 if(builder) IUriBuilder_Release(builder);
10504
10505 builder = (void*) 0xdeadbeef;
10506 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
10507 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10508 hr, E_INVALIDARG);
10509 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10510
10511 builder = (void*) 0xdeadbeef;
10512 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
10513 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10514 hr, E_INVALIDARG);
10515 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10516
10517 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
10518 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10519 hr, E_POINTER);
10520
10521 builder = NULL;
10522 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
10523 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10524 hr, S_OK);
10525 if(SUCCEEDED(hr)) {
10526 IUri *tmp = NULL;
10527
10528 hr = IUriBuilder_GetIUri(builder, &tmp);
10529 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
10530 hr, S_OK);
10531 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
10532 if(tmp) IUri_Release(tmp);
10533 }
10534 if(builder) IUriBuilder_Release(builder);
10535 }
10536 if(factory) IUriBuilderFactory_Release(factory);
10537 }
10538 if(uri) IUri_Release(uri);
10539}
Definition: main.c:439

Referenced by START_TEST().

◆ test_UninitializedUri()

static void test_UninitializedUri ( void  )
static

Definition at line 11561 of file uri.c.

11562{
11563 IUri *uri;
11564 IUriBuilderFactory *ubf;
11565 IPersistStream *ps;
11566 IUriBuilder *ub;
11567 BSTR bstr;
11568 DWORD dword;
11569 BOOL eq;
11571 HRESULT hr;
11572
11573 hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11574 &IID_IUri, (void**)&uri);
11575 if(FAILED(hr)) {
11576 win_skip("Skipping uninitialized Uri tests.\n");
11577 return;
11578 }
11579
11580 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
11581 ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr);
11582 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
11583 ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr);
11584
11585 hr = IUri_GetAbsoluteUri(uri, NULL);
11586 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11587 hr = IUri_GetAbsoluteUri(uri, &bstr);
11588 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11589 hr = IUri_GetAuthority(uri, &bstr);
11590 ok(hr == E_UNEXPECTED, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr);
11591 hr = IUri_GetDisplayUri(uri, &bstr);
11592 ok(hr == E_UNEXPECTED, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr);
11593 hr = IUri_GetDomain(uri, &bstr);
11594 ok(hr == E_UNEXPECTED, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr);
11595 hr = IUri_GetExtension(uri, &bstr);
11596 ok(hr == E_UNEXPECTED, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr);
11597 hr = IUri_GetFragment(uri, &bstr);
11598 ok(hr == E_UNEXPECTED, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr);
11599 hr = IUri_GetHost(uri, &bstr);
11600 ok(hr == E_UNEXPECTED, "GetHost returned %x, expected E_UNEXPECTED.\n", hr);
11601 hr = IUri_GetHostType(uri, &dword);
11602 ok(hr == E_UNEXPECTED, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr);
11603 hr = IUri_GetPassword(uri, &bstr);
11604 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11605 hr = IUri_GetPassword(uri, &bstr);
11606 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11607 hr = IUri_GetPathAndQuery(uri, &bstr);
11608 ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr);
11609 hr = IUri_GetPort(uri, &dword);
11610 ok(hr == E_UNEXPECTED, "GetPort returned %x, expected E_UNEXPECTED.\n", hr);
11611 hr = IUri_GetProperties(uri, &dword);
11612 ok(hr == E_UNEXPECTED, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr);
11613 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
11614 ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr);
11615 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
11616 ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr);
11617 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
11618 ok(hr == E_UNEXPECTED, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr);
11619 hr = IUri_GetQuery(uri, &bstr);
11620 ok(hr == E_UNEXPECTED, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr);
11621 hr = IUri_GetRawUri(uri, &bstr);
11622 ok(hr == E_UNEXPECTED, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr);
11623 hr = IUri_GetScheme(uri, &dword);
11624 ok(hr == E_UNEXPECTED, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr);
11625 hr = IUri_GetSchemeName(uri, &bstr);
11626 ok(hr == E_UNEXPECTED, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr);
11627 hr = IUri_GetUserInfo(uri, &bstr);
11628 ok(hr == E_UNEXPECTED, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr);
11629 hr = IUri_GetUserName(uri, &bstr);
11630 ok(hr == E_UNEXPECTED, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr);
11631 hr = IUri_GetZone(uri, &dword);
11632 ok(hr == E_UNEXPECTED, "GetZone returned %x, expected E_UNEXPECTED.\n", hr);
11633 hr = IUri_IsEqual(uri, uri, &eq);
11634 ok(hr == E_UNEXPECTED, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr);
11635
11636 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
11637 ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr);
11638 hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
11639 ok(hr == S_OK, "CreateIUriBuilder returned %x, expected S_OK.\n", hr);
11640 IUriBuilder_Release(ub);
11641
11642 hr = IPersistStream_GetSizeMax(ps, &ui);
11643 ok(hr == S_OK, "GetSizeMax returned %x, expected S_OK.\n", hr);
11644 ok(ui.u.LowPart == 34, "ui.LowPart = %d, expected 34.\n", ui.u.LowPart);
11645 hr = IPersistStream_IsDirty(ps);
11646 ok(hr == S_FALSE, "IsDirty returned %x, expected S_FALSE.\n", hr);
11647
11648 IPersistStream_Release(ps);
11649 IUriBuilderFactory_Release(ubf);
11650 IUri_Release(uri);
11651}
#define eq(received, expected, label, type)
Definition: locale.c:144
UINT ui
Definition: oleauto.h:49

Referenced by START_TEST().

◆ unregister_protocols()

static void unregister_protocols ( void  )
static

Definition at line 10776 of file uri.c.

10776 {
10778 HRESULT hr;
10779
10780 hr = pCoInternetGetSession(0, &session, 0);
10781 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10782 if(FAILED(hr))
10783 return;
10784
10785 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10786 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10787
10788 IInternetSession_Release(session);
10789}

Referenced by START_TEST().

Variable Documentation

◆ ClassFactoryVtbl

const IClassFactoryVtbl ClassFactoryVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
Definition: uri.c:10743
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
Definition: uri.c:10736
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: uri.c:10731
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: uri.c:10715
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: uri.c:10726

Definition at line 10749 of file uri.c.

◆ combine_baseW

const WCHAR combine_baseW[]
static
Initial value:
= {'w','i','n','e','t','e','s','t',':','?','t',
'e','s','t','i','n','g',0}

Definition at line 87 of file uri.c.

Referenced by InternetProtocolInfo_CombineUrl(), test_CoInternetCombineIUri_Pluggable(), and test_CoInternetCombineUrlEx_Pluggable().

◆ combine_relativeW

const WCHAR combine_relativeW[] = {'?','t','e','s','t',0}
static

◆ combine_resultW

const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0}
static

◆ create_urlmon_tests

const create_urlmon_test_t create_urlmon_tests[]
static

Definition at line 11125 of file uri.c.

Referenced by test_CreateURLMoniker().

◆ custom_uri_vtbl

const IUriVtbl custom_uri_vtbl
static

Definition at line 8704 of file uri.c.

Referenced by test_IUri_IsEqual().

◆ DWORD

Definition at line 72 of file uri.c.

◆ DWORD_PTR

Definition at line 72 of file uri.c.

◆ equality_tests

const uri_equality equality_tests[]
static

Definition at line 5143 of file uri.c.

Referenced by test_IUri_IsEqual().

◆ http_url_fragW

const WCHAR http_url_fragW[]
static
Initial value:
= { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
'.','o','r','g','/','#','F','r','a','g',0}

Definition at line 84 of file uri.c.

Referenced by test_CreateUriWithFragment_InvalidArgs().

◆ http_urlW

◆ InternetProtocolInfoVtbl

const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
static
Initial value:
= {
}
static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
Definition: uri.c:10695
static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
Definition: uri.c:10688
static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface, LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: uri.c:10669
static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
Definition: uri.c:10642
static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
Definition: uri.c:10647
static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface, REFIID riid, void **ppv)
Definition: uri.c:10635
static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: uri.c:10652

Definition at line 10703 of file uri.c.

◆ invalid_flag_tests

const uri_create_flag_test invalid_flag_tests[]
static
Initial value:
= {
{Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
{Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
{Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
{Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
{Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
}

Definition at line 105 of file uri.c.

Referenced by test_CreateUri_InvalidFlags(), and test_CreateUriWithFragment_InvalidFlags().

◆ invalid_uri_tests

const invalid_uri invalid_uri_tests[]
static

Definition at line 5071 of file uri.c.

Referenced by test_CreateUri_InvalidUri().

◆ LPCWSTR

Definition at line 73 of file uri.c.

◆ LPWSTR

Definition at line 78 of file uri.c.

◆ parse_action

PARSEACTION parse_action
static

Definition at line 97 of file uri.c.

Referenced by InternetProtocolInfo_ParseUrl(), and test_CoInternetParseIUri_Pluggable().

◆ parse_flags

DWORD parse_flags
static

Definition at line 98 of file uri.c.

Referenced by InternetProtocolInfo_ParseUrl(), and test_CoInternetParseIUri_Pluggable().

◆ parse_resultW

const WCHAR parse_resultW[] = {'z','i','p',':','t','e','s','t',0}
static

Definition at line 95 of file uri.c.

Referenced by InternetProtocolInfo_ParseUrl(), and test_CoInternetParseIUri_Pluggable().

◆ parse_urlW

const WCHAR parse_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0}
static

Definition at line 94 of file uri.c.

Referenced by InternetProtocolInfo_ParseUrl(), and test_CoInternetParseIUri_Pluggable().

◆ PARSEACTION

PARSEACTION

Definition at line 78 of file uri.c.

◆ protocol_cf

IClassFactory protocol_cf = { &ClassFactoryVtbl }
static

Definition at line 10757 of file uri.c.

Referenced by register_protocols(), and unregister_protocols().

◆ protocol_info

IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl }
static

Definition at line 10713 of file uri.c.

Referenced by ClassFactory_QueryInterface().

◆ uri_builder_remove_tests

const uri_builder_remove_test uri_builder_remove_tests[]
static

Definition at line 6378 of file uri.c.

Referenced by test_IUriBuilder_RemoveProperties().

◆ uri_builder_tests

const uri_builder_test uri_builder_tests[]
static

Definition at line 5362 of file uri.c.

Referenced by test_IUriBuilder().

◆ uri_combine_tests

const uri_combine_test uri_combine_tests[]
static

Definition at line 6441 of file uri.c.

Referenced by test_CoInternetCombineIUri(), and test_CoInternetCombineUrlEx().

◆ uri_fragment_tests

const uri_with_fragment uri_fragment_tests[]
static
Initial value:
= {
{
"http://google.com/","#fragment",0,S_OK,FALSE,
"http://google.com/#fragment",FALSE
},
{
"http://google.com/","fragment",0,S_OK,FALSE,
"http://google.com/#fragment",FALSE
},
{
"zip://test.com/","?test",0,S_OK,FALSE,
"zip://test.com/#?test",FALSE
},
{
"ftp://ftp.google.com/","",0,S_OK,FALSE,
"ftp://ftp.google.com/#",FALSE
}
}

Definition at line 5285 of file uri.c.

Referenced by test_CreateUriWithFragment().

◆ uri_parse_tests

const uri_parse_test uri_parse_tests[]
static

Definition at line 7612 of file uri.c.

Referenced by test_CoInternetParseIUri().

◆ uri_tests

◆ winetestW

const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0}
static

Definition at line 92 of file uri.c.

Referenced by register_protocols(), and unregister_protocols().