Thomas Mullaly : urlmon/tests: Added tests for IUriBuilder_GetSchemeName.
Alexandre Julliard
julliard at winehq.org
Mon Aug 23 10:50:13 CDT 2010
Module: wine
Branch: master
Commit: a9433c140264753936a16e843b4491e034f0771a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a9433c140264753936a16e843b4491e034f0771a
Author: Thomas Mullaly <thomas.mullaly at gmail.com>
Date: Fri Aug 20 11:30:51 2010 -0400
urlmon/tests: Added tests for IUriBuilder_GetSchemeName.
---
dlls/urlmon/tests/uri.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++
dlls/urlmon/uri.c | 13 +++++
2 files changed, 135 insertions(+), 0 deletions(-)
diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
index f904d0e..d125a43 100644
--- a/dlls/urlmon/tests/uri.c
+++ b/dlls/urlmon/tests/uri.c
@@ -5405,6 +5405,20 @@ static void test_IUriBuilder_GetInvalidArgs(void) {
ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
hr, E_POINTER);
ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
+
+ hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
+ ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
+ hr, E_POINTER);
+ received = (void*) 0xdeadbeef;
+ hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
+ ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
+ hr, E_POINTER);
+ ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
+ len = -1;
+ hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
+ ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
+ hr, E_POINTER);
+ ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
}
if(builder) IUriBuilder_Release(builder);
}
@@ -6025,6 +6039,113 @@ static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_te
}
}
+static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
+ DWORD test_index) {
+ HRESULT hr;
+ DWORD i;
+ LPCWSTR received = NULL;
+ DWORD len = -1;
+ const uri_builder_property *prop = NULL;
+
+ /* Check if the property was set earlier. */
+ for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
+ if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
+ prop = &(test->properties[i]);
+ }
+
+ if(prop) {
+ /* Use expected_value unless it's NULL, then use value. */
+ LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
+ hr = IUriBuilder_GetSchemeName(builder, &len, &received);
+ if(prop->todo) {
+ todo_wine {
+ ok(hr == (expected ? S_OK : S_FALSE),
+ "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+ hr, (expected ? S_OK : S_FALSE), test_index);
+ }
+ if(SUCCEEDED(hr)) {
+ todo_wine {
+ ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
+ expected, wine_dbgstr_w(received), test_index);
+ }
+ todo_wine {
+ ok(lstrlen(expected) == len,
+ "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+ lstrlen(expected), len, test_index);
+ }
+ }
+ } else {
+ ok(hr == (expected ? S_OK : S_FALSE),
+ "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+ hr, (expected ? S_OK : S_FALSE), test_index);
+ ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
+ expected, wine_dbgstr_w(received), test_index);
+ ok(lstrlen(expected) == len,
+ "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+ lstrlen(expected), len, test_index);
+ }
+ } else {
+ /* The property wasn't set earlier, so it should return whatever
+ * the base IUri contains (if anything).
+ */
+ IUri *uri = NULL;
+ hr = IUriBuilder_GetIUri(builder, &uri);
+ todo_wine {
+ ok(hr == S_OK,
+ "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+ hr, S_OK, test_index);
+ }
+ if(SUCCEEDED(hr)) {
+ BOOL has_prop = FALSE;
+ BSTR expected = NULL;
+
+ hr = IUri_GetSchemeName(uri, &expected);
+ ok(SUCCEEDED(hr),
+ "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
+ hr, test_index);
+ has_prop = hr == S_OK;
+
+ hr = IUriBuilder_GetSchemeName(builder, &len, &received);
+ if(has_prop) {
+ todo_wine {
+ ok(hr == S_OK,
+ "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+ hr, S_OK, test_index);
+ }
+ if(SUCCEEDED(hr)) {
+ todo_wine {
+ ok(!lstrcmpW(expected, received),
+ "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
+ wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
+ }
+ todo_wine {
+ ok(lstrlenW(expected) == len,
+ "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+ lstrlenW(expected), len, test_index);
+ }
+ }
+ } else {
+ todo_wine {
+ ok(hr == S_FALSE,
+ "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+ hr, S_FALSE, test_index);
+ }
+ if(SUCCEEDED(hr)) {
+ todo_wine {
+ ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
+ }
+ todo_wine {
+ ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
+ len, test_index);
+ }
+ }
+ }
+ SysFreeString(expected);
+ }
+ if(uri) IUri_Release(uri);
+ }
+}
+
/* Tests IUriBuilder functions. */
static void test_IUriBuilder(void) {
HRESULT hr;
@@ -6085,6 +6206,7 @@ static void test_IUriBuilder(void) {
test_IUriBuilder_GetPath(builder, &test, i);
test_IUriBuilder_GetPort(builder, &test, i);
test_IUriBuilder_GetQuery(builder, &test, i);
+ test_IUriBuilder_GetSchemeName(builder, &test, i);
test_IUriBuilder_CreateUri(builder, &test, i);
test_IUriBuilder_CreateUriSimple(builder, &test, i);
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
index 5837153..0466e81 100644
--- a/dlls/urlmon/uri.c
+++ b/dlls/urlmon/uri.c
@@ -4315,6 +4315,19 @@ static HRESULT WINAPI UriBuilder_GetQuery(IUriBuilder *iface, DWORD *pcchQuery,
static HRESULT WINAPI UriBuilder_GetSchemeName(IUriBuilder *iface, DWORD *pcchSchemeName, LPCWSTR *ppwzSchemeName)
{
UriBuilder *This = URIBUILDER_THIS(iface);
+ TRACE("(%p)->(%p %p)\n", This, pcchSchemeName, ppwzSchemeName);
+
+ if(!pcchSchemeName) {
+ if(ppwzSchemeName)
+ *ppwzSchemeName = NULL;
+ return E_POINTER;
+ }
+
+ if(!ppwzSchemeName) {
+ *pcchSchemeName = 0;
+ return E_POINTER;
+ }
+
FIXME("(%p)->(%p %p)\n", This, pcchSchemeName, ppwzSchemeName);
return E_NOTIMPL;
}
More information about the wine-cvs
mailing list