ReactOS 0.4.17-dev-470-gf9e3448
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 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:34

Definition at line 62 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 49 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 56 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 43 of file uri.c.

◆ SET_EXPECT

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

Definition at line 46 of file uri.c.

◆ test_display_uri

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

Definition at line 11683 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 11669 of file uri.c.

◆ URI_BUILDER_STR_PROPERTY_COUNT

#define URI_BUILDER_STR_PROPERTY_COUNT   7

Definition at line 41 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 40 of file uri.c.

◆ URI_STR_PROPERTY_COUNT

#define URI_STR_PROPERTY_COUNT   Uri_PROPERTY_STRING_LAST+1

Definition at line 39 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 11684 of file uri.c.

11685{
11686 IUriContainer *uri_container;
11687 IUri *uri;
11688 BSTR display_uri;
11689 HRESULT hres;
11690
11691 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
11692 ok(hres == S_OK, "Could not get IUriContainer iface: %08lx\n", hres);
11693
11694 uri = NULL;
11695 hres = IUriContainer_GetIUri(uri_container, &uri);
11696 IUriContainer_Release(uri_container);
11697 ok(hres == S_OK, "GetIUri failed: %08lx\n", hres);
11698 ok(uri != NULL, "uri == NULL\n");
11699
11700 hres = IUri_GetDisplayUri(uri, &display_uri);
11701 IUri_Release(uri);
11702 ok(hres == S_OK, "GetDisplayUri failed: %08lx\n", hres);
11703 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
11704 wine_dbgstr_w(display_uri), exurl);
11705 SysFreeString(display_uri);
11706}
#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 WCHAR * uri
Definition: sec_mgr.c:1564
static DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB)
Definition: uri.c:8141
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 11670 of file uri.c.

11671{
11672 WCHAR *display_name;
11673 HRESULT hres;
11674
11675 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
11676 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08lx\n", hres);
11677 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
11678 wine_dbgstr_w(display_name), exurl);
11679
11680 CoTaskMemFree(display_name);
11681}
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
short WCHAR
Definition: pedump.c:58

◆ a2w()

◆ add_default_flags()

static int add_default_flags ( DWORD  flags)
static

Definition at line 11786 of file uri.c.

11786 {
11787 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
11788 flags |= Uri_CREATE_CANONICALIZE;
11789 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
11790 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
11791 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
11792 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
11793 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
11794 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
11795 if(!(flags & Uri_CREATE_IE_SETTINGS))
11796 flags |= Uri_CREATE_NO_IE_SETTINGS;
11797
11798 return flags;
11799}
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 8153 of file uri.c.

8154 {
8155 HRESULT hr;
8156 LPWSTR valueW;
8157
8158 valueW = a2w(prop->value);
8159 switch(prop->property) {
8160 case Uri_PROPERTY_FRAGMENT:
8161 hr = IUriBuilder_SetFragment(builder, valueW);
8162 todo_wine_if(prop->todo) {
8163 ok(hr == prop->expected,
8164 "Error: IUriBuilder_SetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
8165 hr, prop->expected, test_index);
8166 }
8167 break;
8168 case Uri_PROPERTY_HOST:
8169 hr = IUriBuilder_SetHost(builder, valueW);
8170 todo_wine_if(prop->todo) {
8171 ok(hr == prop->expected,
8172 "Error: IUriBuilder_SetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
8173 hr, prop->expected, test_index);
8174 }
8175 break;
8176 case Uri_PROPERTY_PASSWORD:
8177 hr = IUriBuilder_SetPassword(builder, valueW);
8178 todo_wine_if(prop->todo) {
8179 ok(hr == prop->expected,
8180 "Error: IUriBuilder_SetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
8181 hr, prop->expected, test_index);
8182 }
8183 break;
8184 case Uri_PROPERTY_PATH:
8185 hr = IUriBuilder_SetPath(builder, valueW);
8186 todo_wine_if(prop->todo) {
8187 ok(hr == prop->expected,
8188 "Error: IUriBuilder_SetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
8189 hr, prop->expected, test_index);
8190 }
8191 break;
8192 case Uri_PROPERTY_QUERY:
8193 hr = IUriBuilder_SetQuery(builder, valueW);
8194 todo_wine_if(prop->todo) {
8195 ok(hr == prop->expected,
8196 "Error: IUriBuilder_SetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
8197 hr, prop->expected, test_index);
8198 }
8199 break;
8200 case Uri_PROPERTY_SCHEME_NAME:
8201 hr = IUriBuilder_SetSchemeName(builder, valueW);
8202 todo_wine_if(prop->todo) {
8203 ok(hr == prop->expected,
8204 "Error: IUriBuilder_SetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
8205 hr, prop->expected, test_index);
8206 }
8207 break;
8208 case Uri_PROPERTY_USER_NAME:
8209 hr = IUriBuilder_SetUserName(builder, valueW);
8210 todo_wine_if(prop->todo) {
8211 ok(hr == prop->expected,
8212 "Error: IUriBuilder_SetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
8213 hr, prop->expected, test_index);
8214 }
8215 break;
8216 default:
8217 trace("Unsupported operation for %d on uri_builder_tests[%ld].\n", prop->property, test_index);
8218 }
8219
8220 free(valueW);
8221}
#define trace
Definition: atltest.h:70
#define free
Definition: debug_ros.c:5
HRESULT hr
Definition: delayimp.cpp:582
#define todo_wine_if(is_todo)
Definition: minitest.h:81
static WCHAR valueW[]
Definition: reg.c:1394
static LPWSTR a2w(LPCSTR str)
Definition: uri.c:8129
const char * value
Definition: uri.c:5721
Uri_PROPERTY property
Definition: uri.c:5723
HRESULT expected
Definition: uri.c:5724

Referenced by test_IUriBuilder().

◆ ClassFactory_AddRef()

static ULONG WINAPI ClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 11196 of file uri.c.

11197{
11198 return 2;
11199}

◆ ClassFactory_CreateInstance()

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

Definition at line 11206 of file uri.c.

11208{
11209 ok(0, "unexpected call\n");
11210 return E_NOTIMPL;
11211}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ClassFactory_LockServer()

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

Definition at line 11213 of file uri.c.

11214{
11215 ok(0, "unexpected call\n");
11216 return S_OK;
11217}

◆ ClassFactory_QueryInterface()

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

Definition at line 11185 of file uri.c.

11186{
11187 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
11188 *ppv = &protocol_info;
11189 return S_OK;
11190 }
11191
11192 ok(0, "unexpected call\n");
11193 return E_NOINTERFACE;
11194}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static IInternetProtocolInfo protocol_info
Definition: uri.c:11183
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ ClassFactory_Release()

static ULONG WINAPI ClassFactory_Release ( IClassFactory iface)
static

Definition at line 11201 of file uri.c.

11202{
11203 return 1;
11204}

◆ compute_expected_props()

static DWORD compute_expected_props ( uri_properties test,
DWORD mask 
)
static

Definition at line 8858 of file uri.c.

8859{
8860 DWORD ret = 0, i;
8861
8862 *mask = 0;
8863
8864 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
8865 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
8866 ret |= 1<<i;
8867 if(test->str_props[i-Uri_PROPERTY_STRING_START].value2 == NULL ||
8868 test->str_props[i-Uri_PROPERTY_STRING_START].expected ==
8869 test->str_props[i-Uri_PROPERTY_STRING_START].expected2)
8870 *mask |= 1<<i;
8871 }
8872
8873 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
8874 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
8875 ret |= 1<<i;
8876 *mask |= 1<<i;
8877 }
8878
8879 return ret;
8880}
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 9011 of file uri.c.

9012{
9013 struct custom_uri *uri = impl_from_IUri(iface);
9014 return IUri_AddRef(uri->uri);
9015}
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 9047 of file uri.c.

9048{
9049 struct custom_uri *uri = impl_from_IUri(iface);
9050 return IUri_GetAbsoluteUri(uri->uri, value);
9051}
Definition: pdh_main.c:96

◆ custom_uri_GetAuthority()

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

Definition at line 9053 of file uri.c.

9054{
9055 struct custom_uri *uri = impl_from_IUri(iface);
9056 return IUri_GetAbsoluteUri(uri->uri, value);
9057}

◆ custom_uri_GetDisplayUri()

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

Definition at line 9059 of file uri.c.

9060{
9061 struct custom_uri *uri = impl_from_IUri(iface);
9062 return IUri_GetAbsoluteUri(uri->uri, value);
9063}

◆ custom_uri_GetDomain()

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

Definition at line 9065 of file uri.c.

9066{
9067 struct custom_uri *uri = impl_from_IUri(iface);
9068 return IUri_GetAbsoluteUri(uri->uri, value);
9069}

◆ custom_uri_GetExtension()

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

Definition at line 9071 of file uri.c.

9072{
9073 struct custom_uri *uri = impl_from_IUri(iface);
9074 return IUri_GetAbsoluteUri(uri->uri, value);
9075}

◆ custom_uri_GetFragment()

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

Definition at line 9077 of file uri.c.

9078{
9079 struct custom_uri *uri = impl_from_IUri(iface);
9080 return IUri_GetAbsoluteUri(uri->uri, value);
9081}

◆ custom_uri_GetHost()

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

Definition at line 9083 of file uri.c.

9084{
9085 struct custom_uri *uri = impl_from_IUri(iface);
9086 return IUri_GetAbsoluteUri(uri->uri, value);
9087}

◆ custom_uri_GetHostType()

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

Definition at line 9137 of file uri.c.

9138{
9139 struct custom_uri *uri = impl_from_IUri(iface);
9140 return IUri_GetHostType(uri->uri, value);
9141}

◆ custom_uri_GetPassword()

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

Definition at line 9089 of file uri.c.

9090{
9091 struct custom_uri *uri = impl_from_IUri(iface);
9092 return IUri_GetAbsoluteUri(uri->uri, value);
9093}

◆ custom_uri_GetPath()

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

Definition at line 9095 of file uri.c.

9096{
9097 struct custom_uri *uri = impl_from_IUri(iface);
9098 return IUri_GetAbsoluteUri(uri->uri, value);
9099}

◆ custom_uri_GetPathAndQuery()

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

Definition at line 9101 of file uri.c.

9102{
9103 struct custom_uri *uri = impl_from_IUri(iface);
9104 return IUri_GetAbsoluteUri(uri->uri, value);
9105}

◆ custom_uri_GetPort()

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

Definition at line 9143 of file uri.c.

9144{
9145 struct custom_uri *uri = impl_from_IUri(iface);
9146 return IUri_GetPort(uri->uri, value);
9147}

◆ custom_uri_GetProperties()

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

Definition at line 9161 of file uri.c.

9162{
9163 struct custom_uri *uri = impl_from_IUri(iface);
9164 return IUri_GetProperties(uri->uri, flags);
9165}

◆ custom_uri_GetPropertyBSTR()

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

Definition at line 9023 of file uri.c.

9024{
9025 struct custom_uri *uri = impl_from_IUri(iface);
9026 return IUri_GetPropertyBSTR(uri->uri, property, value, flags);
9027}

◆ custom_uri_GetPropertyDWORD()

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

Definition at line 9035 of file uri.c.

9036{
9037 struct custom_uri *uri = impl_from_IUri(iface);
9038 return IUri_GetPropertyDWORD(uri->uri, property, value, flags);
9039}

◆ custom_uri_GetPropertyLength()

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

Definition at line 9029 of file uri.c.

9030{
9031 struct custom_uri *uri = impl_from_IUri(iface);
9032 return IUri_GetPropertyLength(uri->uri, property, length, flags);
9033}
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 9107 of file uri.c.

9108{
9109 struct custom_uri *uri = impl_from_IUri(iface);
9110 return IUri_GetAbsoluteUri(uri->uri, value);
9111}

◆ custom_uri_GetRawUri()

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

Definition at line 9113 of file uri.c.

9114{
9115 struct custom_uri *uri = impl_from_IUri(iface);
9116 return IUri_GetAbsoluteUri(uri->uri, value);
9117}

◆ custom_uri_GetScheme()

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

Definition at line 9149 of file uri.c.

9150{
9151 struct custom_uri *uri = impl_from_IUri(iface);
9152 return IUri_GetScheme(uri->uri, value);
9153}

◆ custom_uri_GetSchemeName()

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

Definition at line 9119 of file uri.c.

9120{
9121 struct custom_uri *uri = impl_from_IUri(iface);
9122 return IUri_GetSchemeName(uri->uri, value);
9123}

◆ custom_uri_GetUserInfo()

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

Definition at line 9125 of file uri.c.

9126{
9127 struct custom_uri *uri = impl_from_IUri(iface);
9128 return IUri_GetUserInfo(uri->uri, value);
9129}

◆ custom_uri_GetUserName()

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

Definition at line 9131 of file uri.c.

9132{
9133 struct custom_uri *uri = impl_from_IUri(iface);
9134 return IUri_GetUserName(uri->uri, value);
9135}

◆ custom_uri_GetZone()

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

Definition at line 9155 of file uri.c.

9156{
9157 struct custom_uri *uri = impl_from_IUri(iface);
9158 return IUri_GetZone(uri->uri, value);
9159}

◆ custom_uri_HasProperty()

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

Definition at line 9041 of file uri.c.

9042{
9043 struct custom_uri *uri = impl_from_IUri(iface);
9044 return IUri_HasProperty(uri->uri, property, has_property);
9045}

◆ custom_uri_IsEqual()

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

Definition at line 9167 of file uri.c.

9168{
9169 struct custom_uri *uri = impl_from_IUri(iface);
9170 return IUri_IsEqual(uri->uri, pUri, is_equal);
9171}

◆ custom_uri_QueryInterface()

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

Definition at line 8998 of file uri.c.

8999{
9000 if (IsEqualIID(iid, &IID_IUri) || IsEqualIID(iid, &IID_IUnknown))
9001 {
9002 *out = iface;
9003 IUri_AddRef(iface);
9004 return S_OK;
9005 }
9006
9007 *out = NULL;
9008 return E_NOINTERFACE;
9009}
const GUID IID_IUnknown
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

◆ custom_uri_Release()

static ULONG WINAPI custom_uri_Release ( IUri iface)
static

Definition at line 9017 of file uri.c.

9018{
9019 struct custom_uri *uri = impl_from_IUri(iface);
9020 return IUri_Release(uri->uri);
9021}

◆ 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 8148 of file uri.c.

8148 {
8149 IUri_AddRef(uri);
8150 return IUri_Release(uri);
8151}

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 8993 of file uri.c.

8994{
8995 return CONTAINING_RECORD(iface, struct custom_uri, IUri_iface);
8996}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

◆ InternetProtocolInfo_AddRef()

static ULONG WINAPI InternetProtocolInfo_AddRef ( IInternetProtocolInfo iface)
static

Definition at line 11112 of file uri.c.

11113{
11114 return 2;
11115}

◆ 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 11139 of file uri.c.

11142{
11143 CHECK_EXPECT(CombineUrl);
11144 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
11146 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
11149 "Error: Expected 0, but got 0x%08lx.\n", dwCombineFlags);
11150 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %ld.\n", cchResult);
11151
11152 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
11153 *pcchResult = lstrlenW(combine_resultW);
11154
11155 return S_OK;
11156}
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const WCHAR combine_relativeW[]
Definition: uri.c:88
#define CHECK_EXPECT(func)
Definition: uri.c:49
static const WCHAR combine_resultW[]
Definition: uri.c:89
static const WCHAR combine_baseW[]
Definition: uri.c:86
#define URL_DONT_SIMPLIFY
Definition: shlwapi.h:531
#define URL_FILE_USE_PATHURL
Definition: shlwapi.h:523
#define URL_DONT_UNESCAPE_EXTRA_INFO
Definition: shlwapi.h:539
#define INTERNET_MAX_URL_LENGTH
Definition: wininet.h:51

◆ InternetProtocolInfo_CompareUrl()

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

Definition at line 11158 of file uri.c.

11160{
11161 ok(0, "unexpected call\n");
11162 return E_NOTIMPL;
11163}

◆ 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 11122 of file uri.c.

11125{
11126 CHECK_EXPECT(ParseUrl);
11127 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
11129 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
11130 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08lx, but got 0x%08lx.\n", parse_flags, dwParseFlags);
11131 ok(cchResult == 200, "Error: Got %ld.\n", cchResult);
11132
11133 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
11134 *pcchResult = lstrlenW(parse_resultW);
11135
11136 return S_OK;
11137}
static const WCHAR parse_resultW[]
Definition: uri.c:94
static PARSEACTION parse_action
Definition: uri.c:96
static const WCHAR parse_urlW[]
Definition: uri.c:93
static DWORD parse_flags
Definition: uri.c:97

◆ 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 11165 of file uri.c.

11168{
11169 ok(0, "unexpected call\n");
11170 return E_NOTIMPL;
11171}

◆ InternetProtocolInfo_QueryInterface()

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

Definition at line 11105 of file uri.c.

11107{
11108 ok(0, "unexpected call\n");
11109 return E_NOINTERFACE;
11110}

◆ InternetProtocolInfo_Release()

static ULONG WINAPI InternetProtocolInfo_Release ( IInternetProtocolInfo iface)
static

Definition at line 11117 of file uri.c.

11118{
11119 return 1;
11120}

◆ register_protocols()

static void register_protocols ( void  )
static

Definition at line 11229 of file uri.c.

11230{
11232 HRESULT hres;
11233
11234 hres = pCoInternetGetSession(0, &session, 0);
11235 ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
11236 if(FAILED(hres))
11237 return;
11238
11239 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
11240 winetestW, 0, NULL, 0);
11241 ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
11242
11243 IInternetSession_Release(session);
11244}
#define FAILED(hr)
Definition: intsafe.h:51
static const WCHAR winetestW[]
Definition: uri.c:91
static IClassFactory protocol_cf
Definition: uri.c:11227
#define IID_NULL
Definition: guiddef.h:98

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( uri  )

Definition at line 12124 of file uri.c.

12124 {
12125 HMODULE hurlmon;
12126
12127 hurlmon = GetModuleHandleA("urlmon.dll");
12128 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
12129 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
12130 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
12131 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
12132 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
12133 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
12134 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
12135 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
12136 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
12137
12138 if(!pCreateUri) {
12139 win_skip("CreateUri is not present, skipping tests.\n");
12140 return;
12141 }
12142
12143 trace("test CreateUri invalid flags...\n");
12145
12146 trace("test CreateUri invalid args...\n");
12148
12149 trace("test CreateUri invalid URIs...\n");
12151
12152 trace("test IUri_GetPropertyBSTR...\n");
12154
12155 trace("test IUri_GetPropertyDWORD...\n");
12157
12158 trace("test IUri_GetStrProperties...\n");
12160
12161 trace("test IUri_GetDwordProperties...\n");
12163
12164 trace("test IUri_GetPropertyLength...\n");
12166
12167 trace("test IUri_GetProperties...\n");
12169
12170 trace("test IUri_HasProperty...\n");
12172
12173 trace("test IUri_IsEqual...\n");
12175
12176 trace("test CreateUriWithFragment invalid args...\n");
12178
12179 trace("test CreateUriWithFragment invalid flags...\n");
12181
12182 trace("test CreateUriWithFragment...\n");
12184
12185 trace("test CreateIUriBuilder...\n");
12187
12188 trace("test IUriBuilder_CreateInvalidArgs...\n");
12190
12191 trace("test IUriBuilder...\n");
12193
12194 trace("test IUriBuilder_GetInvalidArgs...\n");
12196
12197 trace("test IUriBuilder_HasBeenModified...\n");
12199
12200 trace("test IUriBuilder_IUriProperty...\n");
12202
12203 trace("test IUriBuilder_RemoveProperties...\n");
12205
12206 trace("test IUriBuilder miscellaneous...\n");
12208
12209 trace("test IUriBuilderFactory...\n");
12211
12212 trace("test CoInternetCombineIUri...\n");
12214
12215 trace("test CoInternetCombineUrlEx...\n");
12217
12218 trace("test CoInternetParseIUri Invalid Args...\n");
12220
12221 trace("test CoInternetParseIUri...\n");
12223
12225
12226 trace("test CoInternetCombineIUri pluggable...\n");
12228
12229 trace("test CoInternetCombineUrlEx Pluggable...\n");
12231
12232 trace("test CoInternetParseIUri pluggable...\n");
12234
12235 trace("test CreateURLMoniker...\n");
12237
12239
12240 trace("test IPersistStream...\n");
12242
12243 trace("test uninitialized Uri...\n");
12245
12248}
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
#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:531
#define win_skip
Definition: minitest.h:67
static void test_IUriBuilder_CreateInvalidArgs(void)
Definition: uri.c:9541
static void test_CreateIUriBuilder(void)
Definition: uri.c:9354
static void test_CoInternetCombineUrlEx_Pluggable(void)
Definition: uri.c:11392
static void test_CreateUri_InvalidUri(void)
Definition: uri.c:8266
static void test_IUriBuilder_HasBeenModified(void)
Definition: uri.c:10568
static void test_IUri_HasProperty(void)
Definition: uri.c:8933
static void test_IUriBuilder_RemoveProperties(void)
Definition: uri.c:10811
static void test_CoInternetParseIUri_Pluggable(void)
Definition: uri.c:11555
static void unregister_protocols(void)
Definition: uri.c:11246
static void test_IUri_GetProperties(void)
Definition: uri.c:8882
static void test_CoInternetParseIUri(void)
Definition: uri.c:11515
static void test_CreateURLMoniker(void)
Definition: uri.c:11708
static void test_CreateUriWithFragment_InvalidArgs(void)
Definition: uri.c:9282
static void test_CoInternetCombineIUri_Pluggable(void)
Definition: uri.c:11261
static void test_IUriBuilder_Misc(void)
Definition: uri.c:10895
static void test_CoInternetCombineIUri(void)
Definition: uri.c:11010
static void test_CreateUri_InvalidFlags(void)
Definition: uri.c:8227
static void test_IUri_GetPropertyBSTR(void)
Definition: uri.c:8286
static void test_IUri_GetDwordProperties(void)
Definition: uri.c:8682
static void test_IUri_GetPropertyDWORD(void)
Definition: uri.c:8362
static void test_CoInternetParseIUri_InvalidArgs(void)
Definition: uri.c:11424
static void test_IUriBuilder_IUriProperty(void)
Definition: uri.c:10674
static void register_protocols(void)
Definition: uri.c:11229
static void test_UninitializedUri(void)
Definition: uri.c:12032
static void test_IUri_GetStrProperties(void)
Definition: uri.c:8417
static void test_IUriBuilder_GetInvalidArgs(void)
Definition: uri.c:9633
static void test_CreateUriWithFragment(void)
Definition: uri.c:9316
static void test_IUriBuilderFactory(void)
Definition: uri.c:10923
static void test_IPersistStream(void)
Definition: uri.c:11801
static void test_IUri_IsEqual(void)
Definition: uri.c:9205
static void test_IUri_GetPropertyLength(void)
Definition: uri.c:8771
static void test_IUriBuilder(void)
Definition: uri.c:10488
static void test_CreateUriWithFragment_InvalidFlags(void)
Definition: uri.c:9302
static void test_CreateUri_InvalidArgs(void)
Definition: uri.c:8241
static void test_CoInternetCombineUrlEx(void)
Definition: uri.c:11300

◆ strcmp_aw()

◆ test_CoInternetCombineIUri()

static void test_CoInternetCombineIUri ( void  )
static

Definition at line 11010 of file uri.c.

11010 {
11011 HRESULT hr;
11012 IUri *base, *relative, *result;
11013 DWORD i;
11014
11015 base = NULL;
11016 hr = pCreateUri(http_urlW, 0, 0, &base);
11017 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08lx.\n", hr);
11018 if(SUCCEEDED(hr)) {
11019 result = (void*) 0xdeadbeef;
11020 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
11021 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
11022 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
11023 }
11024
11025 relative = NULL;
11026 hr = pCreateUri(http_urlW, 0, 0, &relative);
11027 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08lx.\n", hr);
11028 if(SUCCEEDED(hr)) {
11029 result = (void*) 0xdeadbeef;
11030 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
11031 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
11032 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
11033 }
11034
11035 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
11036 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
11037
11038 if(base) IUri_Release(base);
11039 if(relative) IUri_Release(relative);
11040
11041 for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) {
11042 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
11043
11044 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
11045 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08lx on uri_combine_tests[%ld].\n", hr, i);
11046 if(SUCCEEDED(hr)) {
11047 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
11048
11049 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
11050 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08lx on uri_combine_tests[%ld].\n", hr, i);
11051 if(SUCCEEDED(hr)) {
11052 result = NULL;
11053
11054 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
11057 broken(hr == S_OK && uri_combine_tests[i].expected == E_INVALIDARG) /* win10 1607 to 1709 */,
11058 "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].\n",
11061 DWORD j;
11062
11063 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) {
11065 BSTR received;
11066
11067 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
11068 todo_wine_if(prop.todo) {
11069 ok(hr == prop.expected,
11070 "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].str_props[%ld].\n",
11071 hr, prop.expected, i, j);
11072 ok(!strcmp_aw(prop.value, received) ||
11074 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%ld].str_props[%ld].\n",
11075 prop.value, wine_dbgstr_w(received), i, j);
11076 }
11078 }
11079
11080 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) {
11083
11084 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
11085 todo_wine_if(prop.todo) {
11086 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
11087 "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].dword_props[%ld].\n",
11088 hr, prop.expected, i, j);
11089 if(!prop.broken_combine_hres || hr != S_FALSE)
11090 ok(prop.value == received, "Error: Expected %ld, but got %ld instead on uri_combine_tests[%ld].dword_props[%ld].\n",
11091 prop.value, received, i, j);
11092 }
11093 }
11094 }
11095 if(result) IUri_Release(result);
11096 }
11097 if(relative) IUri_Release(relative);
11098 free(relativeW);
11099 }
11100 if(base) IUri_Release(base);
11101 free(baseW);
11102 }
11103}
static WCHAR baseW[MAX_PATH]
Definition: FindFiles.c:24
#define broken(x)
Definition: atltest.h:178
#define ARRAY_SIZE(A)
Definition: main.h:20
#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:2000
static const uri_combine_test uri_combine_tests[]
Definition: uri.c:6855
static const WCHAR http_urlW[]
Definition: uri.c:81
const char * broken_value
Definition: uri.c:6838
const char * value
Definition: uri.c:6835
uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT]
Definition: uri.c:6851
uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT]
Definition: uri.c:6852
HRESULT expected
Definition: uri.c:124
BOOL broken_combine_hres
Definition: uri.c:126
#define S_FALSE
Definition: winerror.h:3451

Referenced by START_TEST().

◆ test_CoInternetCombineIUri_Pluggable()

static void test_CoInternetCombineIUri_Pluggable ( void  )
static

Definition at line 11261 of file uri.c.

11261 {
11262 HRESULT hr;
11263 IUri *base = NULL;
11264
11265 hr = pCreateUri(combine_baseW, 0, 0, &base);
11266 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
11267 if(SUCCEEDED(hr)) {
11268 IUri *relative = NULL;
11269
11270 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
11271 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
11272 if(SUCCEEDED(hr)) {
11273 IUri *result = NULL;
11274
11275 SET_EXPECT(CombineUrl);
11276
11278 &result, 0);
11279 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
11280
11281 CHECK_CALLED(CombineUrl);
11282
11283 if(SUCCEEDED(hr)) {
11284 BSTR received = NULL;
11285 hr = IUri_GetAbsoluteUri(result, &received);
11286 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08lx instead.\n", hr);
11287 if(SUCCEEDED(hr)) {
11288 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
11290 }
11292 }
11293 if(result) IUri_Release(result);
11294 }
11295 if(relative) IUri_Release(relative);
11296 }
11297 if(base) IUri_Release(base);
11298}
#define SET_EXPECT(func)
Definition: uri.c:46
#define CHECK_CALLED(func)
Definition: uri.c:62

Referenced by START_TEST().

◆ test_CoInternetCombineUrlEx()

static void test_CoInternetCombineUrlEx ( void  )
static

Definition at line 11300 of file uri.c.

11300 {
11301 HRESULT hr;
11302 IUri *base, *result;
11303 DWORD i;
11304
11305 base = NULL;
11306 hr = pCreateUri(http_urlW, 0, 0, &base);
11307 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
11308 if(SUCCEEDED(hr)) {
11309 result = (void*) 0xdeadbeef;
11310 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
11311 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n",
11312 hr, E_UNEXPECTED);
11313 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
11314 }
11315
11316 result = (void*) 0xdeadbeef;
11317 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
11318 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n",
11319 hr, E_INVALIDARG);
11320 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
11321
11322 result = (void*) 0xdeadbeef;
11323 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
11324 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n",
11325 hr, E_UNEXPECTED);
11326 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
11327
11328 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
11329 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n",
11330 hr, E_POINTER);
11331 if(base) IUri_Release(base);
11332
11333 for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) {
11334 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
11335
11336 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
11337 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx on uri_combine_tests[%ld].\n", hr, i);
11338 if(SUCCEEDED(hr)) {
11339 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
11340
11341 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
11342 &result, 0);
11345 broken(hr == S_OK && uri_combine_tests[i].expected == E_INVALIDARG) /* win10 1607 to 1709 */,
11346 "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].\n",
11349 DWORD j;
11350
11351 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) {
11353 BSTR received;
11354 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
11355
11356 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
11357 todo_wine_if(prop.todo) {
11358 ok(hr == prop.expected,
11359 "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].str_props[%ld].\n",
11360 hr, prop.expected, i, j);
11363 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%ld].str_props[%ld].\n",
11365 }
11367 }
11368
11369 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) {
11372
11373 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
11374 todo_wine_if(prop.todo) {
11375 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
11376 "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].dword_props[%ld].\n",
11377 hr, prop.expected, i, j);
11378 if(!prop.broken_combine_hres || hr != S_FALSE)
11379 ok(prop.value == received, "Error: Expected %ld, but got %ld instead on uri_combine_tests[%ld].dword_props[%ld].\n",
11380 prop.value, received, i, j);
11381 }
11382 }
11383 }
11384 if(result) IUri_Release(result);
11385 free(relativeW);
11386 }
11387 if(base) IUri_Release(base);
11388 free(baseW);
11389 }
11390}
const char * value_ex
Definition: uri.c:6839
const char * LPCSTR
Definition: typedefs.h:52
#define E_UNEXPECTED
Definition: winerror.h:3528
#define E_POINTER
Definition: winerror.h:3480

Referenced by START_TEST().

◆ test_CoInternetCombineUrlEx_Pluggable()

static void test_CoInternetCombineUrlEx_Pluggable ( void  )
static

Definition at line 11392 of file uri.c.

11392 {
11393 HRESULT hr;
11394 IUri *base = NULL;
11395
11396 hr = pCreateUri(combine_baseW, 0, 0, &base);
11397 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
11398 if(SUCCEEDED(hr)) {
11399 IUri *result = NULL;
11400
11401 SET_EXPECT(CombineUrl);
11402
11404 &result, 0);
11405 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
11406
11407 CHECK_CALLED(CombineUrl);
11408
11409 if(SUCCEEDED(hr)) {
11410 BSTR received = NULL;
11411 hr = IUri_GetAbsoluteUri(result, &received);
11412 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08lx instead.\n", hr);
11413 if(SUCCEEDED(hr)) {
11414 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
11416 }
11418 }
11419 if(result) IUri_Release(result);
11420 }
11421 if(base) IUri_Release(base);
11422}

Referenced by START_TEST().

◆ test_CoInternetParseIUri()

static void test_CoInternetParseIUri ( void  )
static

Definition at line 11515 of file uri.c.

11515 {
11516 DWORD i;
11517
11518 for(i = 0; i < ARRAY_SIZE(uri_parse_tests); ++i) {
11519 HRESULT hr;
11520 IUri *uri;
11521 LPWSTR uriW;
11523
11524 uriW = a2w(test.uri);
11525 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
11526 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx on uri_parse_tests[%ld].\n", hr, i);
11527 if(SUCCEEDED(hr)) {
11529 DWORD result_len = -1;
11530
11531 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
11532 todo_wine_if(test.todo)
11533 ok(hr == test.expected,
11534 "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx on uri_parse_tests[%ld].\n",
11535 hr, test.expected, i);
11536 if(SUCCEEDED(hr)) {
11537 DWORD len = lstrlenA(test.property);
11538 ok(!strcmp_aw(test.property, result) || (test.property2 && !strcmp_aw(test.property2, result)),
11539 "Error: Expected %s but got %s instead on uri_parse_tests[%ld] - %s.\n",
11540 test.property, wine_dbgstr_w(result), i, wine_dbgstr_w(uriW));
11541 ok(len == result_len || (test.property2 && lstrlenA(test.property2) == result_len),
11542 "Error: Expected %ld, but got %ld instead on uri_parse_tests[%ld] - %s.\n",
11543 len, result_len, i, wine_dbgstr_w(uriW));
11544 } else {
11545 ok(!result_len,
11546 "Error: Expected 'result_len' to be 0, but was %ld on uri_parse_tests[%ld].\n",
11547 result_len, i);
11548 }
11549 }
11550 if(uri) IUri_Release(uri);
11551 free(uriW);
11552 }
11553}
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
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:8053

Referenced by START_TEST().

◆ test_CoInternetParseIUri_InvalidArgs()

static void test_CoInternetParseIUri_InvalidArgs ( void  )
static

Definition at line 11424 of file uri.c.

11424 {
11425 HRESULT hr;
11426 IUri *uri = NULL;
11427 WCHAR tmp[3];
11428 WCHAR *longurl, *copy;
11429 DWORD result = -1;
11430 DWORD i, len;
11431
11432 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
11433 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11434 hr, E_INVALIDARG);
11435 ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
11436
11437 hr = pCreateUri(http_urlW, 0, 0, &uri);
11438 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
11439 if(SUCCEEDED(hr)) {
11440 DWORD expected_len;
11441
11442 result = -1;
11443 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
11444 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11445 hr, E_INVALIDARG);
11446 ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
11447
11448 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
11449 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11450 hr, E_POINTER);
11451
11452 result = -1;
11453 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
11454 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08lx expected 0x%08lx.\n",
11455 hr, E_FAIL);
11456 ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
11457
11458 result = -1;
11459 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
11460 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11461 hr, E_FAIL);
11462 ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
11463
11464 result = -1;
11465 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
11466 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11467 hr, E_FAIL);
11468 ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
11469
11470 result = -1;
11471 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
11472 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11473 hr, E_FAIL);
11474 ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
11475
11476 expected_len = lstrlenW(http_urlW);
11477 result = -1;
11478 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
11480 "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11482 ok(result == expected_len, "Error: Expected 'result' to be %ld, but was %ld instead.\n",
11483 expected_len, result);
11484 }
11485 if(uri) IUri_Release(uri);
11486
11487 /* a long url that causes a crash on Wine */
11489 longurl = malloc((len + 1) * sizeof(WCHAR));
11490 memcpy(longurl, http_urlW, sizeof(http_urlW));
11491 for(i = ARRAY_SIZE(http_urlW)-1; i < len; i++)
11492 longurl[i] = 'x';
11493 longurl[len] = 0;
11494
11495 copy = malloc((len + 1) * sizeof(WCHAR));
11496 memcpy(copy, longurl, (len+1)*sizeof(WCHAR));
11497
11498 hr = pCreateUri(longurl, 0, 0, &uri);
11499 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
11500 if(SUCCEEDED(hr)) {
11501 result = -1;
11502 memset(longurl, 0xcc, len*sizeof(WCHAR));
11503 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, longurl, len+1, &result, 0);
11504 ok(SUCCEEDED(hr), "Error: CoInternetParseIUri returned 0x%08lx.\n", hr);
11505 ok(!lstrcmpW(longurl, copy), "Error: expected long url '%s' but was '%s'.\n",
11506 wine_dbgstr_w(copy), wine_dbgstr_w(longurl));
11507 ok(result == len, "Error: Expected 'result' to be %ld, but was %ld instead.\n",
11508 len, result);
11509 }
11510 free(longurl);
11511 free(copy);
11512 if(uri) IUri_Release(uri);
11513}
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 11555 of file uri.c.

11555 {
11556 HRESULT hr;
11557 IUri *uri = NULL;
11558
11559 hr = pCreateUri(parse_urlW, 0, 0, &uri);
11560 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08lx.\n", hr);
11561 if(SUCCEEDED(hr)) {
11562 WCHAR result[200];
11563 DWORD result_len;
11564
11565 SET_EXPECT(ParseUrl);
11566
11567 parse_action = PARSE_CANONICALIZE;
11569
11570 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
11571 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
11572
11573 CHECK_CALLED(ParseUrl);
11574
11575 if(SUCCEEDED(hr)) {
11576 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %ld.\n",
11577 lstrlenW(parse_resultW), result_len);
11578 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
11580 }
11581 }
11582 if(uri) IUri_Release(uri);
11583}
#define URL_ESCAPE_UNSAFE
Definition: shlwapi.h:533
#define URL_UNESCAPE
Definition: shlwapi.h:532

Referenced by START_TEST().

◆ test_CreateIUriBuilder()

static void test_CreateIUriBuilder ( void  )
static

Definition at line 9354 of file uri.c.

9354 {
9355 HRESULT hr;
9356 IUriBuilder *builder = NULL;
9357 IUri *uri;
9358
9359 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
9360 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx\n",
9361 hr, E_POINTER);
9362
9363 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
9364 hr = pCreateUri(http_urlW, 0, 0, &uri);
9365 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9366 if(SUCCEEDED(hr)) {
9367 ULONG cur_count, orig_count;
9368
9369 orig_count = get_refcnt(uri);
9370 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9371 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9372 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
9373
9374 cur_count = get_refcnt(uri);
9375 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %lu, but was %lu instead.\n", orig_count+1, cur_count);
9376
9377 if(builder) IUriBuilder_Release(builder);
9378 cur_count = get_refcnt(uri);
9379 ok(cur_count == orig_count, "Error: Expected the ref count to be %lu, but was %lu instead.\n", orig_count, cur_count);
9380 }
9381 if(uri) IUri_Release(uri);
9382}
static ULONG get_refcnt(IUri *uri)
Definition: uri.c:8148
uint32_t ULONG
Definition: typedefs.h:59

Referenced by START_TEST().

◆ test_CreateUri_InvalidArgs()

static void test_CreateUri_InvalidArgs ( void  )
static

Definition at line 8241 of file uri.c.

8241 {
8242 HRESULT hr;
8243 IUri *uri = (void*) 0xdeadbeef;
8244
8245 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
8246 static const WCHAR emptyW[] = {0};
8247
8248 hr = pCreateUri(http_urlW, 0, 0, NULL);
8249 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx\n", hr, E_INVALIDARG);
8250
8251 hr = pCreateUri(NULL, 0, 0, &uri);
8252 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx\n", hr, E_INVALIDARG);
8253 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
8254
8255 uri = (void*) 0xdeadbeef;
8256 hr = pCreateUri(invalidW, 0, 0, &uri);
8257 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8258 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
8259
8260 uri = (void*) 0xdeadbeef;
8261 hr = pCreateUri(emptyW, 0, 0, &uri);
8262 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8263 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
8264}
static const WCHAR emptyW[]
Definition: navigate.c:40
static const WCHAR invalidW[]
Definition: locale.c:52

Referenced by START_TEST().

◆ test_CreateUri_InvalidFlags()

static void test_CreateUri_InvalidFlags ( void  )
static

Definition at line 8227 of file uri.c.

8227 {
8228 DWORD i;
8229
8230 for(i = 0; i < ARRAY_SIZE(invalid_flag_tests); ++i) {
8231 HRESULT hr;
8232 IUri *uri = (void*) 0xdeadbeef;
8233
8234 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
8235 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx, flags=0x%08lx\n",
8237 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
8238 }
8239}
static const uri_create_flag_test invalid_flag_tests[]
Definition: uri.c:104

Referenced by START_TEST().

◆ test_CreateUri_InvalidUri()

static void test_CreateUri_InvalidUri ( void  )
static

Definition at line 8266 of file uri.c.

8266 {
8267 DWORD i;
8268
8269 for(i = 0; i < ARRAY_SIZE(invalid_uri_tests); ++i) {
8271 IUri *uri = NULL;
8272 LPWSTR uriW;
8273 HRESULT hr;
8274
8275 uriW = a2w(test.uri);
8276 hr = pCreateUri(uriW, test.flags, 0, &uri);
8277 todo_wine_if(test.todo)
8278 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on invalid_uri_tests[%ld].\n",
8279 hr, E_INVALIDARG, i);
8280 if(uri) IUri_Release(uri);
8281
8282 free(uriW);
8283 }
8284}
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:5487

Referenced by START_TEST().

◆ test_CreateUriWithFragment()

static void test_CreateUriWithFragment ( void  )
static

Definition at line 9316 of file uri.c.

9316 {
9317 DWORD i;
9318
9319 for(i = 0; i < ARRAY_SIZE(uri_fragment_tests); ++i) {
9320 HRESULT hr;
9321 IUri *uri = NULL;
9322 LPWSTR uriW, fragW;
9324
9325 uriW = a2w(test.uri);
9326 fragW = a2w(test.fragment);
9327
9328 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
9329 todo_wine_if(test.expected_todo)
9330 ok(hr == test.create_expected,
9331 "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx on uri_fragment_tests[%ld].\n",
9332 hr, test.create_expected, i);
9333
9334 if(SUCCEEDED(hr)) {
9335 BSTR received = NULL;
9336
9337 hr = IUri_GetAbsoluteUri(uri, &received);
9338 todo_wine_if(test.expected_todo) {
9339 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08lx, expected 0x%08lx on uri_fragment_tests[%ld].\n",
9340 hr, S_OK, i);
9341 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%ld].\n",
9342 test.expected_uri, wine_dbgstr_w(received), i);
9343 }
9344
9346 }
9347
9348 if(uri) IUri_Release(uri);
9349 free(uriW);
9350 free(fragW);
9351 }
9352}
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:5699

Referenced by START_TEST().

◆ test_CreateUriWithFragment_InvalidArgs()

static void test_CreateUriWithFragment_InvalidArgs ( void  )
static

Definition at line 9282 of file uri.c.

9282 {
9283 HRESULT hr;
9284 IUri *uri = (void*) 0xdeadbeef;
9285 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
9286
9287 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
9288 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
9289 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9290
9291 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
9292 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
9293
9294 /* Original URI can't already contain a fragment component. */
9295 uri = (void*) 0xdeadbeef;
9296 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
9297 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
9298 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9299}
static const WCHAR http_url_fragW[]
Definition: uri.c:83

Referenced by START_TEST().

◆ test_CreateUriWithFragment_InvalidFlags()

static void test_CreateUriWithFragment_InvalidFlags ( void  )
static

Definition at line 9302 of file uri.c.

9302 {
9303 DWORD i;
9304
9305 for(i = 0; i < ARRAY_SIZE(invalid_flag_tests); ++i) {
9306 HRESULT hr;
9307 IUri *uri = (void*) 0xdeadbeef;
9308
9309 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
9310 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx. flags=0x%08lx.\n",
9312 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9313 }
9314}

Referenced by START_TEST().

◆ test_CreateURLMoniker()

static void test_CreateURLMoniker ( void  )
static

Definition at line 11708 of file uri.c.

11709{
11711 IMoniker *mon, *base_mon;
11712 WCHAR *url, *base_url;
11713 IUri *uri, *base_uri;
11714 HRESULT hres;
11715
11717 url = a2w(test->url);
11718 base_url = a2w(test->base_url);
11719
11720 if(base_url) {
11721 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
11722 ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
11723
11724 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
11725 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08lx\n", hres);
11726 }else {
11727 base_uri = NULL;
11728 base_mon = NULL;
11729 }
11730
11731 hres = CreateURLMoniker(base_mon, url, &mon);
11732 ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
11733 test_urlmon_display_name(mon, test->legacy_url);
11734 test_display_uri(mon, test->legacy_url);
11735 IMoniker_Release(mon);
11736
11737 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
11738 ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
11739 test_urlmon_display_name(mon, test->legacy_url);
11740 test_display_uri(mon, test->legacy_url);
11741 IMoniker_Release(mon);
11742
11743 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
11744 ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
11745 test_urlmon_display_name(mon, test->uniform_url);
11746 test_display_uri(mon, test->uniform_url);
11747 IMoniker_Release(mon);
11748
11749 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
11750 ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
11751 test_urlmon_display_name(mon, test->no_canon_url);
11752 test_display_uri(mon, test->no_canon_url);
11753 IMoniker_Release(mon);
11754
11755 hres = pCreateUri(url, test->uri_flags, 0, &uri);
11756 ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
11757
11758 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
11759 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08lx\n", hres);
11760 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
11761 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
11762 IMoniker_Release(mon);
11763
11764 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
11765 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08lx\n", hres);
11766 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
11767 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
11768 IMoniker_Release(mon);
11769
11770 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
11771 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08lx\n", hres);
11772 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
11773 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
11774 IMoniker_Release(mon);
11775
11776 IUri_Release(uri);
11777 free(url);
11778 free(base_url);
11779 if(base_uri)
11780 IUri_Release(base_uri);
11781 if(base_mon)
11782 IMoniker_Release(base_mon);
11783 }
11784}
static const WCHAR url[]
Definition: encode.c:1384
const WCHAR * base_url
Definition: mimeole.c:1439
#define test_urlmon_display_name(a, b)
Definition: uri.c:11669
#define test_display_uri(a, b)
Definition: uri.c:11683
static const create_urlmon_test_t create_urlmon_tests[]
Definition: uri.c:11596
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 11801 of file uri.c.

11802{
11803 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
11804
11805 props_order[Uri_PROPERTY_RAW_URI] = 1;
11806 props_order[Uri_PROPERTY_FRAGMENT] = 2;
11807 props_order[Uri_PROPERTY_HOST] = 3;
11808 props_order[Uri_PROPERTY_PASSWORD] = 4;
11809 props_order[Uri_PROPERTY_PATH] = 5;
11810 props_order[Uri_PROPERTY_PORT] = 6;
11811 props_order[Uri_PROPERTY_QUERY] = 7;
11812 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
11813 props_order[Uri_PROPERTY_USER_NAME] = 9;
11814
11815 for(i = 0; i < ARRAY_SIZE(uri_tests); i++) {
11816 const uri_properties *test = uri_tests+i;
11817 LPWSTR uriW;
11818 IUri *uri;
11819 IPersistStream *persist_stream;
11820 IStream *stream;
11821 IMarshal *marshal;
11822 DWORD props, props_no, dw_data[6];
11823 WCHAR str_data[1024];
11825 LARGE_INTEGER no_off;
11826 CLSID curi;
11827 BSTR raw_uri;
11828 HRESULT hr;
11829
11830 if(test->create_todo || test->create_expected!=S_OK || test->flags)
11831 continue;
11832
11833 uriW = a2w(test->uri);
11834 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
11835 ok(hr == S_OK, "%d) CreateUri failed 0x%08lx, expected S_OK..\n", i, hr);
11836
11837 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11838 ok(hr == S_OK, "%d) QueryInterface failed 0x%08lx, expected S_OK.\n", i, hr);
11839
11841 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08lx.\n", hr);
11842 hr = IPersistStream_IsDirty(persist_stream);
11843 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08lx, expected S_FALSE.\n", i, hr);
11844 hr = IPersistStream_Save(persist_stream, stream, FALSE);
11845 ok(hr == S_OK, "%d) Save failed 0x%08lx, expected S_OK.\n", i, hr);
11846 hr = IPersistStream_IsDirty(persist_stream);
11847 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08lx, expected S_FALSE.\n", i, hr);
11848 no_off.QuadPart = 0;
11849 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11850 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11851 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11852 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11853 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
11854 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08lx, expected S_OK.\n", i, hr);
11855 ok(size.LowPart+2 == max_size.LowPart,
11856 "%d) Written data size is %ld, max_size %ld.\n",
11857 i, size.LowPart, max_size.LowPart);
11858
11859 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
11860 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11861 ok(dw_data[0]-2 == size.LowPart, "%d) Structure size is %ld, expected %ld\n",
11862 i, dw_data[0]-2, size.LowPart);
11863 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
11864 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11865 ok(dw_data[0] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[0]);
11866 ok(dw_data[1] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[1]);
11867 ok(dw_data[2] == add_default_flags(test->create_flags),
11868 "%d) Incorrect value %lx, expected %x (creation flags).\n",
11869 i, dw_data[2], add_default_flags(test->create_flags));
11870 ok(dw_data[3] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[3]);
11871 ok(dw_data[4] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[4]);
11872 ok(dw_data[5] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[5]);
11873
11874 props_no = 0;
11875 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
11876 if(!props_order[props])
11877 continue;
11878
11879 if(props <= Uri_PROPERTY_STRING_LAST) {
11880 if(test->str_props[props].expected == S_OK)
11881 props_no++;
11882 } else {
11883 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
11884 props_no++;
11885 }
11886 }
11887 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
11888 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
11889 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
11890 props_no = 1;
11891
11892 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
11893 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11894 ok(props == props_no, "%d) Properties no is %ld, expected %ld.\n", i, props, props_no);
11895
11896 dw_data[2] = 0;
11897 dw_data[3] = -1;
11898 while(props) {
11899 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
11900 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11901 props--;
11902 ok(dw_data[2]<props_order[dw_data[0]],
11903 "%d) Incorrect properties order (%ld, %ld)\n",
11904 i, dw_data[0], dw_data[3]);
11905 dw_data[2] = props_order[dw_data[0]];
11906 dw_data[3] = dw_data[0];
11907
11908 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
11909 const uri_str_property *prop = test->str_props+dw_data[0];
11910 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
11911 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11912 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
11913 "%d) Expected %s but got %s (%ld).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
11914 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
11915 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
11916 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %ld (%ld)\n", i, dw_data[1], dw_data[0]);
11917 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
11918 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11919 ok(prop->value == dw_data[1], "%d) Expected %ld but got %ld (%ld).\n", i, prop->value, dw_data[1], dw_data[0]);
11920 } else {
11921 ok(FALSE, "%d) Incorrect property type (%ld)\n", i, dw_data[0]);
11922 break;
11923 }
11924 }
11925 ok(props == 0, "%d) Not all properties were processed %ld. Next property type: %ld\n",
11926 i, props, dw_data[0]);
11927
11928 IUri_Release(uri);
11929
11930 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11931 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11932 hr = IPersistStream_GetClassID(persist_stream, &curi);
11933 ok(hr == S_OK, "%d) GetClassID failed 0x%08lx, expected S_OK.\n", i, hr);
11934 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
11935 IPersistStream_Release(persist_stream);
11936
11937 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11938 &IID_IUri, (void**)&uri);
11939 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08lx.\n", i, hr);
11940 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11941 ok(hr == S_OK, "%d) QueryInterface failed 0x%08lx, expected S_OK.\n", i, hr);
11942 hr = IPersistStream_Load(persist_stream, stream);
11943 ok(hr == S_OK, "%d) Load failed 0x%08lx, expected S_OK.\n", i, hr);
11944 hr = IUri_GetRawUri(uri, &raw_uri);
11945 ok(hr == S_OK, "%d) GetRawUri failed 0x%08lx, expected S_OK.\n", i, hr);
11946 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11947 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11948 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11949 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11950 wine_dbgstr_w(raw_uri));
11951 SysFreeString(raw_uri);
11952 IPersistStream_Release(persist_stream);
11953
11954 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11955 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08lx, expected S_OK.\n", i, hr);
11956 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11957 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11958 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11959 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
11960 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
11961 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11962 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
11963 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
11964 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11965 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
11966 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
11967 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11968 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
11969 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
11970 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11971 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
11972 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
11973 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11974 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
11975 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08lx, expected S_OK.\n", i, hr);
11976 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11977 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
11978 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
11979 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11980 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
11981 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08lx, expected S_OK.\n", i, hr);
11982 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
11983
11984 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11985 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11986 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11987 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11988 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
11989 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11990 ok(dw_data[0]-2 == size.LowPart, "%d) Structure size is %ld, expected %ld\n",
11991 i, dw_data[0]-2, size.LowPart);
11992 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %ld, expected MSHCTX_LOCAL.\n",
11993 i, dw_data[1]);
11994 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %ld, expected %ld (PersistStream size).\n",
11995 i, dw_data[2], dw_data[0]-8);
11996 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
11997 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
11998 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
11999 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
12000 max_size.LowPart += 3*sizeof(DWORD);
12001 ok(dw_data[2] == max_size.LowPart, "%d) Incorrect value %ld, expected %ld (PersistStream size).\n",
12002 i, dw_data[2], max_size.LowPart);
12003 IMarshal_Release(marshal);
12004 IUri_Release(uri);
12005
12006 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
12007 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
12008 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
12009 &IID_IUri, (void**)&uri);
12010 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08lx.\n", i, hr);
12011 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
12012 ok(hr == S_OK, "%d) QueryInterface failed 0x%08lx, expected S_OK.\n", i, hr);
12013 IUri_Release(uri);
12014 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
12015 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08lx, expected S_OK.\n", i, hr);
12016 hr = IUri_GetRawUri(uri, &raw_uri);
12017 ok(hr == S_OK, "%d) GetRawUri failed 0x%08lx, expected S_OK.\n", i, hr);
12018 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
12019 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
12020 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
12021 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
12022 wine_dbgstr_w(raw_uri));
12023 SysFreeString(raw_uri);
12024
12025 IMarshal_Release(marshal);
12026 IStream_Release(stream);
12027 IUri_Release(uri);
12028 free(uriW);
12029 }
12030}
static INT max_size
Definition: history.c:51
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL delete_on_release, IStream **stream)
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:11786
#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:555
@ URL_SCHEME_FTP
Definition: shlwapi.h:545
@ URL_SCHEME_HTTP
Definition: shlwapi.h:546
const char * value
Definition: uri.c:114
const char * broken_value
Definition: uri.c:117
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 8682 of file uri.c.

8682 {
8683 IUri *uri = NULL;
8684 HRESULT hr;
8685 DWORD i;
8686
8687 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
8688 hr = pCreateUri(http_urlW, 0, 0, &uri);
8689 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8690 if(SUCCEEDED(hr)) {
8691 hr = IUri_GetHostType(uri, NULL);
8692 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8693
8694 hr = IUri_GetPort(uri, NULL);
8695 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8696
8697 hr = IUri_GetScheme(uri, NULL);
8698 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8699
8700 hr = IUri_GetZone(uri, NULL);
8701 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8702 }
8703 if(uri) IUri_Release(uri);
8704
8705 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8707 LPWSTR uriW;
8708 uri = NULL;
8709
8710 uriW = a2w(test.uri);
8711 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8712 todo_wine_if(test.create_todo)
8713 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8714 hr, test.create_expected, i);
8715
8716 if(SUCCEEDED(hr)) {
8717 uri_dword_property prop;
8719
8720 /* Assign an insane value so tests don't accidentally pass when
8721 * they shouldn't!
8722 */
8723 received = -9999999;
8724
8725 /* GetHostType() tests. */
8726 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
8727 hr = IUri_GetHostType(uri, &received);
8728 todo_wine_if(prop.todo) {
8729 ok(hr == prop.expected, "Error: GetHostType returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8730 hr, prop.expected, i);
8731 ok(received == prop.value, "Error: Expected %ld but got %ld on uri_tests[%ld].\n", prop.value, received, i);
8732 }
8733 received = -9999999;
8734
8735 /* GetPort() tests. */
8736 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
8737 hr = IUri_GetPort(uri, &received);
8738 todo_wine_if(prop.todo) {
8739 ok(hr == prop.expected, "Error: GetPort returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8740 hr, prop.expected, i);
8741 ok(received == prop.value, "Error: Expected %ld but got %ld on uri_tests[%ld].\n", prop.value, received, i);
8742 }
8743 received = -9999999;
8744
8745 /* GetScheme() tests. */
8746 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
8747 hr = IUri_GetScheme(uri, &received);
8748 todo_wine_if(prop.todo) {
8749 ok(hr == prop.expected, "Error: GetScheme returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8750 hr, prop.expected, i);
8751 ok(received == prop.value, "Error: Expected %ld but got %ld on uri_tests[%ld].\n", prop.value, received, i);
8752 }
8753 received = -9999999;
8754
8755 /* GetZone() tests. */
8756 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
8757 hr = IUri_GetZone(uri, &received);
8758 todo_wine_if(prop.todo) {
8759 ok(hr == prop.expected, "Error: GetZone returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8760 hr, prop.expected, i);
8761 ok(received == prop.value, "Error: Expected %ld but got %ld on uri_tests[%ld].\n", prop.value, received, i);
8762 }
8763 }
8764
8765 if(uri) IUri_Release(uri);
8766
8767 free(uriW);
8768 }
8769}

Referenced by START_TEST().

◆ test_IUri_GetProperties()

static void test_IUri_GetProperties ( void  )
static

Definition at line 8882 of file uri.c.

8882 {
8883 IUri *uri = NULL;
8884 HRESULT hr;
8885 DWORD i;
8886
8887 hr = pCreateUri(http_urlW, 0, 0, &uri);
8888 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8889 if(SUCCEEDED(hr)) {
8890 hr = IUri_GetProperties(uri, NULL);
8891 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8892 }
8893 if(uri) IUri_Release(uri);
8894
8895 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8897 LPWSTR uriW;
8898 uri = NULL;
8899
8900 if (test.flags) continue;
8901
8902 uriW = a2w(test.uri);
8903 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8904 todo_wine_if(test.create_todo)
8905 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, test.create_expected);
8906
8907 if(SUCCEEDED(hr)) {
8908 DWORD received = 0, expected_props, mask;
8909 DWORD j;
8910
8911 hr = IUri_GetProperties(uri, &received);
8912 ok(hr == S_OK, "Error: GetProperties returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8913
8914 expected_props = compute_expected_props(&test, &mask);
8915
8916 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8917 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8918 if(mask & (1 << j)) {
8919 if(expected_props & (1 << j))
8920 ok(received & (1 << j), "Error: Expected flag for property %ld on uri_tests[%ld].\n", j, i);
8921 else
8922 ok(!(received & (1 << j)), "Error: Received flag for property %ld when not expected on uri_tests[%ld].\n", j, i);
8923 }
8924 }
8925 }
8926
8927 if(uri) IUri_Release(uri);
8928
8929 free(uriW);
8930 }
8931}
static DWORD compute_expected_props(uri_properties *test, DWORD *mask)
Definition: uri.c:8858

Referenced by START_TEST().

◆ test_IUri_GetPropertyBSTR()

static void test_IUri_GetPropertyBSTR ( void  )
static

Definition at line 8286 of file uri.c.

8286 {
8287 IUri *uri = NULL;
8288 HRESULT hr;
8289 DWORD i;
8290
8291 /* Make sure GetPropertyBSTR handles invalid args correctly. */
8292 hr = pCreateUri(http_urlW, 0, 0, &uri);
8293 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8294 if(SUCCEEDED(hr)) {
8295 BSTR received = NULL;
8296
8297 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
8298 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8299
8300 /* Make sure it handles an invalid Uri_PROPERTY correctly. */
8301 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
8302 ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08lx, expected E_INVALIDARG or S_OK.\n", hr);
8303 if(SUCCEEDED(hr)) {
8304 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
8305 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
8307 }else {
8308 ok(!received, "received = %s\n", wine_dbgstr_w(received));
8309 }
8310
8311 /* Make sure it handles the ZONE property correctly. */
8312 received = NULL;
8313 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
8314 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08lx, expected 0x%08lx.\n", hr, S_FALSE);
8315 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
8316 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
8318 }
8319 if(uri) IUri_Release(uri);
8320
8321 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8323 LPWSTR uriW;
8324 uri = NULL;
8325
8326 uriW = a2w(test.uri);
8327 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8328 todo_wine_if(test.create_todo)
8329 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx. Failed on uri_tests[%ld].\n",
8330 hr, test.create_expected, i);
8331
8332 if(SUCCEEDED(hr)) {
8333 DWORD j;
8334
8335 /* Checks all the string properties of the uri. */
8336 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
8337 BSTR received = NULL;
8338 uri_str_property prop = test.str_props[j];
8339
8340 hr = IUri_GetPropertyBSTR(uri, j, &received, test.flags);
8341 todo_wine_if(prop.todo) {
8342 ok(hr == prop.expected ||
8343 (prop.value2 && hr == prop.expected2),
8344 "GetPropertyBSTR returned 0x%08lx, expected 0x%08lx. On uri_tests[%ld].str_props[%ld].\n",
8345 hr, prop.expected, i, j);
8346 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)) ||
8348 "Expected %s but got %s on uri_tests[%ld].str_props[%ld].\n",
8349 prop.value, wine_dbgstr_w(received), i, j);
8350 }
8351
8353 }
8354 }
8355
8356 if(uri) IUri_Release(uri);
8357
8358 free(uriW);
8359 }
8360}
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
@ Failed
Definition: arc.h:88
HRESULT expected2
Definition: uri.c:119
const char * value2
Definition: uri.c:118
HRESULT expected
Definition: uri.c:115

Referenced by START_TEST().

◆ test_IUri_GetPropertyDWORD()

static void test_IUri_GetPropertyDWORD ( void  )
static

Definition at line 8362 of file uri.c.

8362 {
8363 IUri *uri = NULL;
8364 HRESULT hr;
8365 DWORD i;
8366
8367 hr = pCreateUri(http_urlW, 0, 0, &uri);
8368 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8369 if(SUCCEEDED(hr)) {
8370 DWORD received = 0xdeadbeef;
8371
8372 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
8373 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8374
8375 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
8376 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8377 ok(received == 0, "Error: Expected received=%d but instead received=%ld.\n", 0, received);
8378 }
8379 if(uri) IUri_Release(uri);
8380
8381 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8383 LPWSTR uriW;
8384 uri = NULL;
8385
8386 uriW = a2w(test.uri);
8387 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8388 todo_wine_if(test.create_todo)
8389 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx. Failed on uri_tests[%ld].\n",
8390 hr, test.create_expected, i);
8391
8392 if(SUCCEEDED(hr)) {
8393 DWORD j;
8394
8395 /* Checks all the DWORD properties of the uri. */
8396 for(j = 0; j < ARRAY_SIZE(test.dword_props); ++j) {
8398 uri_dword_property prop = test.dword_props[j];
8399
8400 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
8401 todo_wine_if(prop.todo) {
8402 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08lx, expected 0x%08lx. On uri_tests[%ld].dword_props[%ld].\n",
8403 hr, prop.expected, i, j);
8404 ok(prop.value == received, "Expected %ld but got %ld on uri_tests[%ld].dword_props[%ld].\n",
8405 prop.value, received, i, j);
8406 }
8407 }
8408 }
8409
8410 if(uri) IUri_Release(uri);
8411
8412 free(uriW);
8413 }
8414}

Referenced by START_TEST().

◆ test_IUri_GetPropertyLength()

static void test_IUri_GetPropertyLength ( void  )
static

Definition at line 8771 of file uri.c.

8771 {
8772 IUri *uri = NULL;
8773 HRESULT hr;
8774 DWORD i;
8775
8776 /* Make sure it handles invalid args correctly. */
8777 hr = pCreateUri(http_urlW, 0, 0, &uri);
8778 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8779 if(SUCCEEDED(hr)) {
8780 DWORD received = 0xdeadbeef;
8781
8782 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
8783 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8784
8785 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
8786 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8787 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08lx.\n", received);
8788 }
8789 if(uri) IUri_Release(uri);
8790
8791 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8793 LPWSTR uriW;
8794 uri = NULL;
8795
8796 uriW = a2w(test.uri);
8797 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8798 todo_wine_if(test.create_todo)
8799 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on uri_test[%ld].\n",
8800 hr, test.create_expected, i);
8801
8802 if(SUCCEEDED(hr)) {
8803 DWORD j;
8804
8805 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
8806 DWORD expectedLen, expectedLen2, receivedLen;
8807 uri_str_property prop = test.str_props[j];
8808 LPWSTR expectedValueW;
8809
8810 if (prop.value)
8811 {
8812 expectedLen = lstrlenA(prop.value);
8813 /* Value may be unicode encoded */
8814 expectedValueW = a2w(prop.value);
8815 expectedLen = lstrlenW(expectedValueW);
8816 free(expectedValueW);
8817 }
8818 else
8819 {
8820 expectedLen = 0;
8821 }
8822
8823 if (prop.value2)
8824 {
8825 expectedLen2 = lstrlenA(prop.value2);
8826 /* Value may be unicode encoded */
8827 expectedValueW = a2w(prop.value2);
8828 expectedLen2 = lstrlenW(expectedValueW);
8829 free(expectedValueW);
8830 }
8831 else
8832 {
8833 expectedLen2 = 0;
8834 }
8835
8836 /* This won't be necessary once GetPropertyLength is implemented. */
8837 receivedLen = -1;
8838
8839 hr = IUri_GetPropertyLength(uri, j, &receivedLen, test.flags);
8840 todo_wine_if(prop.todo) {
8841 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
8842 "Error: GetPropertyLength returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].str_props[%ld].\n",
8843 hr, prop.expected, i, j);
8844 ok(receivedLen == expectedLen || (prop.value2 && receivedLen == expectedLen2) ||
8845 broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8846 "Error: Expected a length of %ld but got %ld on uri_tests[%ld].str_props[%ld].\n",
8847 expectedLen, receivedLen, i, j);
8848 }
8849 }
8850 }
8851
8852 if(uri) IUri_Release(uri);
8853
8854 free(uriW);
8855 }
8856}

Referenced by START_TEST().

◆ test_IUri_GetStrProperties()

static void test_IUri_GetStrProperties ( void  )
static

Definition at line 8417 of file uri.c.

8417 {
8418 IUri *uri = NULL;
8419 HRESULT hr;
8420 DWORD i;
8421
8422 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
8423 hr = pCreateUri(http_urlW, 0, 0, &uri);
8424 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8425 if(SUCCEEDED(hr)) {
8426 hr = IUri_GetAbsoluteUri(uri, NULL);
8427 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8428
8429 hr = IUri_GetAuthority(uri, NULL);
8430 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8431
8432 hr = IUri_GetDisplayUri(uri, NULL);
8433 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8434
8435 hr = IUri_GetDomain(uri, NULL);
8436 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8437
8438 hr = IUri_GetExtension(uri, NULL);
8439 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8440
8441 hr = IUri_GetFragment(uri, NULL);
8442 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8443
8444 hr = IUri_GetHost(uri, NULL);
8445 ok(hr == E_POINTER, "Error: GetHost returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8446
8447 hr = IUri_GetPassword(uri, NULL);
8448 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8449
8450 hr = IUri_GetPath(uri, NULL);
8451 ok(hr == E_POINTER, "Error: GetPath returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8452
8453 hr = IUri_GetPathAndQuery(uri, NULL);
8454 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8455
8456 hr = IUri_GetQuery(uri, NULL);
8457 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8458
8459 hr = IUri_GetRawUri(uri, NULL);
8460 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8461
8462 hr = IUri_GetSchemeName(uri, NULL);
8463 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8464
8465 hr = IUri_GetUserInfo(uri, NULL);
8466 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8467
8468 hr = IUri_GetUserName(uri, NULL);
8469 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8470 }
8471 if(uri) IUri_Release(uri);
8472
8473 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8475 LPWSTR uriW;
8476 uri = NULL;
8477
8478 if (test.flags) continue;
8479
8480 uriW = a2w(test.uri);
8481 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8482 todo_wine_if(test.create_todo)
8483 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8484 hr, test.create_expected, i);
8485
8486 if(SUCCEEDED(hr)) {
8487 uri_str_property prop;
8488 BSTR received = NULL;
8489
8490 /* GetAbsoluteUri() tests. */
8491 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
8492 hr = IUri_GetAbsoluteUri(uri, &received);
8493 todo_wine_if(prop.todo) {
8494 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8495 hr, prop.expected, i);
8497 "Error: Expected %s but got %s on uri_tests[%ld].\n",
8498 prop.value, wine_dbgstr_w(received), i);
8499 }
8501 received = NULL;
8502
8503 /* GetAuthority() tests. */
8504 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
8505 hr = IUri_GetAuthority(uri, &received);
8506 todo_wine_if(prop.todo) {
8507 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8508 hr, prop.expected, i);
8509 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8510 prop.value, wine_dbgstr_w(received), i);
8511 }
8513 received = NULL;
8514
8515 /* GetDisplayUri() tests. */
8516 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
8517 hr = IUri_GetDisplayUri(uri, &received);
8518 todo_wine_if(prop.todo) {
8519 ok(hr == prop.expected,
8520 "Error: GetDisplayUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8521 hr, prop.expected, i);
8522 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received))
8524 "Error: Expected %s but got %s on uri_tests[%ld].\n",
8525 prop.value, wine_dbgstr_w(received), i);
8526 }
8528 received = NULL;
8529
8530 /* GetDomain() tests. */
8531 prop = test.str_props[Uri_PROPERTY_DOMAIN];
8532 hr = IUri_GetDomain(uri, &received);
8533 todo_wine_if(prop.todo) {
8534 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
8535 "Error: GetDomain returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8536 hr, prop.expected, i);
8537 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)),
8538 "Error: Expected %s but got %s on uri_tests[%ld].\n",
8539 prop.value, wine_dbgstr_w(received), i);
8540 }
8542 received = NULL;
8543
8544 /* GetExtension() tests. */
8545 prop = test.str_props[Uri_PROPERTY_EXTENSION];
8546 hr = IUri_GetExtension(uri, &received);
8547 todo_wine_if(prop.todo) {
8548 ok(hr == prop.expected, "Error: GetExtension returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8549 hr, prop.expected, i);
8550 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8551 prop.value, wine_dbgstr_w(received), i);
8552 }
8554 received = NULL;
8555
8556 /* GetFragment() tests. */
8557 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
8558 hr = IUri_GetFragment(uri, &received);
8559 todo_wine_if(prop.todo) {
8560 ok(hr == prop.expected, "Error: GetFragment returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8561 hr, prop.expected, i);
8562 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8563 prop.value, wine_dbgstr_w(received), i);
8564 }
8566 received = NULL;
8567
8568 /* GetHost() tests. */
8569 prop = test.str_props[Uri_PROPERTY_HOST];
8570 hr = IUri_GetHost(uri, &received);
8571 todo_wine_if(prop.todo) {
8572 ok(hr == prop.expected, "Error: GetHost returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8573 hr, prop.expected, i);
8574 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8575 prop.value, wine_dbgstr_w(received), i);
8576 }
8578 received = NULL;
8579
8580 /* GetPassword() tests. */
8581 prop = test.str_props[Uri_PROPERTY_PASSWORD];
8582 hr = IUri_GetPassword(uri, &received);
8583 todo_wine_if(prop.todo) {
8584 ok(hr == prop.expected, "Error: GetPassword returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8585 hr, prop.expected, i);
8586 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8587 prop.value, wine_dbgstr_w(received), i);
8588 }
8590 received = NULL;
8591
8592 /* GetPath() tests. */
8593 prop = test.str_props[Uri_PROPERTY_PATH];
8594 hr = IUri_GetPath(uri, &received);
8595 todo_wine_if(prop.todo) {
8596 ok(hr == prop.expected, "Error: GetPath returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8597 hr, prop.expected, i);
8598 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8599 prop.value, wine_dbgstr_w(received), i);
8600 }
8602 received = NULL;
8603
8604 /* GetPathAndQuery() tests. */
8605 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
8606 hr = IUri_GetPathAndQuery(uri, &received);
8607 todo_wine_if(prop.todo) {
8608 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8609 hr, prop.expected, i);
8610 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8611 prop.value, wine_dbgstr_w(received), i);
8612 }
8614 received = NULL;
8615
8616 /* GetQuery() tests. */
8617 prop = test.str_props[Uri_PROPERTY_QUERY];
8618 hr = IUri_GetQuery(uri, &received);
8619 todo_wine_if(prop.todo) {
8620 ok(hr == prop.expected, "Error: GetQuery returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8621 hr, prop.expected, i);
8622 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8623 prop.value, wine_dbgstr_w(received), i);
8624 }
8626 received = NULL;
8627
8628 /* GetRawUri() tests. */
8629 prop = test.str_props[Uri_PROPERTY_RAW_URI];
8630 hr = IUri_GetRawUri(uri, &received);
8631 todo_wine_if(prop.todo) {
8632 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8633 hr, prop.expected, i);
8634 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8635 prop.value, wine_dbgstr_w(received), i);
8636 }
8638 received = NULL;
8639
8640 /* GetSchemeName() tests. */
8641 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
8642 hr = IUri_GetSchemeName(uri, &received);
8643 todo_wine_if(prop.todo) {
8644 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8645 hr, prop.expected, i);
8646 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8647 prop.value, wine_dbgstr_w(received), i);
8648 }
8650 received = NULL;
8651
8652 /* GetUserInfo() tests. */
8653 prop = test.str_props[Uri_PROPERTY_USER_INFO];
8654 hr = IUri_GetUserInfo(uri, &received);
8655 todo_wine_if(prop.todo) {
8656 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8657 hr, prop.expected, i);
8658 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8659 prop.value, wine_dbgstr_w(received), i);
8660 }
8662 received = NULL;
8663
8664 /* GetUserName() tests. */
8665 prop = test.str_props[Uri_PROPERTY_USER_NAME];
8666 hr = IUri_GetUserName(uri, &received);
8667 todo_wine_if(prop.todo) {
8668 ok(hr == prop.expected, "Error: GetUserName returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8669 hr, prop.expected, i);
8670 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8671 prop.value, wine_dbgstr_w(received), i);
8672 }
8674 }
8675
8676 if(uri) IUri_Release(uri);
8677
8678 free(uriW);
8679 }
8680}

Referenced by START_TEST().

◆ test_IUri_HasProperty()

static void test_IUri_HasProperty ( void  )
static

Definition at line 8933 of file uri.c.

8933 {
8934 IUri *uri = NULL;
8935 HRESULT hr;
8936 DWORD i;
8937
8938 hr = pCreateUri(http_urlW, 0, 0, &uri);
8939 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8940 if(SUCCEEDED(hr)) {
8941 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
8942 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8943 }
8944 if(uri) IUri_Release(uri);
8945
8946 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8948 LPWSTR uriW;
8949 uri = NULL;
8950
8951 if (test.flags) continue;
8952
8953 uriW = a2w(test.uri);
8954
8955 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8956 todo_wine_if(test.create_todo)
8957 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, test.create_expected);
8958
8959 if(SUCCEEDED(hr)) {
8960 DWORD expected_props, j, mask;
8961
8962 expected_props = compute_expected_props(&test, &mask);
8963
8964 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8965 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8966 BOOL received = -1;
8967
8968 hr = IUri_HasProperty(uri, j, &received);
8969 ok(hr == S_OK, "Error: HasProperty returned 0x%08lx, expected 0x%08lx for property %ld on uri_tests[%ld].\n",
8970 hr, S_OK, j, i);
8971
8972 if(mask & (1 << j)) {
8973 if(expected_props & (1 << j)) {
8974 ok(received == TRUE, "Error: Expected to have property %ld on uri_tests[%ld].\n", j, i);
8975 } else {
8976 ok(received == FALSE, "Error: Wasn't expecting to have property %ld on uri_tests[%ld].\n", j, i);
8977 }
8978 }
8979 }
8980 }
8981
8982 if(uri) IUri_Release(uri);
8983
8984 free(uriW);
8985 }
8986}
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 9205 of file uri.c.

9205 {
9206 struct custom_uri custom_uri;
9207 IUri *uriA, *uriB;
9208 BOOL equal;
9209 HRESULT hres;
9210 DWORD i;
9211
9212 uriA = uriB = NULL;
9213
9214 /* Make sure IsEqual handles invalid args correctly. */
9215 hres = pCreateUri(http_urlW, 0, 0, &uriA);
9216 ok(hres == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
9217 hres = pCreateUri(http_urlW, 0, 0, &uriB);
9218 ok(hres == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
9219
9220 equal = -1;
9221 hres = IUri_IsEqual(uriA, NULL, &equal);
9222 ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
9223 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
9224
9225 hres = IUri_IsEqual(uriA, uriB, NULL);
9226 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08lx, expected 0x%08lx.\n", hres, E_POINTER);
9227
9228 equal = FALSE;
9229 hres = IUri_IsEqual(uriA, uriA, &equal);
9230 ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
9231 ok(equal, "Error: Expected equal URIs.\n");
9232
9233 equal = FALSE;
9234 hres = IUri_IsEqual(uriA, uriB, &equal);
9235 ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
9236 ok(equal, "Error: Expected equal URIs.\n");
9237
9238 IUri_Release(uriA);
9239 IUri_Release(uriB);
9240
9242
9243 for(i = 0; i < ARRAY_SIZE(equality_tests); ++i) {
9245 LPWSTR uriA_W, uriB_W;
9246
9247 uriA = uriB = NULL;
9248
9249 uriA_W = a2w(test.a);
9250 uriB_W = a2w(test.b);
9251
9252 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
9253 ok(hres == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on equality_tests[%ld].a\n", hres, S_OK, i);
9254
9255 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
9256 ok(hres == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on equality_tests[%ld].b\n", hres, S_OK, i);
9257
9258 equal = -1;
9259 hres = IUri_IsEqual(uriA, uriB, &equal);
9260 todo_wine_if(test.todo) {
9261 ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx on equality_tests[%ld].\n", hres, S_OK, i);
9262 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%ld].\n", test.equal, i);
9263 }
9264
9265 custom_uri.uri = uriB;
9266
9267 equal = -1;
9268 hres = IUri_IsEqual(uriA, &custom_uri.IUri_iface, &equal);
9269 todo_wine {
9270 ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx on equality_tests[%ld].\n", hres, S_OK, i);
9271 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%ld].\n", test.equal, i);
9272 }
9273
9274 if(uriA) IUri_Release(uriA);
9275 if(uriB) IUri_Release(uriB);
9276
9277 free(uriA_W);
9278 free(uriB_W);
9279 }
9280}
#define todo_wine
Definition: minitest.h:80
static const uri_equality equality_tests[]
Definition: uri.c:5557
static const IUriVtbl custom_uri_vtbl
Definition: uri.c:9173
#define equal(x, y)
Definition: reader.cc:56
IUri IUri_iface
Definition: uri.c:8989
IUri * uri
Definition: uri.c:8990

Referenced by START_TEST().

◆ test_IUriBuilder()

static void test_IUriBuilder ( void  )
static

Definition at line 10488 of file uri.c.

10488 {
10489 HRESULT hr;
10490 IUriBuilder *builder;
10491 DWORD i;
10492
10493 for(i = 0; i < ARRAY_SIZE(uri_builder_tests); ++i) {
10494 IUri *uri = NULL;
10496 LPWSTR uriW = NULL;
10497
10498 if(test.uri) {
10499 uriW = a2w(test.uri);
10500 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10501 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10502 hr, S_OK, i);
10503 if(FAILED(hr)) continue;
10504 }
10505 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10506 todo_wine_if(test.create_builder_todo)
10507 ok(hr == test.create_builder_expected,
10508 "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10509 hr, test.create_builder_expected, i);
10510 if(SUCCEEDED(hr)) {
10511 DWORD j;
10512 BOOL modified = FALSE, received = FALSE;
10513
10514 /* Perform all the string property changes. */
10515 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
10516 uri_builder_property prop = test.properties[j];
10517 if(prop.change) {
10518 change_property(builder, &prop, i);
10519 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
10520 prop.property != Uri_PROPERTY_HOST)
10521 modified = TRUE;
10522 else if(prop.value && *prop.value)
10523 modified = TRUE;
10524 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
10525 /* Host name property can't be NULL, but it can be empty. */
10526 modified = TRUE;
10527 }
10528 }
10529
10530 if(test.port_prop.change) {
10531 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
10532 modified = TRUE;
10533 todo_wine_if(test.port_prop.todo)
10534 ok(hr == test.port_prop.expected,
10535 "Error: IUriBuilder_SetPort returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10536 hr, test.port_prop.expected, i);
10537 }
10538
10539 hr = IUriBuilder_HasBeenModified(builder, &received);
10540 ok(hr == S_OK,
10541 "Error IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10542 hr, S_OK, i);
10543 if(SUCCEEDED(hr))
10544 ok(received == modified,
10545 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%ld].\n",
10546 modified, received, i);
10547
10548 /* Test the "Get*" functions. */
10550 test_IUriBuilder_GetHost(builder, &test, i);
10552 test_IUriBuilder_GetPath(builder, &test, i);
10553 test_IUriBuilder_GetPort(builder, &test, i);
10554 test_IUriBuilder_GetQuery(builder, &test, i);
10557
10558 test_IUriBuilder_CreateUri(builder, &test, i);
10561 }
10562 if(builder) IUriBuilder_Release(builder);
10563 if(uri) IUri_Release(uri);
10564 free(uriW);
10565 }
10566}
BOOLEAN Expected
HRESULT WINAPI CreateIUriBuilder(IUri *pIUri, DWORD dwFlags, DWORD_PTR dwReserved, IUriBuilder **ppIUriBuilder)
Definition: uri.c:6353
#define d
Definition: ke_i.h:81
#define URI_BUILDER_STR_PROPERTY_COUNT
Definition: uri.c:41
static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9488
static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9384
static void change_property(IUriBuilder *builder, const uri_builder_property *prop, DWORD test_index)
Definition: uri.c:8153
static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:10392
static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:10135
static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9850
static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9945
static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:10040
static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:10202
static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:10297
static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9755
static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test, DWORD test_index)
Definition: uri.c:9436
static const uri_builder_test uri_builder_tests[]
Definition: uri.c:5776

Referenced by START_TEST().

◆ test_IUriBuilder_CreateInvalidArgs()

static void test_IUriBuilder_CreateInvalidArgs ( void  )
static

Definition at line 9541 of file uri.c.

9541 {
9542 IUriBuilder *builder;
9543 HRESULT hr;
9544
9545 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9546 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9547 if(SUCCEEDED(hr)) {
9548 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
9549
9550 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
9551 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
9552 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
9553
9554 uri = (void*) 0xdeadbeef;
9555 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9556 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_NOTIMPL);
9557 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
9558
9559 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
9560 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n",
9561 hr, E_POINTER);
9562
9563 uri = (void*) 0xdeadbeef;
9564 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9565 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n",
9566 hr, E_NOTIMPL);
9567 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
9568
9569 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
9570 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
9571 hr, E_POINTER);
9572
9573 uri = (void*) 0xdeadbeef;
9574 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
9575 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
9576 hr, E_NOTIMPL);
9577 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9578
9579 hr = pCreateUri(http_urlW, 0, 0, &test);
9580 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9581 if(SUCCEEDED(hr)) {
9582 hr = IUriBuilder_SetIUri(builder, test);
9583 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9584
9585 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
9586 uri = NULL;
9587 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9588 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9589 ok(uri != NULL, "Error: The uri was NULL.\n");
9590 if(uri) IUri_Release(uri);
9591
9592 uri = NULL;
9593 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9594 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n",
9595 hr, S_OK);
9596 ok(uri != NULL, "Error: uri was NULL.\n");
9597 if(uri) IUri_Release(uri);
9598
9599 uri = NULL;
9600 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
9601 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
9602 hr, S_OK);
9603 ok(uri != NULL, "Error: uri was NULL.\n");
9604 if(uri) IUri_Release(uri);
9605
9606 hr = IUriBuilder_SetFragment(builder, NULL);
9607 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9608
9609 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
9610 uri = (void*) 0xdeadbeef;
9611 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9612 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9613 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
9614
9615 uri = (void*) 0xdeadbeef;
9616 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9617 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n",
9618 hr, S_OK);
9619 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9620
9621 uri = (void*) 0xdeadbeef;
9622 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
9623 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
9624 hr, E_NOTIMPL);
9625 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9626 }
9627 if(test) IUri_Release(test);
9628 }
9629 if(builder) IUriBuilder_Release(builder);
9630}

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 9384 of file uri.c.

9385 {
9386 HRESULT hr;
9387 IUri *uri = NULL;
9388
9389 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
9390 todo_wine_if(test->uri_todo)
9391 ok(hr == test->uri_hres,
9392 "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9393 hr, test->uri_hres, test_index);
9394
9395 if(SUCCEEDED(hr)) {
9396 DWORD i;
9397
9398 for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) {
9399 uri_builder_str_property prop = test->expected_str_props[i];
9400 BSTR received = NULL;
9401
9402 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
9403 todo_wine_if(prop.todo)
9404 ok(hr == prop.result,
9405 "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_str_props[%ld].\n",
9406 hr, prop.result, test_index, i);
9407 if(SUCCEEDED(hr)) {
9408 todo_wine_if(prop.todo)
9409 ok(!strcmp_aw(prop.expected, received),
9410 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].expected_str_props[%ld].\n",
9411 prop.expected, wine_dbgstr_w(received), test_index, i);
9412 }
9414 }
9415
9416 for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) {
9417 uri_builder_dword_property prop = test->expected_dword_props[i];
9418 DWORD received = -2;
9419
9420 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
9421 todo_wine_if(prop.todo)
9422 ok(hr == prop.result,
9423 "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
9424 hr, prop.result, test_index, i);
9425 if(SUCCEEDED(hr)) {
9426 todo_wine_if(prop.todo)
9427 ok(received == prop.expected,
9428 "Error: Expected %ld but got %ld instead on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
9429 prop.expected, received, test_index, i);
9430 }
9431 }
9432 }
9433 if(uri) IUri_Release(uri);
9434}
GLdouble s
Definition: gl.h:2039
for(i=0;i< sizeof(testsuite)/sizeof(testsuite[0]);++i) ok(call_test(testsuite[i].func)

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 9436 of file uri.c.

9437 {
9438 HRESULT hr;
9439 IUri *uri = NULL;
9440
9441 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
9442 todo_wine_if(test->uri_simple_todo)
9443 ok(hr == test->uri_simple_hres,
9444 "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9445 hr, test->uri_simple_hres, test_index);
9446
9447 if(SUCCEEDED(hr)) {
9448 DWORD i;
9449
9450 for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) {
9451 uri_builder_str_property prop = test->expected_str_props[i];
9452 BSTR received = NULL;
9453
9454 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
9455 todo_wine_if(prop.todo)
9456 ok(hr == prop.result,
9457 "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_str_props[%ld].\n",
9458 hr, prop.result, test_index, i);
9459 if(SUCCEEDED(hr)) {
9460 todo_wine_if(prop.todo)
9461 ok(!strcmp_aw(prop.expected, received),
9462 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].expected_str_props[%ld].\n",
9463 prop.expected, wine_dbgstr_w(received), test_index, i);
9464 }
9466 }
9467
9468 for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) {
9469 uri_builder_dword_property prop = test->expected_dword_props[i];
9470 DWORD received = -2;
9471
9472 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
9473 todo_wine_if(prop.todo)
9474 ok(hr == prop.result,
9475 "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
9476 hr, prop.result, test_index, i);
9477 if(SUCCEEDED(hr)) {
9478 todo_wine_if(prop.todo)
9479 ok(received == prop.expected,
9480 "Error: Expected %ld but got %ld instead on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
9481 prop.expected, received, test_index, i);
9482 }
9483 }
9484 }
9485 if(uri) IUri_Release(uri);
9486}

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 9488 of file uri.c.

9489 {
9490 HRESULT hr;
9491 IUri *uri = NULL;
9492
9493 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
9494 test->uri_with_encode_flags, 0, &uri);
9495 todo_wine_if(test->uri_with_todo)
9496 ok(hr == test->uri_with_hres,
9497 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9498 hr, test->uri_with_hres, test_index);
9499
9500 if(SUCCEEDED(hr)) {
9501 DWORD i;
9502
9503 for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) {
9504 uri_builder_str_property prop = test->expected_str_props[i];
9505 BSTR received = NULL;
9506
9507 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
9508 todo_wine_if(prop.todo)
9509 ok(hr == prop.result,
9510 "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_str_props[%ld].\n",
9511 hr, prop.result, test_index, i);
9512 if(SUCCEEDED(hr)) {
9513 todo_wine_if(prop.todo)
9514 ok(!strcmp_aw(prop.expected, received),
9515 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].expected_str_props[%ld].\n",
9516 prop.expected, wine_dbgstr_w(received), test_index, i);
9517 }
9519 }
9520
9521 for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) {
9522 uri_builder_dword_property prop = test->expected_dword_props[i];
9523 DWORD received = -2;
9524
9525 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
9526 todo_wine_if(prop.todo)
9527 ok(hr == prop.result,
9528 "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
9529 hr, prop.result, test_index, i);
9530 if(SUCCEEDED(hr)) {
9531 todo_wine_if(prop.todo)
9532 ok(received == prop.expected,
9533 "Error: Expected %ld but got %ld instead on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
9534 prop.expected, received, test_index, i);
9535 }
9536 }
9537 }
9538 if(uri) IUri_Release(uri);
9539}

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 9755 of file uri.c.

9756 {
9757 HRESULT hr;
9758 DWORD i;
9760 DWORD len = -1;
9761 const uri_builder_property *prop = NULL;
9762
9763 /* Check if the property was set earlier. */
9764 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9765 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
9766 prop = &(test->properties[i]);
9767 }
9768
9769 if(prop) {
9770 /* Use expected_value unless it's NULL, then use value. */
9771 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9772 DWORD expected_len = expected ? strlen(expected) : 0;
9773 hr = IUriBuilder_GetFragment(builder, &len, &received);
9774 todo_wine_if(prop->todo) {
9775 ok(hr == (expected ? S_OK : S_FALSE),
9776 "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9777 hr, (expected ? S_OK : S_FALSE), test_index);
9778 if(SUCCEEDED(hr)) {
9779 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
9780 expected, wine_dbgstr_w(received), test_index);
9781 ok(expected_len == len,
9782 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
9783 expected_len, len, test_index);
9784 }
9785 }
9786 } else {
9787 /* The property wasn't set earlier, so it should return whatever
9788 * the base IUri contains (if anything).
9789 */
9790 IUri *uri = NULL;
9791 hr = IUriBuilder_GetIUri(builder, &uri);
9792 ok(hr == S_OK,
9793 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9794 hr, S_OK, test_index);
9795 if(SUCCEEDED(hr)) {
9796 if(!uri) {
9797 received = (void*) 0xdeadbeef;
9798 len = -1;
9799
9800 hr = IUriBuilder_GetFragment(builder, &len, &received);
9801 ok(hr == S_FALSE,
9802 "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9803 hr, S_FALSE, test_index);
9804 if(SUCCEEDED(hr)) {
9805 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9806 len, test_index);
9807 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
9808 received, test_index);
9809 }
9810 } else {
9811 BOOL has_prop = FALSE;
9812 BSTR expected = NULL;
9813
9814 hr = IUri_GetFragment(uri, &expected);
9815 ok(SUCCEEDED(hr),
9816 "Error: Expected IUri_GetFragment to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
9817 hr, test_index);
9818 has_prop = hr == S_OK;
9819
9820 hr = IUriBuilder_GetFragment(builder, &len, &received);
9821 if(has_prop) {
9822 ok(hr == S_OK,
9823 "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9824 hr, S_OK, test_index);
9825 if(SUCCEEDED(hr)) {
9827 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
9829 ok(lstrlenW(expected) == len,
9830 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
9831 lstrlenW(expected), len, test_index);
9832 }
9833 } else {
9834 ok(hr == S_FALSE,
9835 "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9836 hr, S_FALSE, test_index);
9837 if(SUCCEEDED(hr)) {
9838 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
9839 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9840 len, test_index);
9841 }
9842 }
9844 }
9845 }
9846 if(uri) IUri_Release(uri);
9847 }
9848}
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
const char * expected_value
Definition: uri.c:5722
const uint16_t * LPCWSTR
Definition: typedefs.h:57

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 9850 of file uri.c.

9851 {
9852 HRESULT hr;
9853 DWORD i;
9855 DWORD len = -1;
9856 const uri_builder_property *prop = NULL;
9857
9858 /* Check if the property was set earlier. */
9859 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9860 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
9861 prop = &(test->properties[i]);
9862 }
9863
9864 if(prop) {
9865 /* Use expected_value unless it's NULL, then use value. */
9866 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9867 DWORD expected_len = expected ? strlen(expected) : 0;
9868 hr = IUriBuilder_GetHost(builder, &len, &received);
9869 todo_wine_if(prop->todo) {
9870 ok(hr == (expected ? S_OK : S_FALSE),
9871 "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9872 hr, (expected ? S_OK : S_FALSE), test_index);
9873 if(SUCCEEDED(hr)) {
9874 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
9875 expected, wine_dbgstr_w(received), test_index);
9876 ok(expected_len == len,
9877 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
9878 expected_len, len, test_index);
9879 }
9880 }
9881 } else {
9882 /* The property wasn't set earlier, so it should return whatever
9883 * the base IUri contains (if anything).
9884 */
9885 IUri *uri = NULL;
9886 hr = IUriBuilder_GetIUri(builder, &uri);
9887 ok(hr == S_OK,
9888 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9889 hr, S_OK, test_index);
9890 if(SUCCEEDED(hr)) {
9891 if(!uri) {
9892 received = (void*) 0xdeadbeef;
9893 len = -1;
9894
9895 hr = IUriBuilder_GetHost(builder, &len, &received);
9896 ok(hr == S_FALSE,
9897 "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9898 hr, S_FALSE, test_index);
9899 if(SUCCEEDED(hr)) {
9900 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9901 len, test_index);
9902 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
9903 received, test_index);
9904 }
9905 } else {
9906 BOOL has_prop = FALSE;
9907 BSTR expected = NULL;
9908
9909 hr = IUri_GetHost(uri, &expected);
9910 ok(SUCCEEDED(hr),
9911 "Error: Expected IUri_GetHost to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
9912 hr, test_index);
9913 has_prop = hr == S_OK;
9914
9915 hr = IUriBuilder_GetHost(builder, &len, &received);
9916 if(has_prop) {
9917 ok(hr == S_OK,
9918 "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9919 hr, S_OK, test_index);
9920 if(SUCCEEDED(hr)) {
9922 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
9924 ok(lstrlenW(expected) == len,
9925 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
9926 lstrlenW(expected), len, test_index);
9927 }
9928 } else {
9929 ok(hr == S_FALSE,
9930 "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9931 hr, S_FALSE, test_index);
9932 if(SUCCEEDED(hr)) {
9933 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
9934 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9935 len, test_index);
9936 }
9937 }
9939 }
9940 }
9941 if(uri) IUri_Release(uri);
9942 }
9943}

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_GetInvalidArgs()

static void test_IUriBuilder_GetInvalidArgs ( void  )
static

Definition at line 9633 of file uri.c.

9633 {
9634 IUriBuilder *builder = NULL;
9635 HRESULT hr;
9636
9637 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9638 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9639 if(SUCCEEDED(hr)) {
9640 LPCWSTR received = (void*) 0xdeadbeef;
9641 DWORD len = -1, port = -1;
9642 BOOL set = -1;
9643
9644 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
9645 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx.\n",
9646 hr, E_POINTER);
9647 hr = IUriBuilder_GetFragment(builder, NULL, &received);
9648 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx.\n",
9649 hr, E_POINTER);
9650 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9651 hr = IUriBuilder_GetFragment(builder, &len, NULL);
9652 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx.\n",
9653 hr, E_POINTER);
9654 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9655
9656 hr = IUriBuilder_GetHost(builder, NULL, NULL);
9657 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n",
9658 hr, E_POINTER);
9659 received = (void*) 0xdeadbeef;
9660 hr = IUriBuilder_GetHost(builder, NULL, &received);
9661 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n",
9662 hr, E_POINTER);
9663 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9664 len = -1;
9665 hr = IUriBuilder_GetHost(builder, &len, NULL);
9666 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n",
9667 hr, E_POINTER);
9668 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9669
9670 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
9671 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx.\n",
9672 hr, E_POINTER);
9673 received = (void*) 0xdeadbeef;
9674 hr = IUriBuilder_GetPassword(builder, NULL, &received);
9675 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx.\n",
9676 hr, E_POINTER);
9677 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9678 len = -1;
9679 hr = IUriBuilder_GetPassword(builder, &len, NULL);
9680 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx.\n",
9681 hr, E_POINTER);
9682 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9683
9684 hr = IUriBuilder_GetPath(builder, NULL, NULL);
9685 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx.\n",
9686 hr, E_POINTER);
9687 received = (void*) 0xdeadbeef;
9688 hr = IUriBuilder_GetPath(builder, NULL, &received);
9689 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx.\n",
9690 hr, E_POINTER);
9691 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9692 len = -1;
9693 hr = IUriBuilder_GetPath(builder, &len, NULL);
9694 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx.\n",
9695 hr, E_POINTER);
9696 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9697
9698 hr = IUriBuilder_GetPort(builder, NULL, NULL);
9699 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx.\n",
9700 hr, E_POINTER);
9701 hr = IUriBuilder_GetPort(builder, NULL, &port);
9702 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx.\n",
9703 hr, E_POINTER);
9704 ok(!port, "Error: Expected port to be 0, but was %ld instead.\n", port);
9705 hr = IUriBuilder_GetPort(builder, &set, NULL);
9706 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx.\n",
9707 hr, E_POINTER);
9708 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
9709
9710 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
9711 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx.\n",
9712 hr, E_POINTER);
9713 received = (void*) 0xdeadbeef;
9714 hr = IUriBuilder_GetQuery(builder, NULL, &received);
9715 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx.\n",
9716 hr, E_POINTER);
9717 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9718 len = -1;
9719 hr = IUriBuilder_GetQuery(builder, &len, NULL);
9720 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx.\n",
9721 hr, E_POINTER);
9722 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9723
9724 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
9725 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx.\n",
9726 hr, E_POINTER);
9727 received = (void*) 0xdeadbeef;
9728 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
9729 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx.\n",
9730 hr, E_POINTER);
9731 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9732 len = -1;
9733 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
9734 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx.\n",
9735 hr, E_POINTER);
9736 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9737
9738 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
9739 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx.\n",
9740 hr, E_POINTER);
9741 received = (void*) 0xdeadbeef;
9742 hr = IUriBuilder_GetUserName(builder, NULL, &received);
9743 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx.\n",
9744 hr, E_POINTER);
9745 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9746 len = -1;
9747 hr = IUriBuilder_GetUserName(builder, &len, NULL);
9748 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx.\n",
9749 hr, E_POINTER);
9750 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9751 }
9752 if(builder) IUriBuilder_Release(builder);
9753}
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 9945 of file uri.c.

9946 {
9947 HRESULT hr;
9948 DWORD i;
9950 DWORD len = -1;
9951 const uri_builder_property *prop = NULL;
9952
9953 /* Check if the property was set earlier. */
9954 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9955 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
9956 prop = &(test->properties[i]);
9957 }
9958
9959 if(prop) {
9960 /* Use expected_value unless it's NULL, then use value. */
9961 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9962 DWORD expected_len = expected ? strlen(expected) : 0;
9963 hr = IUriBuilder_GetPassword(builder, &len, &received);
9964 todo_wine_if(prop->todo) {
9965 ok(hr == (expected ? S_OK : S_FALSE),
9966 "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9967 hr, (expected ? S_OK : S_FALSE), test_index);
9968 if(SUCCEEDED(hr)) {
9969 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
9970 expected, wine_dbgstr_w(received), test_index);
9971 ok(expected_len == len,
9972 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
9973 expected_len, len, test_index);
9974 }
9975 }
9976 } else {
9977 /* The property wasn't set earlier, so it should return whatever
9978 * the base IUri contains (if anything).
9979 */
9980 IUri *uri = NULL;
9981 hr = IUriBuilder_GetIUri(builder, &uri);
9982 ok(hr == S_OK,
9983 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9984 hr, S_OK, test_index);
9985 if(SUCCEEDED(hr)) {
9986 if(!uri) {
9987 received = (void*) 0xdeadbeef;
9988 len = -1;
9989
9990 hr = IUriBuilder_GetPassword(builder, &len, &received);
9991 ok(hr == S_FALSE,
9992 "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9993 hr, S_FALSE, test_index);
9994 if(SUCCEEDED(hr)) {
9995 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9996 len, test_index);
9997 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
9998 received, test_index);
9999 }
10000 } else {
10001 BOOL has_prop = FALSE;
10002 BSTR expected = NULL;
10003
10004 hr = IUri_GetPassword(uri, &expected);
10005 ok(SUCCEEDED(hr),
10006 "Error: Expected IUri_GetPassword to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
10007 hr, test_index);
10008 has_prop = hr == S_OK;
10009
10010 hr = IUriBuilder_GetPassword(builder, &len, &received);
10011 if(has_prop) {
10012 ok(hr == S_OK,
10013 "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10014 hr, S_OK, test_index);
10015 if(SUCCEEDED(hr)) {
10017 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
10019 ok(lstrlenW(expected) == len,
10020 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
10021 lstrlenW(expected), len, test_index);
10022 }
10023 } else {
10024 ok(hr == S_FALSE,
10025 "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10026 hr, S_FALSE, test_index);
10027 if(SUCCEEDED(hr)) {
10028 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
10029 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
10030 len, test_index);
10031 }
10032 }
10034 }
10035 }
10036 if(uri) IUri_Release(uri);
10037 }
10038}

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 10040 of file uri.c.

10041 {
10042 HRESULT hr;
10043 DWORD i;
10045 DWORD len = -1;
10046 const uri_builder_property *prop = NULL;
10047
10048 /* Check if the property was set earlier. */
10049 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
10050 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
10051 prop = &(test->properties[i]);
10052 }
10053
10054 if(prop) {
10055 /* Use expected_value unless it's NULL, then use value. */
10056 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
10057 DWORD expected_len = expected ? strlen(expected) : 0;
10058 hr = IUriBuilder_GetPath(builder, &len, &received);
10059 todo_wine_if(prop->todo) {
10060 ok(hr == (expected ? S_OK : S_FALSE),
10061 "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10062 hr, (expected ? S_OK : S_FALSE), test_index);
10063 if(SUCCEEDED(hr)) {
10064 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
10065 expected, wine_dbgstr_w(received), test_index);
10066 ok(expected_len == len,
10067 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
10068 expected_len, len, test_index);
10069 }
10070 }
10071 } else {
10072 /* The property wasn't set earlier, so it should return whatever
10073 * the base IUri contains (if anything).
10074 */
10075 IUri *uri = NULL;
10076 hr = IUriBuilder_GetIUri(builder, &uri);
10077 ok(hr == S_OK,
10078 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10079 hr, S_OK, test_index);
10080 if(SUCCEEDED(hr)) {
10081 if(!uri) {
10082 received = (void*) 0xdeadbeef;
10083 len = -1;
10084
10085 hr = IUriBuilder_GetPath(builder, &len, &received);
10086 ok(hr == S_FALSE,
10087 "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10088 hr, S_FALSE, test_index);
10089 if(SUCCEEDED(hr)) {
10090 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
10091 len, test_index);
10092 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
10093 received, test_index);
10094 }
10095 } else {
10096 BOOL has_prop = FALSE;
10097 BSTR expected = NULL;
10098
10099 hr = IUri_GetPath(uri, &expected);
10100 ok(SUCCEEDED(hr),
10101 "Error: Expected IUri_GetPath to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
10102 hr, test_index);
10103 has_prop = hr == S_OK;
10104
10105 hr = IUriBuilder_GetPath(builder, &len, &received);
10106 if(has_prop) {
10107 ok(hr == S_OK,
10108 "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10109 hr, S_OK, test_index);
10110 if(SUCCEEDED(hr)) {
10112 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
10114 ok(lstrlenW(expected) == len,
10115 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
10116 lstrlenW(expected), len, test_index);
10117 }
10118 } else {
10119 ok(hr == S_FALSE,
10120 "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10121 hr, S_FALSE, test_index);
10122 if(SUCCEEDED(hr)) {
10123 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
10124 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
10125 len, test_index);
10126 }
10127 }
10129 }
10130 }
10131 if(uri) IUri_Release(uri);
10132 }
10133}

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 10135 of file uri.c.

10136 {
10137 HRESULT hr;
10138 BOOL has_port = FALSE;
10139 DWORD received = -1;
10140
10141 if(test->port_prop.change) {
10142 hr = IUriBuilder_GetPort(builder, &has_port, &received);
10143 todo_wine_if(test->port_prop.todo) {
10144 ok(hr == S_OK,
10145 "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10146 hr, S_OK, test_index);
10147 if(SUCCEEDED(hr)) {
10148 ok(has_port == test->port_prop.set,
10149 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%ld].\n",
10150 test->port_prop.set, has_port, test_index);
10151 ok(received == test->port_prop.value,
10152 "Error: Expected port to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
10153 test->port_prop.value, received, test_index);
10154 }
10155 }
10156 } else {
10157 IUri *uri = NULL;
10158
10159 hr = IUriBuilder_GetIUri(builder, &uri);
10160 ok(hr == S_OK,
10161 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10162 hr, S_OK, test_index);
10163 if(SUCCEEDED(hr)) {
10164 if(!uri) {
10165 hr = IUriBuilder_GetPort(builder, &has_port, &received);
10166 ok(hr == S_OK,
10167 "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10168 hr, S_OK, test_index);
10169 if(SUCCEEDED(hr)) {
10170 ok(has_port == FALSE,
10171 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%ld].\n",
10172 has_port, test_index);
10173 ok(!received, "Error: Expected received to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
10174 received, test_index);
10175 }
10176 } else {
10178
10179 hr = IUri_GetPort(uri, &expected);
10180 ok(SUCCEEDED(hr),
10181 "Error: Expected IUri_Port to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
10182 hr, test_index);
10183
10184 hr = IUriBuilder_GetPort(builder, &has_port, &received);
10185 ok(hr == S_OK,
10186 "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10187 hr, S_OK, test_index);
10188 if(SUCCEEDED(hr)) {
10189 ok(!has_port,
10190 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%ld].\n",
10191 test_index);
10192 ok(received == expected,
10193 "Error: Expected received to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
10194 expected, received, test_index);
10195 }
10196 }
10197 }
10198 if(uri) IUri_Release(uri);
10199 }
10200}

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 10202 of file uri.c.

10203 {
10204 HRESULT hr;
10205 DWORD i;
10207 DWORD len = -1;
10208 const uri_builder_property *prop = NULL;
10209
10210 /* Check if the property was set earlier. */
10211 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
10212 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
10213 prop = &(test->properties[i]);
10214 }
10215
10216 if(prop) {
10217 /* Use expected_value unless it's NULL, then use value. */
10218 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
10219 DWORD expected_len = expected ? strlen(expected) : 0;
10220 hr = IUriBuilder_GetQuery(builder, &len, &received);
10221 todo_wine_if(prop->todo) {
10222 ok(hr == (expected ? S_OK : S_FALSE),
10223 "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10224 hr, (expected ? S_OK : S_FALSE), test_index);
10225 if(SUCCEEDED(hr)) {
10226 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
10227 expected, wine_dbgstr_w(received), test_index);
10228 ok(expected_len == len,
10229 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
10230 expected_len, len, test_index);
10231 }
10232 }
10233 } else {
10234 /* The property wasn't set earlier, so it should return whatever
10235 * the base IUri contains (if anything).
10236 */
10237 IUri *uri = NULL;
10238 hr = IUriBuilder_GetIUri(builder, &uri);
10239 ok(hr == S_OK,
10240 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10241 hr, S_OK, test_index);
10242 if(SUCCEEDED(hr)) {
10243 if(!uri) {
10244 received = (void*) 0xdeadbeef;
10245 len = -1;
10246
10247 hr = IUriBuilder_GetQuery(builder, &len, &received);
10248 ok(hr == S_FALSE,
10249 "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10250 hr, S_FALSE, test_index);
10251 if(SUCCEEDED(hr)) {
10252 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
10253 len, test_index);
10254 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
10255 received, test_index);
10256 }
10257 } else {
10258 BOOL has_prop = FALSE;
10259 BSTR expected = NULL;
10260
10261 hr = IUri_GetQuery(uri, &expected);
10262 ok(SUCCEEDED(hr),
10263 "Error: Expected IUri_GetQuery to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
10264 hr, test_index);
10265 has_prop = hr == S_OK;
10266
10267 hr = IUriBuilder_GetQuery(builder, &len, &received);
10268 if(has_prop) {
10269 ok(hr == S_OK,
10270 "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10271 hr, S_OK, test_index);
10272 if(SUCCEEDED(hr)) {
10274 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
10276 ok(lstrlenW(expected) == len,
10277 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
10278 lstrlenW(expected), len, test_index);
10279 }
10280 } else {
10281 ok(hr == S_FALSE,
10282 "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10283 hr, S_FALSE, test_index);
10284 if(SUCCEEDED(hr)) {
10285 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
10286 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
10287 len, test_index);
10288 }
10289 }
10291 }
10292 }
10293 if(uri) IUri_Release(uri);
10294 }
10295}

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 10297 of file uri.c.

10298 {
10299 HRESULT hr;
10300 DWORD i;
10302 DWORD len = -1;
10303 const uri_builder_property *prop = NULL;
10304
10305 /* Check if the property was set earlier. */
10306 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
10307 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
10308 prop = &(test->properties[i]);
10309 }
10310
10311 if(prop) {
10312 /* Use expected_value unless it's NULL, then use value. */
10313 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
10314 DWORD expected_len = expected ? strlen(expected) : 0;
10315 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
10316 todo_wine_if(prop->todo) {
10317 ok(hr == (expected ? S_OK : S_FALSE),
10318 "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10319 hr, (expected ? S_OK : S_FALSE), test_index);
10320 if(SUCCEEDED(hr)) {
10321 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
10322 expected, wine_dbgstr_w(received), test_index);
10323 ok(expected_len == len,
10324 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
10325 expected_len, len, test_index);
10326 }
10327 }
10328 } else {
10329 /* The property wasn't set earlier, so it should return whatever
10330 * the base IUri contains (if anything).
10331 */
10332 IUri *uri = NULL;
10333 hr = IUriBuilder_GetIUri(builder, &uri);
10334 ok(hr == S_OK,
10335 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10336 hr, S_OK, test_index);
10337 if(SUCCEEDED(hr)) {
10338 if(!uri) {
10339 received = (void*) 0xdeadbeef;
10340 len = -1;
10341
10342 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
10343 ok(hr == S_FALSE,
10344 "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10345 hr, S_FALSE, test_index);
10346 if(SUCCEEDED(hr)) {
10347 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
10348 len, test_index);
10349 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
10350 received, test_index);
10351 }
10352 } else {
10353 BOOL has_prop = FALSE;
10354 BSTR expected = NULL;
10355
10356 hr = IUri_GetSchemeName(uri, &expected);
10357 ok(SUCCEEDED(hr),
10358 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
10359 hr, test_index);
10360 has_prop = hr == S_OK;
10361
10362 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
10363 if(has_prop) {
10364 ok(hr == S_OK,
10365 "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10366 hr, S_OK, test_index);
10367 if(SUCCEEDED(hr)) {
10369 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
10371 ok(lstrlenW(expected) == len,
10372 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
10373 lstrlenW(expected), len, test_index);
10374 }
10375 } else {
10376 ok(hr == S_FALSE,
10377 "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10378 hr, S_FALSE, test_index);
10379 if(SUCCEEDED(hr)) {
10380 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
10381 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
10382 len, test_index);
10383 }
10384 }
10386 }
10387 }
10388 if(uri) IUri_Release(uri);
10389 }
10390}

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 10392 of file uri.c.

10393 {
10394 HRESULT hr;
10395 DWORD i;
10397 DWORD len = -1;
10398 const uri_builder_property *prop = NULL;
10399
10400 /* Check if the property was set earlier. */
10401 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
10402 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
10403 prop = &(test->properties[i]);
10404 }
10405
10406 if(prop && prop->value && *prop->value) {
10407 /* Use expected_value unless it's NULL, then use value. */
10408 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
10409 DWORD expected_len = expected ? strlen(expected) : 0;
10410 hr = IUriBuilder_GetUserName(builder, &len, &received);
10411 todo_wine_if(prop->todo) {
10412 ok(hr == (expected ? S_OK : S_FALSE),
10413 "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10414 hr, (expected ? S_OK : S_FALSE), test_index);
10415 if(SUCCEEDED(hr)) {
10416 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
10417 expected, wine_dbgstr_w(received), test_index);
10418 ok(expected_len == len,
10419 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
10420 expected_len, len, test_index);
10421 }
10422 }
10423 } else {
10424 /* The property wasn't set earlier, so it should return whatever
10425 * the base IUri contains (if anything).
10426 */
10427 IUri *uri = NULL;
10428 hr = IUriBuilder_GetIUri(builder, &uri);
10429 ok(hr == S_OK,
10430 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10431 hr, S_OK, test_index);
10432 if(SUCCEEDED(hr)) {
10433 if(!uri) {
10434 received = (void*) 0xdeadbeef;
10435 len = -1;
10436
10437 hr = IUriBuilder_GetUserName(builder, &len, &received);
10438 ok(hr == S_FALSE,
10439 "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10440 hr, S_FALSE, test_index);
10441 if(SUCCEEDED(hr)) {
10442 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
10443 len, test_index);
10444 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
10445 received, test_index);
10446 }
10447 } else {
10448 BSTR expected = NULL;
10449 BOOL has_prop = FALSE;
10450
10451 hr = IUri_GetUserName(uri, &expected);
10452 ok(SUCCEEDED(hr),
10453 "Error: Expected IUri_GetUserName to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
10454 hr, test_index);
10455 has_prop = hr == S_OK;
10456
10457 hr = IUriBuilder_GetUserName(builder, &len, &received);
10458 if(has_prop) {
10459 ok(hr == S_OK,
10460 "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10461 hr, S_OK, test_index);
10462 if(SUCCEEDED(hr)) {
10464 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
10466 ok(lstrlenW(expected) == len,
10467 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
10468 lstrlenW(expected), len, test_index);
10469 }
10470 } else {
10471 ok(hr == S_FALSE,
10472 "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10473 hr, S_FALSE, test_index);
10474 if(SUCCEEDED(hr)) {
10475 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
10476 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
10477 len, test_index);
10478 }
10479 }
10481 }
10482 }
10483 if(uri) IUri_Release(uri);
10484 }
10485}

Referenced by test_IUriBuilder().

◆ test_IUriBuilder_HasBeenModified()

static void test_IUriBuilder_HasBeenModified ( void  )
static

Definition at line 10568 of file uri.c.

10568 {
10569 HRESULT hr;
10570 IUriBuilder *builder = NULL;
10571
10572 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10573 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10574 if(SUCCEEDED(hr)) {
10575 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
10576 IUri *uri = NULL;
10577 BOOL received;
10578
10579 hr = IUriBuilder_HasBeenModified(builder, NULL);
10580 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
10581 hr, E_POINTER);
10582
10583 hr = IUriBuilder_SetHost(builder, hostW);
10584 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08lx, expected 0x%08lx.\n",
10585 hr, S_OK);
10586
10587 hr = IUriBuilder_HasBeenModified(builder, &received);
10588 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
10589 hr, S_OK);
10590 if(SUCCEEDED(hr))
10591 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10592
10593 hr = pCreateUri(http_urlW, 0, 0, &uri);
10594 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10595 if(SUCCEEDED(hr)) {
10596 LPCWSTR prop;
10597 DWORD len = -1;
10598
10599 hr = IUriBuilder_SetIUri(builder, uri);
10600 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n",
10601 hr, S_OK);
10602
10603 hr = IUriBuilder_HasBeenModified(builder, &received);
10604 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
10605 hr, S_OK);
10606 if(SUCCEEDED(hr))
10607 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
10608
10609 /* Test what happens with you call SetIUri with the same IUri again. */
10610 hr = IUriBuilder_SetHost(builder, hostW);
10611 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10612
10613 hr = IUriBuilder_HasBeenModified(builder, &received);
10614 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
10615 hr, S_OK);
10616 if(SUCCEEDED(hr))
10617 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10618
10619 hr = IUriBuilder_SetIUri(builder, uri);
10620 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10621
10622 /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
10623 * reset any of the changes that were made to the IUriBuilder.
10624 */
10625 hr = IUriBuilder_HasBeenModified(builder, &received);
10626 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10627 if(SUCCEEDED(hr))
10628 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10629
10630 hr = IUriBuilder_GetHost(builder, &len, &prop);
10631 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10632 if(SUCCEEDED(hr)) {
10633 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
10635 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %ld instead.\n",
10636 lstrlenW(hostW), len);
10637 }
10638
10639 hr = IUriBuilder_SetIUri(builder, NULL);
10640 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10641
10642 hr = IUriBuilder_SetHost(builder, hostW);
10643 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10644 hr = IUriBuilder_HasBeenModified(builder, &received);
10645 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
10646 hr, S_OK);
10647 if(SUCCEEDED(hr))
10648 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10649
10650 hr = IUriBuilder_SetIUri(builder, NULL);
10651 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%09lx.\n", hr, S_OK);
10652
10653 hr = IUriBuilder_HasBeenModified(builder, &received);
10654 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
10655 hr, S_OK);
10656 if(SUCCEEDED(hr))
10657 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10658
10659 hr = IUriBuilder_GetHost(builder, &len, &prop);
10660 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10661 if(SUCCEEDED(hr)) {
10662 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
10664 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %ld instead.\n",
10665 lstrlenW(hostW), len);
10666 }
10667 }
10668 if(uri) IUri_Release(uri);
10669 }
10670 if(builder) IUriBuilder_Release(builder);
10671}
static const WCHAR hostW[]
Definition: protocol.c:142

Referenced by START_TEST().

◆ test_IUriBuilder_IUriProperty()

static void test_IUriBuilder_IUriProperty ( void  )
static

Definition at line 10674 of file uri.c.

10674 {
10675 IUriBuilder *builder = NULL;
10676 HRESULT hr;
10677
10678 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10679 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10680 if(SUCCEEDED(hr)) {
10681 IUri *uri = NULL;
10682
10683 hr = IUriBuilder_GetIUri(builder, NULL);
10684 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx.\n",
10685 hr, E_POINTER);
10686
10687 hr = pCreateUri(http_urlW, 0, 0, &uri);
10688 if(SUCCEEDED(hr)) {
10689 IUri *test = NULL;
10690 ULONG cur_count, orig_count;
10691
10692 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
10693 orig_count = get_refcnt(uri);
10694 hr = IUriBuilder_SetIUri(builder, uri);
10695 cur_count = get_refcnt(uri);
10696 if(SUCCEEDED(hr))
10697 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10698 orig_count+1, cur_count);
10699
10700 hr = IUriBuilder_SetIUri(builder, NULL);
10701 cur_count = get_refcnt(uri);
10702 if(SUCCEEDED(hr))
10703 ok(cur_count == orig_count, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10704 orig_count, cur_count);
10705
10706 /* CreateUri* functions will return back the same IUri if nothing has changed. */
10707 hr = IUriBuilder_SetIUri(builder, uri);
10708 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10709 orig_count = get_refcnt(uri);
10710
10711 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
10712 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10713 if(SUCCEEDED(hr)) {
10714 cur_count = get_refcnt(uri);
10715 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10716 orig_count+1, cur_count);
10717 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
10718 uri, test);
10719 }
10720 if(test) IUri_Release(test);
10721
10722 test = NULL;
10723 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
10724 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10725 if(SUCCEEDED(hr)) {
10726 cur_count = get_refcnt(uri);
10727 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10728 orig_count+1, cur_count);
10729 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10730 }
10731 if(test) IUri_Release(test);
10732
10733 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10734 * the base IUri.
10735 */
10736 test = NULL;
10737 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
10738 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10739 if(SUCCEEDED(hr))
10740 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10741
10742 if(test) IUri_Release(test);
10743
10744 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10745 * explicitly set (because it's a default flag).
10746 */
10747 test = NULL;
10748 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
10749 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10750 if(SUCCEEDED(hr)) {
10751 cur_count = get_refcnt(uri);
10752 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10753 orig_count+1, cur_count);
10754 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10755 }
10756 if(test) IUri_Release(test);
10757
10758 test = NULL;
10759 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
10760 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10761 if(SUCCEEDED(hr)) {
10762 cur_count = get_refcnt(uri);
10763 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10764 orig_count+1, cur_count);
10765 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10766 }
10767 if(test) IUri_Release(test);
10768
10769 test = NULL;
10770 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
10771 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
10772 hr, S_OK);
10773 if(SUCCEEDED(hr)) {
10774 cur_count = get_refcnt(uri);
10775 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10776 orig_count+1, cur_count);
10777 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10778 }
10779 if(test) IUri_Release(test);
10780
10781 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10782 * the base IUri.
10783 */
10784 test = NULL;
10785 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
10786 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10787 if(SUCCEEDED(hr))
10788 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10789
10790 if(test) IUri_Release(test);
10791
10792 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10793 * explicitly set (because it's a default flag).
10794 */
10795 test = NULL;
10796 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
10797 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10798 if(SUCCEEDED(hr)) {
10799 cur_count = get_refcnt(uri);
10800 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10801 orig_count+1, cur_count);
10802 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10803 }
10804 if(test) IUri_Release(test);
10805 }
10806 if(uri) IUri_Release(uri);
10807 }
10808 if(builder) IUriBuilder_Release(builder);
10809}

Referenced by START_TEST().

◆ test_IUriBuilder_Misc()

static void test_IUriBuilder_Misc ( void  )
static

Definition at line 10895 of file uri.c.

10895 {
10896 HRESULT hr;
10897 IUri *uri;
10898
10899 hr = pCreateUri(http_urlW, 0, 0, &uri);
10900 if(SUCCEEDED(hr)) {
10901 IUriBuilder *builder;
10902
10903 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10904 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10905 if(SUCCEEDED(hr)) {
10906 BOOL has = -1;
10907 DWORD port = -1;
10908
10909 hr = IUriBuilder_GetPort(builder, &has, &port);
10910 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10911 if(SUCCEEDED(hr)) {
10912 /* 'has' will be set to FALSE, even though uri had a port. */
10913 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
10914 /* Still sets 'port' to 80. */
10915 ok(port == 80, "Error: Expected the port to be 80, but, was %ld instead.\n", port);
10916 }
10917 }
10918 if(builder) IUriBuilder_Release(builder);
10919 }
10920 if(uri) IUri_Release(uri);
10921}

Referenced by START_TEST().

◆ test_IUriBuilder_RemoveProperties()

static void test_IUriBuilder_RemoveProperties ( void  )
static

Definition at line 10811 of file uri.c.

10811 {
10812 IUriBuilder *builder = NULL;
10813 HRESULT hr;
10814 DWORD i;
10815
10816 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10817 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10818 if(SUCCEEDED(hr)) {
10819 /* Properties that can't be removed. */
10820 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
10821 Uri_HAS_SCHEME|Uri_HAS_ZONE;
10822
10823 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
10824 hr = IUriBuilder_RemoveProperties(builder, i << 1);
10825 if((i << 1) & invalid) {
10826 ok(hr == E_INVALIDARG,
10827 "Error: IUriBuilder_RemoveProperties returned 0x%08lx, expected 0x%08lx with prop=%ld.\n",
10828 hr, E_INVALIDARG, i);
10829 } else {
10830 ok(hr == S_OK,
10831 "Error: IUriBuilder_RemoveProperties returned 0x%08lx, expected 0x%08lx with prop=%ld.\n",
10832 hr, S_OK, i);
10833 }
10834 }
10835
10836 /* Also doesn't accept anything that's outside the range of the
10837 * Uri_HAS flags.
10838 */
10839 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
10840 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08lx, expected 0x%08lx.\n",
10841 hr, E_INVALIDARG);
10842 }
10843 if(builder) IUriBuilder_Release(builder);
10844
10845 for(i = 0; i < ARRAY_SIZE(uri_builder_remove_tests); ++i) {
10847 IUri *uri = NULL;
10848 LPWSTR uriW;
10849
10850 uriW = a2w(test.uri);
10851 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10852 if(SUCCEEDED(hr)) {
10853 builder = NULL;
10854
10855 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10856 todo_wine_if(test.create_builder_todo)
10857 ok(hr == test.create_builder_expected,
10858 "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx on test %ld.\n",
10859 hr, test.create_builder_expected, i);
10860
10861 if(SUCCEEDED(hr)) {
10862 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
10863 todo_wine_if(test.remove_todo)
10864 ok(hr == test.remove_expected,
10865 "Error: IUriBuilder returned 0x%08lx, expected 0x%08lx on test %ld.\n",
10866 hr, test.remove_expected, i);
10867 if(SUCCEEDED(hr)) {
10868 IUri *result = NULL;
10869
10870 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
10871 todo_wine_if(test.expected_todo)
10872 ok(hr == test.expected_hres,
10873 "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx on test %ld.\n",
10874 hr, test.expected_hres, i);
10875 if(SUCCEEDED(hr)) {
10876 BSTR received = NULL;
10877
10878 hr = IUri_GetAbsoluteUri(result, &received);
10879 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08lx instead.\n", hr);
10880 ok(!strcmp_aw(test.expected_uri, received),
10881 "Error: Expected %s but got %s instead on test %ld.\n",
10882 test.expected_uri, wine_dbgstr_w(received), i);
10884 }
10885 if(result) IUri_Release(result);
10886 }
10887 }
10888 if(builder) IUriBuilder_Release(builder);
10889 }
10890 if(uri) IUri_Release(uri);
10891 free(uriW);
10892 }
10893}
static const uri_builder_remove_test uri_builder_remove_tests[]
Definition: uri.c:6792

Referenced by START_TEST().

◆ test_IUriBuilderFactory()

static void test_IUriBuilderFactory ( void  )
static

Definition at line 10923 of file uri.c.

10923 {
10924 HRESULT hr;
10925 IUri *uri;
10927 IUriBuilder *builder;
10928
10929 hr = pCreateUri(http_urlW, 0, 0, &uri);
10930 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
10931 if(SUCCEEDED(hr)) {
10932 factory = NULL;
10933 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
10934 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08lx.\n", hr);
10935 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
10936
10937 if(SUCCEEDED(hr)) {
10938 builder = (void*) 0xdeadbeef;
10939 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
10940 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10941 hr, E_INVALIDARG);
10942 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10943
10944 builder = (void*) 0xdeadbeef;
10945 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
10946 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10947 hr, E_INVALIDARG);
10948 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10949
10950 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
10951 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10952 hr, E_POINTER);
10953
10954 builder = NULL;
10955 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
10956 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10957 hr, S_OK);
10958 if(SUCCEEDED(hr)) {
10959 IUri *tmp = (void*) 0xdeadbeef;
10961 DWORD result_len;
10962
10963 hr = IUriBuilder_GetIUri(builder, &tmp);
10964 ok(hr == S_OK, "Error: GetIUri returned 0x%08lx, expected 0x%08lx.\n",
10965 hr, S_OK);
10966 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
10967
10968 hr = IUriBuilder_GetHost(builder, &result_len, &result);
10969 ok(hr == S_FALSE, "Error: GetHost returned 0x%08lx, expected 0x%08lx.\n",
10970 hr, S_FALSE);
10971 }
10972 if(builder) IUriBuilder_Release(builder);
10973
10974 builder = (void*) 0xdeadbeef;
10975 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
10976 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10977 hr, E_INVALIDARG);
10978 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10979
10980 builder = (void*) 0xdeadbeef;
10981 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
10982 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10983 hr, E_INVALIDARG);
10984 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10985
10986 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
10987 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10988 hr, E_POINTER);
10989
10990 builder = NULL;
10991 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
10992 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10993 hr, S_OK);
10994 if(SUCCEEDED(hr)) {
10995 IUri *tmp = NULL;
10996
10997 hr = IUriBuilder_GetIUri(builder, &tmp);
10998 ok(hr == S_OK, "Error: GetIUri return 0x%08lx, expected 0x%08lx.\n",
10999 hr, S_OK);
11000 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
11001 if(tmp) IUri_Release(tmp);
11002 }
11003 if(builder) IUriBuilder_Release(builder);
11004 }
11005 if(factory) IUriBuilderFactory_Release(factory);
11006 }
11007 if(uri) IUri_Release(uri);
11008}
Definition: main.c:439

Referenced by START_TEST().

◆ test_UninitializedUri()

static void test_UninitializedUri ( void  )
static

Definition at line 12032 of file uri.c.

12033{
12034 IUri *uri;
12035 IUriBuilderFactory *ubf;
12036 IPersistStream *ps;
12037 IUriBuilder *ub;
12038 BSTR bstr;
12039 DWORD dword;
12040 BOOL eq;
12042 HRESULT hr;
12043
12044 hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
12045 &IID_IUri, (void**)&uri);
12046 if(FAILED(hr)) {
12047 win_skip("Skipping uninitialized Uri tests.\n");
12048 return;
12049 }
12050
12051 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
12052 ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %lx.\n", hr);
12053 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
12054 ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %lx.\n", hr);
12055
12056 hr = IUri_GetAbsoluteUri(uri, NULL);
12057 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %lx, expected E_UNEXPECTED.\n", hr);
12058 hr = IUri_GetAbsoluteUri(uri, &bstr);
12059 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %lx, expected E_UNEXPECTED.\n", hr);
12060 hr = IUri_GetAuthority(uri, &bstr);
12061 ok(hr == E_UNEXPECTED, "GetAuthority returned %lx, expected E_UNEXPECTED.\n", hr);
12062 hr = IUri_GetDisplayUri(uri, &bstr);
12063 ok(hr == E_UNEXPECTED, "GetDisplayUri returned %lx, expected E_UNEXPECTED.\n", hr);
12064 hr = IUri_GetDomain(uri, &bstr);
12065 ok(hr == E_UNEXPECTED, "GetDomain returned %lx, expected E_UNEXPECTED.\n", hr);
12066 hr = IUri_GetExtension(uri, &bstr);
12067 ok(hr == E_UNEXPECTED, "GetExtension returned %lx, expected E_UNEXPECTED.\n", hr);
12068 hr = IUri_GetFragment(uri, &bstr);
12069 ok(hr == E_UNEXPECTED, "GetFragment returned %lx, expected E_UNEXPECTED.\n", hr);
12070 hr = IUri_GetHost(uri, &bstr);
12071 ok(hr == E_UNEXPECTED, "GetHost returned %lx, expected E_UNEXPECTED.\n", hr);
12072 hr = IUri_GetHostType(uri, &dword);
12073 ok(hr == E_UNEXPECTED, "GetHostType returned %lx, expected E_UNEXPECTED.\n", hr);
12074 hr = IUri_GetPassword(uri, &bstr);
12075 ok(hr == E_UNEXPECTED, "GetPassword returned %lx, expected E_UNEXPECTED.\n", hr);
12076 hr = IUri_GetPassword(uri, &bstr);
12077 ok(hr == E_UNEXPECTED, "GetPassword returned %lx, expected E_UNEXPECTED.\n", hr);
12078 hr = IUri_GetPathAndQuery(uri, &bstr);
12079 ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %lx, expected E_UNEXPECTED.\n", hr);
12080 hr = IUri_GetPort(uri, &dword);
12081 ok(hr == E_UNEXPECTED, "GetPort returned %lx, expected E_UNEXPECTED.\n", hr);
12082 hr = IUri_GetProperties(uri, &dword);
12083 ok(hr == E_UNEXPECTED, "GetProperties returned %lx, expected E_UNEXPECTED.\n", hr);
12084 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
12085 ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %lx, expected E_UNEXPECTED.\n", hr);
12086 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
12087 ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %lx, expected E_UNEXPECTED.\n", hr);
12088 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
12089 ok(hr == E_UNEXPECTED, "GetPropertyLength returned %lx, expected E_UNEXPECTED.\n", hr);
12090 hr = IUri_GetQuery(uri, &bstr);
12091 ok(hr == E_UNEXPECTED, "GetQuery returned %lx, expected E_UNEXPECTED.\n", hr);
12092 hr = IUri_GetRawUri(uri, &bstr);
12093 ok(hr == E_UNEXPECTED, "GetRawUri returned %lx, expected E_UNEXPECTED.\n", hr);
12094 hr = IUri_GetScheme(uri, &dword);
12095 ok(hr == E_UNEXPECTED, "GetScheme returned %lx, expected E_UNEXPECTED.\n", hr);
12096 hr = IUri_GetSchemeName(uri, &bstr);
12097 ok(hr == E_UNEXPECTED, "GetSchemeName returned %lx, expected E_UNEXPECTED.\n", hr);
12098 hr = IUri_GetUserInfo(uri, &bstr);
12099 ok(hr == E_UNEXPECTED, "GetUserInfo returned %lx, expected E_UNEXPECTED.\n", hr);
12100 hr = IUri_GetUserName(uri, &bstr);
12101 ok(hr == E_UNEXPECTED, "GetUserName returned %lx, expected E_UNEXPECTED.\n", hr);
12102 hr = IUri_GetZone(uri, &dword);
12103 ok(hr == E_UNEXPECTED, "GetZone returned %lx, expected E_UNEXPECTED.\n", hr);
12104 hr = IUri_IsEqual(uri, uri, &eq);
12105 ok(hr == E_UNEXPECTED, "IsEqual returned %lx, expected E_UNEXPECTED.\n", hr);
12106
12107 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
12108 ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %lx, expected E_UNEXPECTED.\n", hr);
12109 hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
12110 ok(hr == S_OK, "CreateIUriBuilder returned %lx, expected S_OK.\n", hr);
12111 IUriBuilder_Release(ub);
12112
12113 hr = IPersistStream_GetSizeMax(ps, &ui);
12114 ok(hr == S_OK, "GetSizeMax returned %lx, expected S_OK.\n", hr);
12115 ok(ui.u.LowPart == 34, "ui.LowPart = %ld, expected 34.\n", ui.u.LowPart);
12116 hr = IPersistStream_IsDirty(ps);
12117 ok(hr == S_FALSE, "IsDirty returned %lx, expected S_FALSE.\n", hr);
12118
12119 IPersistStream_Release(ps);
12120 IUriBuilderFactory_Release(ubf);
12121 IUri_Release(uri);
12122}
#define eq(received, expected, label, type)
Definition: locale.c:179
UINT ui
Definition: oleauto.h:49

Referenced by START_TEST().

◆ unregister_protocols()

static void unregister_protocols ( void  )
static

Definition at line 11246 of file uri.c.

11246 {
11248 HRESULT hr;
11249
11250 hr = pCoInternetGetSession(0, &session, 0);
11251 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08lx\n", hr);
11252 if(FAILED(hr))
11253 return;
11254
11255 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
11256 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08lx\n", hr);
11257
11258 IInternetSession_Release(session);
11259}

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:11213
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
Definition: uri.c:11206
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: uri.c:11201
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: uri.c:11185
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: uri.c:11196

Definition at line 11219 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 86 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 11596 of file uri.c.

Referenced by test_CreateURLMoniker().

◆ custom_uri_vtbl

const IUriVtbl custom_uri_vtbl
static

Definition at line 9173 of file uri.c.

Referenced by test_IUri_IsEqual().

◆ DWORD

Definition at line 71 of file uri.c.

◆ DWORD_PTR

Definition at line 71 of file uri.c.

◆ equality_tests

const uri_equality equality_tests[]
static

Definition at line 5557 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 83 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:11165
static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
Definition: uri.c:11158
static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface, LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: uri.c:11139
static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
Definition: uri.c:11112
static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
Definition: uri.c:11117
static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface, REFIID riid, void **ppv)
Definition: uri.c:11105
static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: uri.c:11122

Definition at line 11173 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 104 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 5487 of file uri.c.

Referenced by test_CreateUri_InvalidUri().

◆ LPCWSTR

Definition at line 72 of file uri.c.

◆ LPWSTR

Definition at line 77 of file uri.c.

◆ parse_action

PARSEACTION parse_action
static

Definition at line 96 of file uri.c.

Referenced by InternetProtocolInfo_ParseUrl(), and test_CoInternetParseIUri_Pluggable().

◆ parse_flags

DWORD parse_flags
static

Definition at line 97 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 94 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 93 of file uri.c.

Referenced by InternetProtocolInfo_ParseUrl(), and test_CoInternetParseIUri_Pluggable().

◆ PARSEACTION

PARSEACTION

Definition at line 77 of file uri.c.

◆ protocol_cf

IClassFactory protocol_cf = { &ClassFactoryVtbl }
static

Definition at line 11227 of file uri.c.

Referenced by register_protocols(), and unregister_protocols().

◆ protocol_info

IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl }
static

Definition at line 11183 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 6792 of file uri.c.

Referenced by test_IUriBuilder_RemoveProperties().

◆ uri_builder_tests

const uri_builder_test uri_builder_tests[]
static

Definition at line 5776 of file uri.c.

Referenced by test_IUriBuilder().

◆ uri_combine_tests

const uri_combine_test uri_combine_tests[]
static

Definition at line 6855 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 5699 of file uri.c.

Referenced by test_CreateUriWithFragment().

◆ uri_parse_tests

const uri_parse_test uri_parse_tests[]
static

Definition at line 8053 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 91 of file uri.c.

Referenced by register_protocols(), and unregister_protocols().