Thomas Mullaly : urlmon/tests: Added tests for IUriBuilder's IUri property.

Alexandre Julliard julliard at winehq.org
Tue Aug 24 11:09:20 CDT 2010


Module: wine
Branch: master
Commit: 3b383e2175f66a8b095dc3981633b604550cb6c1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3b383e2175f66a8b095dc3981633b604550cb6c1

Author: Thomas Mullaly <thomas.mullaly at gmail.com>
Date:   Sun Aug 22 15:26:31 2010 -0400

urlmon/tests: Added tests for IUriBuilder's IUri property.

---

 dlls/urlmon/tests/uri.c |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 dlls/urlmon/uri.c       |    5 +++++
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
index bff36a3..6bb05b7 100644
--- a/dlls/urlmon/tests/uri.c
+++ b/dlls/urlmon/tests/uri.c
@@ -6409,6 +6409,49 @@ static void test_IUriBuilder_HasBeenModified(void) {
     if(builder) IUriBuilder_Release(builder);
 }
 
+/* Test IUriBuilder {Get,Set}IUri functions. */
+static void test_IUriBuilder_IUriProperty(void) {
+    IUriBuilder *builder = NULL;
+    HRESULT hr;
+
+    hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
+    ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    if(SUCCEEDED(hr)) {
+        IUri *uri = NULL;
+
+        hr = IUriBuilder_GetIUri(builder, NULL);
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
+            hr, E_POINTER);
+
+        hr = pCreateUri(http_urlW, 0, 0, &uri);
+        if(SUCCEEDED(hr)) {
+            ULONG cur_count, orig_count;
+
+            /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
+            orig_count = get_refcnt(uri);
+            hr = IUriBuilder_SetIUri(builder, uri);
+            cur_count = get_refcnt(uri);
+            if(SUCCEEDED(hr)) {
+                todo_wine {
+                    ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
+                        orig_count+1, cur_count);
+                }
+            }
+
+            hr = IUriBuilder_SetIUri(builder, NULL);
+            cur_count = get_refcnt(uri);
+            if(SUCCEEDED(hr)) {
+                todo_wine {
+                    ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
+                        orig_count, cur_count);
+                }
+            }
+        }
+        if(uri) IUri_Release(uri);
+    }
+    if(builder) IUriBuilder_Release(builder);
+}
+
 START_TEST(uri) {
     HMODULE hurlmon;
 
@@ -6478,4 +6521,7 @@ START_TEST(uri) {
 
     trace("test IUriBuilder_HasBeenModified...\n");
     test_IUriBuilder_HasBeenModified();
+
+    trace("test IUriBuilder_IUriProperty...\n");
+    test_IUriBuilder_IUriProperty();
 }
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
index 64a7ef1..4a13f33 100644
--- a/dlls/urlmon/uri.c
+++ b/dlls/urlmon/uri.c
@@ -4181,6 +4181,11 @@ static HRESULT WINAPI UriBuilder_CreateUriWithFlags(IUriBuilder *iface,
 static HRESULT WINAPI  UriBuilder_GetIUri(IUriBuilder *iface, IUri **ppIUri)
 {
     UriBuilder *This = URIBUILDER_THIS(iface);
+    TRACE("(%p)->(%p)\n", This, ppIUri);
+
+    if(!ppIUri)
+        return E_POINTER;
+
     FIXME("(%p)->(%p)\n", This, ppIUri);
     return E_NOTIMPL;
 }




More information about the wine-cvs mailing list