winhttp/tests: Add a test for IWinHttpRequest::Invoke.
Dmitry Timoshkov
dmitry at baikal.ru
Thu Aug 27 05:28:32 CDT 2015
This test replicates what an application that I have here is doing, and it
currently fails under Wine. This looks like a problem with winhttp's typelib.
---
dlls/winhttp/tests/winhttp.c | 71 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 70 insertions(+), 1 deletion(-)
diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index 9bda2af..c3a3f11 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -26,11 +26,14 @@
#include <winhttp.h>
#include <wincrypt.h>
#include <winreg.h>
-#include "initguid.h"
+#include <initguid.h>
#include <httprequest.h>
+#include <httprequestid.h>
#include "wine/test.h"
+DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
+
static const WCHAR test_useragent[] =
{'W','i','n','e',' ','R','e','g','r','e','s','s','i','o','n',' ','T','e','s','t',0};
static const WCHAR test_winehq[] = {'t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',0};
@@ -3539,6 +3542,71 @@ static void test_IWinHttpRequest(void)
CoUninitialize();
}
+static void test_IWinHttpRequest_Invoke(void)
+{
+ static const WCHAR utf8W[] = {'U','T','F','-','8',0};
+ static const WCHAR regid[] = {'W','i','n','H','t','t','p','.','W','i','n','H','t','t','p','R','e','q','u','e','s','t','.','5','.','1',0};
+ WCHAR openW[] = {'O','p','e','n',0};
+ WCHAR optionW[] = {'O','p','t','i','o','n',0};
+ OLECHAR *open = openW, *option = optionW;
+ BSTR utf8;
+ CLSID clsid;
+ IWinHttpRequest *request;
+ IDispatch *dispatch;
+ DISPID id;
+ DISPPARAMS params;
+ VARIANT arg[3], ret;
+ UINT err;
+ BOOL bret;
+ HRESULT hr;
+
+ CoInitialize(NULL);
+
+ hr = CLSIDFromProgID(regid, &clsid);
+ ok(hr == S_OK, "CLSIDFromProgID error %#x\n", hr);
+ bret = IsEqualIID(&clsid, &CLSID_WinHttpRequest);
+ ok(bret || broken(!bret) /* win2003 */, "not expected %s\n", wine_dbgstr_guid(&clsid));
+
+ hr = CoCreateInstance(&CLSID_WinHttpRequest, 0, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&request);
+ ok(hr == S_OK, "error %#x\n", hr);
+
+ hr = IWinHttpRequest_QueryInterface(request, &IID_IDispatch, (void **)&dispatch);
+ ok(hr == S_OK, "error %#x\n", hr);
+ IDispatch_Release(dispatch);
+
+ hr = IWinHttpRequest_GetIDsOfNames(request, &IID_NULL, &open, 1, 0x0409, &id);
+ ok(hr == S_OK, "error %#x\n", hr);
+ ok(id == DISPID_HTTPREQUEST_OPEN, "expected DISPID_HTTPREQUEST_OPEN, got %u\n", id);
+
+ hr = IWinHttpRequest_GetIDsOfNames(request, &IID_NULL, &option, 1, 0x0409, &id);
+ ok(hr == S_OK, "error %#x\n", hr);
+ ok(id == DISPID_HTTPREQUEST_OPTION, "expected DISPID_HTTPREQUEST_OPTION, got %u\n", id);
+
+ memset(¶ms, 0, sizeof(params));
+ params.cArgs = 2;
+ params.cNamedArgs = 0;
+ params.rgvarg = arg;
+ V_VT(&arg[0]) = VT_BSTR;
+ utf8 = SysAllocString(utf8W);
+ V_BSTR(&arg[0]) = utf8;
+ V_VT(&arg[1]) = VT_R8;
+ V_R8(&arg[1]) = 2.0;
+ VariantInit(&ret);
+ hr = IWinHttpRequest_Invoke(request, id, &IID_NULL, 0, DISPATCH_METHOD, ¶ms, NULL, NULL, &err);
+todo_wine
+ ok(hr == S_OK, "error %#x\n", hr);
+
+ VariantInit(&ret);
+ hr = IWinHttpRequest_Invoke(request, id, &IID_NULL, 0, DISPATCH_METHOD, ¶ms, &ret, NULL, &err);
+todo_wine
+ ok(hr == S_OK, "error %#x\n", hr);
+
+ SysFreeString(utf8);
+ IWinHttpRequest_Release(request);
+
+ CoUninitialize();
+}
+
static void test_WinHttpDetectAutoProxyConfigUrl(void)
{
BOOL ret;
@@ -3839,6 +3907,7 @@ START_TEST (winhttp)
test_resolve_timeout();
test_credentials();
test_IWinHttpRequest();
+ test_IWinHttpRequest_Invoke();
test_WinHttpDetectAutoProxyConfigUrl();
test_WinHttpGetIEProxyConfigForCurrentUser();
test_WinHttpGetProxyForUrl();
--
2.4.8
More information about the wine-patches
mailing list