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

urlmon/tests: IUriBuilder's can create IUri's even if they don't have a base IUri.

parent dd0ea1cc
...@@ -4888,6 +4888,40 @@ static const uri_builder_test uri_builder_tests[] = { ...@@ -4888,6 +4888,40 @@ static const uri_builder_test uri_builder_tests[] = {
{URL_SCHEME_HTTP,S_OK}, {URL_SCHEME_HTTP,S_OK},
{URLZONE_INVALID,E_NOTIMPL} {URLZONE_INVALID,E_NOTIMPL}
} }
},
/* IUriBuilder doesn't need a base IUri to build a IUri. */
{ NULL,0,S_OK,FALSE,
{
{TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
{TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
},
{FALSE},
0,S_OK,TRUE,
0,S_OK,TRUE,
0,0,0,S_OK,TRUE,
{
{"http://google.com/",S_OK},
{"google.com",S_OK},
{"http://google.com/",S_OK},
{"google.com",S_OK},
{"",S_FALSE},
{"",S_FALSE},
{"google.com",S_OK},
{"",S_FALSE},
{"/",S_OK},
{"/",S_OK},
{"",S_FALSE},
{"http://google.com/",S_OK},
{"http",S_OK},
{"",S_FALSE},
{"",S_FALSE}
},
{
{Uri_HOST_DNS,S_OK},
{80,S_OK},
{URL_SCHEME_HTTP,S_OK},
{URLZONE_INVALID,E_NOTIMPL}
}
} }
}; };
...@@ -6500,10 +6534,6 @@ static void test_IUriBuilder_CreateInvalidArgs(void) { ...@@ -6500,10 +6534,6 @@ static void test_IUriBuilder_CreateInvalidArgs(void) {
IUri *test = NULL, *uri = (void*) 0xdeadbeef; IUri *test = NULL, *uri = (void*) 0xdeadbeef;
/* Test what happens if the IUriBuilder doesn't have a IUri set. */ /* Test what happens if the IUriBuilder doesn't have a IUri set. */
hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &uri);
ok(hr == INET_E_INVALID_URL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, INET_E_INVALID_URL);
ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL); hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER); ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
...@@ -6512,12 +6542,6 @@ static void test_IUriBuilder_CreateInvalidArgs(void) { ...@@ -6512,12 +6542,6 @@ static void test_IUriBuilder_CreateInvalidArgs(void) {
ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL); ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri); ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
uri = (void*) 0xdeadbeef;
hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &uri);
ok(hr == INET_E_INVALID_URL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
hr, INET_E_INVALID_URL);
ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL); hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
hr, E_POINTER); hr, E_POINTER);
...@@ -6528,13 +6552,6 @@ static void test_IUriBuilder_CreateInvalidArgs(void) { ...@@ -6528,13 +6552,6 @@ static void test_IUriBuilder_CreateInvalidArgs(void) {
hr, E_NOTIMPL); hr, E_NOTIMPL);
ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri); ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
uri = (void*) 0xdeadbeef;
hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
ok(hr == INET_E_INVALID_URL,
"Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
hr, INET_E_INVALID_URL);
ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL); hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
hr, E_POINTER); hr, E_POINTER);
......
...@@ -4404,16 +4404,11 @@ static HRESULT WINAPI UriBuilder_CreateUriSimple(IUriBuilder *iface, ...@@ -4404,16 +4404,11 @@ static HRESULT WINAPI UriBuilder_CreateUriSimple(IUriBuilder *iface,
return E_POINTER; return E_POINTER;
/* Acts the same way as CreateUri. */ /* Acts the same way as CreateUri. */
if(dwAllowEncodingPropertyMask && !This->uri) { if(dwAllowEncodingPropertyMask && (!This->uri || This->modified_props)) {
*ppIUri = NULL; *ppIUri = NULL;
return E_NOTIMPL; return E_NOTIMPL;
} }
if(!This->uri) {
*ppIUri = NULL;
return INET_E_INVALID_URL;
}
FIXME("(%p)->(%d %d %p)\n", This, dwAllowEncodingPropertyMask, (DWORD)dwReserved, ppIUri); FIXME("(%p)->(%d %d %p)\n", This, dwAllowEncodingPropertyMask, (DWORD)dwReserved, ppIUri);
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -4433,19 +4428,12 @@ static HRESULT WINAPI UriBuilder_CreateUri(IUriBuilder *iface, ...@@ -4433,19 +4428,12 @@ static HRESULT WINAPI UriBuilder_CreateUri(IUriBuilder *iface,
/* The only time it doesn't return E_NOTIMPL when the dwAllow parameter /* The only time it doesn't return E_NOTIMPL when the dwAllow parameter
* has flags set, is when the IUriBuilder has a IUri set and it hasn't * has flags set, is when the IUriBuilder has a IUri set and it hasn't
* been modified (a call to a "Set*" hasn't been performed). * been modified (a call to a "Set*" hasn't been performed).
*
* TODO: Check if the IUriBuilder's properties have been modified.
*/ */
if(dwAllowEncodingPropertyMask && !This->uri) { if(dwAllowEncodingPropertyMask && (!This->uri || This->modified_props)) {
*ppIUri = NULL; *ppIUri = NULL;
return E_NOTIMPL; return E_NOTIMPL;
} }
if(!This->uri) {
*ppIUri = NULL;
return INET_E_INVALID_URL;
}
FIXME("(%p)->(0x%08x %d %d %p)\n", This, dwCreateFlags, dwAllowEncodingPropertyMask, (DWORD)dwReserved, ppIUri); FIXME("(%p)->(0x%08x %d %d %p)\n", This, dwCreateFlags, dwAllowEncodingPropertyMask, (DWORD)dwReserved, ppIUri);
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -4465,16 +4453,11 @@ static HRESULT WINAPI UriBuilder_CreateUriWithFlags(IUriBuilder *iface, ...@@ -4465,16 +4453,11 @@ static HRESULT WINAPI UriBuilder_CreateUriWithFlags(IUriBuilder *iface,
return E_POINTER; return E_POINTER;
/* Same as CreateUri. */ /* Same as CreateUri. */
if(dwAllowEncodingPropertyMask && !This->uri) { if(dwAllowEncodingPropertyMask && (!This->uri || This->modified_props)) {
*ppIUri = NULL; *ppIUri = NULL;
return E_NOTIMPL; return E_NOTIMPL;
} }
if(!This->uri) {
*ppIUri = NULL;
return INET_E_INVALID_URL;
}
FIXME("(%p)->(0x%08x 0x%08x %d %d %p)\n", This, dwCreateFlags, dwUriBuilderFlags, FIXME("(%p)->(0x%08x 0x%08x %d %d %p)\n", This, dwCreateFlags, dwUriBuilderFlags,
dwAllowEncodingPropertyMask, (DWORD)dwReserved, ppIUri); dwAllowEncodingPropertyMask, (DWORD)dwReserved, ppIUri);
return E_NOTIMPL; return E_NOTIMPL;
......
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