mshtml: Add IHTMLXMLHttpRequest::send() method implementation.

This commit is contained in:
Zhenbo Li 2015-07-07 22:49:58 +08:00 committed by Alexandre Julliard
parent f2669d6e9f
commit 119af47683
2 changed files with 36 additions and 15 deletions

View File

@ -613,13 +613,13 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url)
SET_EXPECT(xmlhttprequest_onreadystatechange_done); SET_EXPECT(xmlhttprequest_onreadystatechange_done);
hres = IHTMLXMLHttpRequest_send(xhr, vempty); hres = IHTMLXMLHttpRequest_send(xhr, vempty);
todo_wine ok(hres == S_OK, "send failed: %08x\n", hres); ok(hres == S_OK, "send failed: %08x\n", hres);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
pump_msgs(&called_xmlhttprequest_onreadystatechange_done); pump_msgs(&called_xmlhttprequest_onreadystatechange_done);
todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_opened); todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_opened);
todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_headers_received); CHECK_CALLED(xmlhttprequest_onreadystatechange_headers_received);
todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_loading); CHECK_CALLED(xmlhttprequest_onreadystatechange_loading);
todo_wine CHECK_CALLED(xmlhttprequest_onreadystatechange_done); CHECK_CALLED(xmlhttprequest_onreadystatechange_done);
if(FAILED(hres)) { if(FAILED(hres)) {
IHTMLXMLHttpRequest_Release(xhr); IHTMLXMLHttpRequest_Release(xhr);
@ -629,26 +629,27 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url)
val = 0xdeadbeef; val = 0xdeadbeef;
hres = IHTMLXMLHttpRequest_get_status(xhr, &val); hres = IHTMLXMLHttpRequest_get_status(xhr, &val);
ok(hres == S_OK, "get_status failed: %08x\n", hres); todo_wine ok(hres == S_OK, "get_status failed: %08x\n", hres);
todo_wine ok(val == 200, "Expect 200, got %d\n", val); todo_wine ok(val == 200, "Expect 200, got %d\n", val);
text = NULL;
hres = IHTMLXMLHttpRequest_get_statusText(xhr, &text); hres = IHTMLXMLHttpRequest_get_statusText(xhr, &text);
ok(hres == S_OK, "get_statusText failed: %08x\n", hres); todo_wine ok(hres == S_OK, "get_statusText failed: %08x\n", hres);
todo_wine ok(text != NULL, "text == NULL\n"); todo_wine ok(text != NULL, "text == NULL\n");
todo_wine ok(!strcmp_wa(text, "OK"), todo_wine ok(!strcmp_wa(text, "OK"), "Expected \"OK\", got %s\n", wine_dbgstr_w(text));
"Expected \"OK\", got %s\n", wine_dbgstr_w(text));
SysFreeString(text); SysFreeString(text);
val = 0xdeadbeef; val = 0xdeadbeef;
hres = IHTMLXMLHttpRequest_get_readyState(xhr, &val); hres = IHTMLXMLHttpRequest_get_readyState(xhr, &val);
ok(hres == S_OK, "get_readyState failed: %08x\n", hres); ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
todo_wine ok(val == 4, "Expect DONE, got %d\n", val); ok(val == 4, "Expect DONE, got %d\n", val);
text = NULL;
hres = IHTMLXMLHttpRequest_get_responseText(xhr, &text); hres = IHTMLXMLHttpRequest_get_responseText(xhr, &text);
ok(hres == S_OK, "get_responseText failed: %08x\n", hres); todo_wine ok(hres == S_OK, "get_responseText failed: %08x\n", hres);
ok(text != NULL, "test == NULL\n"); todo_wine ok(text != NULL, "test == NULL\n");
ok(!strcmp_wa(text, EXPECT_RESPONSE_TEXT), "expect %s, got %s\n", todo_wine ok(!strcmp_wa(text, EXPECT_RESPONSE_TEXT), "expect %s, got %s\n",
EXPECT_RESPONSE_TEXT, wine_dbgstr_w(text)); EXPECT_RESPONSE_TEXT, wine_dbgstr_w(text));
SysFreeString(text); SysFreeString(text);
IHTMLXMLHttpRequest_Release(xhr); IHTMLXMLHttpRequest_Release(xhr);

View File

@ -405,8 +405,28 @@ static HRESULT WINAPI HTMLXMLHttpRequest_open(IHTMLXMLHttpRequest *iface, BSTR b
static HRESULT WINAPI HTMLXMLHttpRequest_send(IHTMLXMLHttpRequest *iface, VARIANT varBody) static HRESULT WINAPI HTMLXMLHttpRequest_send(IHTMLXMLHttpRequest *iface, VARIANT varBody)
{ {
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface); HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%s)\n", This, debugstr_variant(&varBody)); nsresult nsres;
return E_NOTIMPL;
TRACE("(%p)->(%s)\n", This, debugstr_variant(&varBody));
switch(V_VT(&varBody)) {
case VT_NULL:
case VT_EMPTY:
case VT_ERROR:
break;
default:
FIXME("varBody(%s) unsupported\n", debugstr_variant(&varBody));
return E_FAIL;
}
nsres = nsIXMLHttpRequest_Send(This->nsxhr, NULL);
if(NS_FAILED(nsres)) {
ERR("nsIXMLHttpRequest_Send failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
} }
static HRESULT WINAPI HTMLXMLHttpRequest_getAllResponseHeaders(IHTMLXMLHttpRequest *iface, BSTR *p) static HRESULT WINAPI HTMLXMLHttpRequest_getAllResponseHeaders(IHTMLXMLHttpRequest *iface, BSTR *p)