Commit bef85fbc authored by Thomas Mullaly's avatar Thomas Mullaly Committed by Alexandre Julliard

urlmon: Implemented IUriBuilder_RemoveProperties.

parent 9d41c3d5
...@@ -4943,16 +4943,38 @@ typedef struct _uri_builder_remove_test { ...@@ -4943,16 +4943,38 @@ typedef struct _uri_builder_remove_test {
static const uri_builder_remove_test uri_builder_remove_tests[] = { static const uri_builder_remove_test uri_builder_remove_tests[] = {
{ "http://google.com/test?test=y#Frag",0,S_OK,FALSE, { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,TRUE, Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
"http://google.com/",0,S_OK,TRUE "http://google.com/",0,S_OK,TRUE
}, },
{ "http://user:pass@winehq.org/",0,S_OK,FALSE, { "http://user:pass@winehq.org/",0,S_OK,FALSE,
Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,TRUE, Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
"http://winehq.org/",0,S_OK,TRUE "http://winehq.org/",0,S_OK,TRUE
}, },
{ "zip://google.com?Test=x",0,S_OK,FALSE, { "zip://google.com?Test=x",0,S_OK,FALSE,
Uri_HAS_HOST,S_OK,TRUE, Uri_HAS_HOST,S_OK,FALSE,
"zip:/?Test=x",0,S_OK,TRUE "zip:/?Test=x",0,S_OK,TRUE
},
/* Doesn't remove the whole userinfo component. */
{ "http://username:pass@google.com/",0,S_OK,FALSE,
Uri_HAS_USER_INFO,S_OK,FALSE,
"http://username:pass@google.com/",0,S_OK,TRUE
},
/* Doesn't remove the domain. */
{ "http://google.com/",0,S_OK,FALSE,
Uri_HAS_DOMAIN,S_OK,FALSE,
"http://google.com/",0,S_OK,TRUE
},
{ "http://google.com:120/",0,S_OK,FALSE,
Uri_HAS_AUTHORITY,S_OK,FALSE,
"http://google.com:120/",0,S_OK,TRUE
},
{ "http://google.com/test.com/",0,S_OK,FALSE,
Uri_HAS_EXTENSION,S_OK,FALSE,
"http://google.com/test.com/",0,S_OK,TRUE
},
{ "http://google.com/?test=x",0,S_OK,FALSE,
Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
"http://google.com/?test=x",0,S_OK,TRUE
} }
}; };
...@@ -7837,19 +7859,22 @@ static void test_IUriBuilder_RemoveProperties(void) { ...@@ -7837,19 +7859,22 @@ static void test_IUriBuilder_RemoveProperties(void) {
for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) { for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
hr = IUriBuilder_RemoveProperties(builder, i << 1); hr = IUriBuilder_RemoveProperties(builder, i << 1);
if((i << 1) & invalid) { if((i << 1) & invalid) {
todo_wine { ok(hr == E_INVALIDARG,
ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
"Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n", hr, E_INVALIDARG, i);
hr, E_INVALIDARG, i);
}
} else { } else {
todo_wine { ok(hr == S_OK,
ok(hr == S_OK, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
"Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n", hr, S_OK, i);
hr, S_OK, i);
}
} }
} }
/* Also doesn't accept anything that's outside the range of the
* Uri_HAS flags.
*/
hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
hr, E_INVALIDARG);
} }
if(builder) IUriBuilder_Release(builder); if(builder) IUriBuilder_Release(builder);
......
...@@ -4743,9 +4743,41 @@ static HRESULT WINAPI UriBuilder_SetUserName(IUriBuilder *iface, LPCWSTR pwzNewV ...@@ -4743,9 +4743,41 @@ static HRESULT WINAPI UriBuilder_SetUserName(IUriBuilder *iface, LPCWSTR pwzNewV
static HRESULT WINAPI UriBuilder_RemoveProperties(IUriBuilder *iface, DWORD dwPropertyMask) static HRESULT WINAPI UriBuilder_RemoveProperties(IUriBuilder *iface, DWORD dwPropertyMask)
{ {
const DWORD accepted_flags = Uri_HAS_AUTHORITY|Uri_HAS_DOMAIN|Uri_HAS_EXTENSION|Uri_HAS_FRAGMENT|Uri_HAS_HOST|
Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_QUERY|
Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME;
UriBuilder *This = URIBUILDER_THIS(iface); UriBuilder *This = URIBUILDER_THIS(iface);
FIXME("(%p)->(0x%08x)\n", This, dwPropertyMask); TRACE("(%p)->(0x%08x)\n", This, dwPropertyMask);
return E_NOTIMPL;
if(dwPropertyMask & ~accepted_flags)
return E_INVALIDARG;
if(dwPropertyMask & Uri_HAS_FRAGMENT)
UriBuilder_SetFragment(iface, NULL);
if(dwPropertyMask & Uri_HAS_HOST)
UriBuilder_SetHost(iface, NULL);
if(dwPropertyMask & Uri_HAS_PASSWORD)
UriBuilder_SetPassword(iface, NULL);
if(dwPropertyMask & Uri_HAS_PATH)
UriBuilder_SetPath(iface, NULL);
if(dwPropertyMask & Uri_HAS_PORT)
UriBuilder_SetPort(iface, FALSE, 0);
if(dwPropertyMask & Uri_HAS_QUERY)
UriBuilder_SetQuery(iface, NULL);
if(dwPropertyMask & Uri_HAS_SCHEME_NAME)
UriBuilder_SetSchemeName(iface, NULL);
if(dwPropertyMask & Uri_HAS_USER_NAME)
UriBuilder_SetUserName(iface, NULL);
return S_OK;
} }
static HRESULT WINAPI UriBuilder_HasBeenModified(IUriBuilder *iface, BOOL *pfModified) static HRESULT WINAPI UriBuilder_HasBeenModified(IUriBuilder *iface, BOOL *pfModified)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment